/* Reiseabrechnung Modern - Styles - Fixed */
/* Removed Inter font import per user request for system fonts */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    /* Primary Colors - Modern Blue */
    --primary-color: #2563EB; /* Blue 600 */
    --primary-hover: #1D4ED8; /* Blue 700 */
    --primary-light: #EFF6FF; /* Blue 50 */
    
    /* Semantic Colors */
    --success-color: #10B981;
    --success-bg: #D1FAE5;
    --success-text: #065F46;
    
    --danger-color: #EF4444;
    --danger-bg: #FEE2E2;
    --danger-text: #991B1B;
    
    --warning-color: #F59E0B;
    --warning-bg: #FEF3C7;
    --warning-text: #92400E;
    
    --info-color: #3B82F6;
    --info-bg: #DBEAFE;
    --info-text: #1E40AF;

    /* Backgrounds */
    --bg-body: #F3F4F6; /* Gray 100 */
    --bg-surface: #FFFFFF;
    --bg-sidebar: #111827; /* Gray 900 */
    --bg-input: #F9FAFB;

    /* Text */
    --text-main: #111827; /* Gray 900 */
    --text-secondary: #4B5563; /* Gray 600 */
    --text-muted: #9CA3AF; /* Gray 400 */
    --text-inverse: #FFFFFF;
    
    /* Sidebar Text */
    --sidebar-text: #E5E7EB;
    --sidebar-text-muted: #9CA3AF;
    --sidebar-hover: rgba(255, 255, 255, 0.1);
    --sidebar-active: #2563EB;

    /* Borders & Shadows */
    --border-color: #E5E7EB; /* Gray 200 */
    --border-focus: #2563EB;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Dimensions */
    --header-height: 64px;
    --sidebar-width: 260px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    
    /* Transitions */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --primary-color: #3B82F6;
    --primary-hover: #60A5FA;
    --primary-light: rgba(37, 99, 235, 0.15);
    
    --bg-body: #0F172A;
    --bg-surface: #1E293B;
    --bg-sidebar: #020617;
    --bg-input: #0F172A;
    
    --text-main: #F9FAFB;
    --text-secondary: #D1D5DB;
    --text-muted: #6B7280;
    
    --border-color: #374151;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    
    --success-bg: rgba(16, 185, 129, 0.2);
    --success-text: #6EE7B7;
    
    --danger-bg: rgba(239, 68, 68, 0.2);
    --danger-text: #FCA5A5;
    
    --warning-bg: rgba(245, 158, 11, 0.2);
    --warning-text: #FCD34D;
    
    --info-bg: rgba(59, 130, 246, 0.2);
    --info-text: #93C5FD;
}

body {
    /* Reverted to system fonts for cleaner look */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    background-color: var(--bg-body);
    color: var(--text-main);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.main-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    transition: transform 0.3s ease;
}

.sidebar h2 {
    font-size: 1.25rem;
    font-weight: 700;
    padding: 1.5rem;
    color: var(--text-inverse);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-menu {
    list-style: none;
    padding: 0 1rem;
    margin-top: 1rem;
    flex: 1;
    overflow-y: auto;
}

.nav-menu li {
    margin-bottom: 0.5rem;
}

.nav-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--sidebar-text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: var(--transition);
}

.nav-menu a:hover {
    background-color: var(--sidebar-hover);
    color: var(--text-inverse);
    transform: translateX(4px);
}

.nav-menu a.active {
    background-color: var(--sidebar-active);
    color: var(--text-inverse);
}

/* Main Content */
.content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    max-width: 1600px;
    /* Extra padding at bottom for mobile nav */
    padding-bottom: 80px; 
}

/* Header */
.header {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 1.25rem 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    border: 1px solid var(--border-color);
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.025em;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Cards */
.card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.01);
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-surface);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Expense Stats Grid (Fixed) */
.expense-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    padding: 1.5rem;
}

.expense-stat-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    border-left: 4px solid var(--primary-color);
}

.expense-stat-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.expense-stat-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

.expense-stat-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Tables */
.table-container {
    overflow-x: auto;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

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

th {
    background-color: var(--bg-body);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: var(--primary-light);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    gap: 0.5rem;
    text-decoration: none;
    line-height: 1.25;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}
.btn-success:hover {
    filter: brightness(0.95);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}
.btn-secondary:hover {
    background-color: var(--bg-input);
    border-color: var(--text-secondary);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

/* Toggle Buttons (Restored) */
.btn-toggle {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    text-align: center;
    border-radius: var(--radius-md);
}

.btn-toggle:hover {
    border-color: var(--primary-color);
    background-color: var(--bg-input);
}

.btn-toggle.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Upload Area (Improved) */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    background: var(--bg-input);
    transition: all var(--transition);
    margin-bottom: 1rem;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
    transform: scale(1.01);
}

.upload-area-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.upload-area-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.upload-area-hint {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.multi-page-item img,
.multi-page-item-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pdf-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    font-size: 32px;
}

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

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

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

input, select, textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-main);
    transition: var(--transition);
    font-family: inherit;
    font-size: 0.95rem;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Badges */
