/* ================================
   MyTime - Zeiterfassung
   Dark Mode Design System
   ================================ */

/* CSS Variables */
:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-glass: rgba(30, 30, 50, 0.8);
    --bg-glass-hover: rgba(40, 40, 60, 0.9);

    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6b6b7b;

    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.3);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --transition: all 0.3s ease;

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.glass {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

/* ================================
   Login View
   ================================ */
#login-view {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #1a1a3e 100%);
}

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
    text-align: center;
}

.login-card .checkbox-group {
    justify-content: center;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    font-size: 4rem;
    margin-bottom: 0.5rem;
}

.login-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.login-header p {
    color: var(--text-secondary);
}

/* ================================
   Forms
   ================================ */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.text-input,
.select-input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    font-family: var(--font-family);
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.text-input:focus,
.select-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.text-input::placeholder {
    color: var(--text-muted);
}

.select-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23a0a0b0' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.select-input option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.checkbox-group {
    display: flex;
    align-items: center;
}

.checkbox-group label,
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.checkbox-group input[type="checkbox"],
.checkbox-label input[type="checkbox"] {
    width: 1.125rem;
    height: 1.125rem;
    accent-color: var(--accent-primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.error-text {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: 1rem;
    min-height: 1.25rem;
}

/* ================================
   Buttons
   ================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-family);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-icon {
    padding: 0.5rem 0.75rem;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Timer Button */
.btn-timer {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    font-size: 1rem;
    flex-direction: column;
    gap: 0.25rem;
}

.btn-start {
    background: linear-gradient(135deg, var(--success), #059669);
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.3);
}

.btn-start:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 40px rgba(16, 185, 129, 0.4);
}

.btn-stop {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    box-shadow: 0 8px 30px rgba(239, 68, 68, 0.3);
}

.btn-stop:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 40px rgba(239, 68, 68, 0.4);
}

.timer-icon {
    font-size: 1.5rem;
}

/* ================================
   Navigation
   ================================ */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    margin: 0.5rem;
    border-radius: var(--radius-lg);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-small {
    font-size: 1.5rem;
}

.brand-text {
    font-weight: 700;
    font-size: 1.125rem;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--accent-gradient);
    color: white;
}

.nav-actions {
    display: flex;
    gap: 0.25rem;
}