.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-draft { background: var(--warning-bg); color: var(--warning-text); }
.badge-submitted { background: var(--info-bg); color: var(--info-text); }
.badge-completed { background: var(--success-bg); color: var(--success-text); }
.badge-archived { background: var(--bg-body); color: var(--text-secondary); }
.badge-correction_needed { background: var(--danger-bg); color: var(--danger-text); }

/* Login */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-body) 0%, #E0E7FF 100%);
}
[data-theme="dark"] .login-page {
    background: linear-gradient(135deg, #020617 0%, #1E1B4B 100%);
}

.login-box {
    background: var(--bg-surface);
    padding: 3rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 450px;
    border: 1px solid var(--border-color);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--bg-surface);
    margin: auto;
    padding: 2rem;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 600px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
}

.modal-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Trip Details Grid */
.trip-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem 2rem; /* Row gap smaller, Col gap larger */
    padding: 1.25rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem; /* Tighter grouping */
}

.detail-label {
    font-size: 0.75rem; /* Smaller, cleaner label */
    font-weight: 600;
    color: var(--text-muted); /* Lighter color for label */
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.detail-value {
    font-size: 1rem; /* Standard reading size */
    font-weight: 400; /* Normal weight, not bold */
    color: var(--text-main); /* Dark/Black for content */
    line-height: 1.4;
    font-family: inherit; /* Ensure system font */
}

.detail-full {
    grid-column: 1 / -1;
}

@media (max-width: 768px) {
    .trip-details-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
    }
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
    display: none; /* Hidden by default */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    z-index: 1000; /* Ensure it's on top */
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(60px + env(safe-area-inset-bottom));
}

.mobile-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 60px;
    width: 100%;
}

.mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    gap: 4px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    height: 100%;
}

.mobile-nav-item.active {
    color: var(--primary-color);
}

.mobile-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-nav-icon svg {
    width: 24px;
    height: 24px;
}

/* Mobile More Menu (Bottom Sheet) */
.mobile-more-menu {
    display: none; /* Hidden by default */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    z-index: 1001; /* Above nav */
    padding: 1rem 0;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    animation: slideUp 0.3s ease-out;
}

.mobile-more-menu.active {
    display: block;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.mobile-menu-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    text-decoration: none;
    color: var(--text-main);
    font-size: 1rem;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    transition: background-color 0.2s;
}

.mobile-menu-link:active {
    background-color: var(--bg-input);
}

.mobile-menu-link svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999; /* Below nav and menu */
    backdrop-filter: blur(2px);
}

.mobile-menu-overlay.active {
    display: block;
}

/* Utilities */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }

/* Loading Spinner */
.loading {
    display: flex;
    justify-content: center;
    padding: 2rem;
    color: var(--text-muted);
}
.loading::after {
    content: "";
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 0.5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Mobile & Responsive */
@media (max-width: 1024px) {
    .content {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    /* Layout Adjustments */
    .sidebar {
        display: none; /* Hide sidebar completely on mobile */
    }

    .mobile-bottom-nav {
        display: block; /* Show bottom nav on mobile */
    }

    .content {
        margin-left: 0;
        padding: 1rem;
        padding-bottom: 80px; /* Space for bottom nav */
    }

    /* Mobile Header */
    .header {
        position: relative;
        margin: 0 0 1rem 0;
        padding: 1rem;
        border: none;
        border-bottom: 1px solid var(--border-color);
        background: var(--bg-surface);
        justify-content: center; /* Center title */
    }

    .header h1 {
        font-size: 1.25rem;
        margin: 0;
        text-align: center;
    }
    
    /* Hide desktop actions in header if too crowded, or stack them */
    .header-actions {
        margin-top: 1rem;
        width: 100%;
        justify-content: center;
    }

    /* Mobile Menu Toggle - Hide it since we use bottom nav */
    .mobile-menu-toggle {
        display: none;
    }

    /* Cards & Stats */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    /* Expense Stats on Mobile */
    .expense-stats-grid {
        grid-template-columns: 1fr;
    }

    /* Responsive Tables (Card View) */
    .table-container {
        overflow-x: visible; 
        margin: 0;
        padding: 0;
    }
    
    table, thead, tbody, th, td, tr {
        display: block;
    }
    
    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    table {
        min-width: 0 !important;
    }
    
    tr {
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        background: var(--bg-surface);
        padding: 1rem;
        box-shadow: var(--shadow-sm);
    }
    
    td {
        border: none;
        border-bottom: 1px solid var(--border-color);
        position: relative;
        padding: 0.75rem 0 0.75rem 0;
        text-align: right;
        display: flex;
        justify-content: flex-end; /* Align content to right */
        align-items: center;
        min-height: 40px;
        gap: 1rem;
    }
    
    td:last-child {
        border-bottom: none;
    }
    
    td::before {
        content: attr(data-label);
        margin-right: auto; /* Push label to left */
        font-weight: 600;
        text-align: left;
        color: var(--text-secondary);
        font-size: 0.85rem;
    }
    
    /* Buttons */
    .btn {
        width: 100%; /* Full width on mobile often better for touch */
        justify-content: center;
        padding: 0.8rem;
    }
    
    .btn-sm {
        width: auto;
        padding: 0.5rem 0.75rem;
    }
    
    /* Trip Details on Mobile */
    .trip-details-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
    }

    /* Forms */
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}