.nav-action-btn {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.nav-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Mobile Navigation */
@media (max-width: 768px) {
    .navbar {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .nav-brand {
        flex: 1;
    }

    .nav-actions {
        order: 2;
        gap: 0.5rem;
    }

    .nav-links {
        order: 3;
        width: 100%;
        justify-content: space-around;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid var(--border-color);
    }

    .nav-link {
        flex-direction: column;
        gap: 0.25rem;
        padding: 0.5rem;
        font-size: 0.75rem;
    }

    .nav-icon {
        font-size: 1.25rem;
    }

    .brand-text {
        display: none;
    }

    /* Selection Bar für Mobile */
    .selection-bar {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .selection-bar .btn {
        flex: 1;
        min-width: 120px;
        font-size: 0.75rem;
        padding: 0.5rem;
    }

    #selection-count {
        width: 100%;
        text-align: center;
        margin-bottom: 0.25rem;
    }
}

/* ================================
   Main Views
   ================================ */
.main-view {
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.main-view>section {
    margin-bottom: 1rem;
    padding: 1.5rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

/* ================================
   Timer Section
   ================================ */
.timer-section {
    text-align: center;
    padding: 2rem !important;
}

.timer-display {
    font-size: 4rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    margin-bottom: 1.5rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@media (max-width: 480px) {
    .timer-display {
        font-size: 3rem;
    }
}

.timer-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 480px) {
    .timer-controls {
        flex-direction: column;
    }
}

/* ================================
   Quick Entry
   ================================ */
.quick-entry h2 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
}

/* ================================
   Entries List
   ================================ */
.entries-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.entry-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.entry-card:hover {
    background: rgba(255, 255, 255, 0.06);
}

.entry-color {
    width: 4px;
    height: 40px;
    border-radius: 2px;
    flex-shrink: 0;
}

.entry-info {
    flex: 1;
    min-width: 0;
}

.entry-customer {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.entry-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.entry-meta {
    text-align: right;
    flex-shrink: 0;
}

.entry-duration {
    font-size: 1.125rem;
    font-weight: 600;
}

.entry-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.entry-actions {
    display: flex;
    gap: 0.25rem;
}

.entry-action {
    padding: 0.5rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    opacity: 0.5;
    transition: var(--transition);
}

.entry-action:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

/* Entry States */
.entry-card.ignored {
    opacity: 0.5;
}

.entry-card.billed {
    border-left: 3px solid var(--success);
}

/* ================================
   Customers
   ================================ */
.customers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.customer-card {
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--accent-primary);
    transition: var(--transition);
    cursor: pointer;
}

.customer-card:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-2px);
}

.customer-name {
    font-weight: 600;
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.customer-stats {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ================================
   Month Navigation
   ================================ */
.view-mode-toggle {
    display: flex;
    gap: 0.25rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.25rem;
    border-radius: var(--radius-md);
}

.view-mode-btn {
    background: transparent;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.view-mode-btn:hover {
    color: var(--text-primary);
}

.view-mode-btn.active {
    background: var(--accent-gradient);
    color: white;
}

.month-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#current-month,
#export-current-month {
    font-weight: 600;
    min-width: 140px;
    text-align: center;
}

/* ================================
   Overview Stats
   ================================ */
.overview-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    text-align: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

@media (max-width: 480px) {
    .overview-stats {
        grid-template-columns: 1fr;
    }
}

/* ================================
   Filter Bar
   ================================ */
.filter-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filter-bar .select-input {
    flex: 1;
    min-width: 150px;
}

/* ================================
   Selection Bar
   ================================ */
.selection-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid var(--accent-primary);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

#selection-count {
    font-weight: 600;
    color: var(--accent-primary);
}

/* ================================
   Entries Table
   ================================ */
.entries-table {
    overflow-x: auto;
}

.entries-table table {
    width: 100%;
    border-collapse: collapse;
}

.entries-table th,
.entries-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.entries-table th {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.entries-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

.entries-table tr.selected td {
    background: rgba(99, 102, 241, 0.15);
}

.entries-table tr {
    cursor: pointer;
}

.entries-table input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

/* ================================
   Export
   ================================ */
.export-options {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.export-entries-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.export-group {
    margin-bottom: 1rem;
}

.export-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-left: 4px solid var(--accent-primary);
    border-radius: var(--radius-sm);
}

.export-group-total {
    font-weight: 700;
    color: var(--accent-primary);
    font-size: 1.125rem;
}

.export-group-entries {
    padding-left: 1rem;
}

.export-entry-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.export-entry-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.export-entry-row.selected {
    background: rgba(99, 102, 241, 0.1);
}

.export-entry-hours {
    width: 60px;
    font-weight: 600;
}

.export-entry-date {
    width: 60px;
    color: var(--text-muted);
}

.export-entry-desc {
    flex: 1;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.export-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

/* ================================
   Import
   ================================ */
.import-preview {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
}

.import-entry-row {
    display: grid;
    grid-template-columns: 100px 120px 60px 1fr;
    gap: 1rem;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.import-entry-row:last-child {
    border-bottom: none;
}

@media (max-width: 768px) {
    .import-entry-row {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
}

.export-preview {
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 0.875rem;
    white-space: pre-wrap;
    min-height: 150px;
    max-height: 300px;
    overflow-y: auto;
}

.export-customer {
    color: var(--accent-primary);
    font-weight: 600;
    margin-top: 1rem;
}

.export-customer:first-child {
    margin-top: 0;
}

.export-entry {
    color: var(--text-secondary);
}

/* ================================
   Modal
   ================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.5rem;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* ================================
   Toast Notifications
   ================================ */
#toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--danger);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ================================
   Color Picker
   ================================ */
.color-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.color-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
}

.color-option:hover,
.color-option.selected {
    border-color: white;
    transform: scale(1.1);
}

/* ================================
   Responsive Helpers
   ================================ */
@media (max-width: 768px) {
    .main-view>section {
        padding: 1rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ================================
   Scrollbar
   ================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}