/* ═══════════════════════════════════════════════════════════════
   TAXI-BUCHHALTUNG PRO — Premium Dark Glassmorphism Design
   ═══════════════════════════════════════════════════════════════ */

/* ──── Design Tokens ──── */
:root {
    /* Core palette */
    --bg-deep: #0a0e1a;
    --bg-surface: #111827;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-glass: rgba(255, 255, 255, 0.04);
    --bg-glass-hover: rgba(255, 255, 255, 0.08);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glass-strong: rgba(255, 255, 255, 0.15);

    /* Text */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-accent: #60a5fa;

    /* Accents */
    --accent-blue: #3b82f6;
    --accent-blue-glow: rgba(59, 130, 246, 0.25);
    --accent-green: #22c55e;
    --accent-green-glow: rgba(34, 197, 94, 0.25);
    --accent-amber: #f59e0b;
    --accent-amber-glow: rgba(245, 158, 11, 0.25);
    --accent-purple: #a855f7;
    --accent-purple-glow: rgba(168, 85, 247, 0.25);
    --accent-red: #ef4444;
    --accent-red-glow: rgba(239, 68, 68, 0.25);
    --accent-cyan: #06b6d4;

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

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow-blue: 0 0 30px rgba(59, 130, 246, 0.15);
    --shadow-glow-green: 0 0 30px rgba(34, 197, 94, 0.15);

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(59, 130, 246, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 80% 100%, rgba(168, 85, 247, 0.06) 0%, transparent 60%);
}

/* ──── Screens ──── */
.screen {
    display: none;
    animation: fadeIn 0.5s var(--ease-out);
}
.screen.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
}

/* ═══════════════════ LOGIN SCREEN ═══════════════════ */

#login-screen {
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
    position: fixed;
    inset: 0;
    z-index: 500;
    background: var(--bg-deep);
    background-image:
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(59, 130, 246, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 80% 100%, rgba(168, 85, 247, 0.06) 0%, transparent 60%);
}
#login-screen.active {
    display: flex;
}

.login-container {
    text-align: center;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    padding: 3rem 2.5rem;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow-lg), var(--shadow-glow-blue);
    animation: scaleIn 0.6s var(--ease-spring);
}

.login-icon {
    font-size: 4rem;
    margin-bottom: 0.5rem;
    animation: pulse 2s ease-in-out infinite;
}

.login-title {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.3rem;
}

.pro-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    font-size: 0.6em;
    font-weight: 700;
    padding: 0.15em 0.5em;
    border-radius: 6px;
    vertical-align: middle;
    position: relative;
    top: -2px;
    letter-spacing: 0.05em;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

/* Login Form */
.form-field { margin-bottom: 1rem; text-align: left; }
.form-field label { display: block; color: var(--text-secondary); font-size: 0.82rem; font-weight: 500; margin-bottom: 0.35rem; }
.form-field input {
    width: 100%; padding: 0.7rem 0.9rem; background: var(--bg-glass); border: 1px solid var(--border-glass-strong);
    border-radius: var(--radius-sm); color: var(--text-primary); font-family: 'Inter', sans-serif; font-size: 0.95rem; transition: all 0.2s;
}
.form-field input:focus { outline: none; border-color: var(--accent-blue); box-shadow: 0 0 0 3px var(--accent-blue-glow); }
.form-field input::placeholder { color: var(--text-muted); }
.form-error { color: var(--accent-red); font-size: 0.85rem; min-height: 1.2rem; margin-bottom: 0.5rem; font-weight: 500; }
#login-form { margin-top: 0.5rem; }

/* Header User Badge */
.header-user { color: var(--text-secondary); font-size: 0.85rem; font-weight: 500; padding: 0.4rem 0.8rem; background: var(--bg-glass); border-radius: var(--radius-sm); border: 1px solid var(--border-glass); }

/* Admin Panel */
.modal-wide { max-width: 600px; }
.modal-header-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-close-btn { background: var(--bg-glass); border: 1px solid var(--border-glass); color: var(--text-secondary); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 1rem; transition: all 0.2s; }
.modal-close-btn:hover { background: var(--bg-glass-hover); color: var(--text-primary); }

.admin-create { margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border-glass); }
.admin-create h4, .admin-list h4 { font-size: 0.9rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.admin-create-form { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.admin-create-form input, .admin-create-form select {
    flex: 1; min-width: 120px; padding: 0.55rem 0.75rem; background: var(--bg-glass); border: 1px solid var(--border-glass-strong);
    border-radius: var(--radius-sm); color: var(--text-primary); font-family: 'Inter', sans-serif; font-size: 0.85rem;
}
.admin-create-form select { min-width: 100px; flex: 0.6; }
.admin-create-form input:focus, .admin-create-form select:focus { outline: none; border-color: var(--accent-blue); }
.admin-create-form select option { background: var(--bg-surface); }

.admin-table-wrapper { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--border-glass); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.admin-table th { padding: 0.6rem 0.8rem; text-align: left; font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); background: rgba(255,255,255,0.03); border-bottom: 1px solid var(--border-glass); }
.admin-table td { padding: 0.6rem 0.8rem; border-bottom: 1px solid rgba(255,255,255,0.03); }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover { background: var(--bg-glass-hover); }
.role-badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; }
.role-badge.admin { background: var(--accent-purple-glow); color: var(--accent-purple); }
.role-badge.user { background: var(--accent-blue-glow); color: var(--accent-blue); }
.btn-delete { background: transparent; border: 1px solid var(--accent-red); color: var(--accent-red); padding: 0.3rem 0.6rem; border-radius: 6px; font-size: 0.78rem; cursor: pointer; font-weight: 600; transition: all 0.2s; }
.btn-delete:hover { background: var(--accent-red); color: white; }

/* ═══════════════════ BUTTONS ═══════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.25s var(--ease-out);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity 0.25s;
}
.btn:hover::after {
    opacity: 1;
}

.btn-icon {
    font-size: 1.1em;
}

.btn-sm { padding: 0.45rem 1rem; font-size: 0.82rem; }
.btn-md { padding: 0.65rem 1.4rem; font-size: 0.9rem; }
.btn-lg { padding: 0.85rem 2rem; font-size: 1rem; width: 100%; }

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), #2563eb);
    color: white;
    box-shadow: 0 4px 15px var(--accent-blue-glow);
}
.btn-primary:hover {
    box-shadow: 0 6px 25px rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
}
.btn-primary:active { transform: translateY(0); }

.btn-accent {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 4px 15px var(--accent-red-glow);
}
.btn-accent:hover {
    box-shadow: 0 6px 25px rgba(239, 68, 68, 0.4);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-green), #16a34a);
    color: white;
    box-shadow: 0 4px 15px var(--accent-green-glow);
}
.btn-success:hover {
    box-shadow: 0 6px 25px rgba(34, 197, 94, 0.4);
    transform: translateY(-2px);
}

.btn-ghost {
    background: var(--bg-glass);
    color: var(--text-secondary);
    border: 1px solid var(--border-glass);
}
.btn-ghost:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
    border-color: var(--border-glass-strong);
}

/* ═══════════════════ APP HEADER ═══════════════════ */

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-logo {
    font-size: 1.6rem;
}

.header-title {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.header-right {
    display: flex;
    gap: 0.5rem;
}

.he.admin-table td button {
    padding: 4px 8px;
    font-size: 0.8rem;
}

/* Legal Content */
.legal-content {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.legal-content p {
    margin-bottom: 12px;
}

.legal-content strong {
    color: var(--text);
}

/* ═══════════════════ DASHBOARD ═══════════════════ */

.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    padding: 1.5rem 2rem;
    animation: slideUp 0.5s var(--ease-out);
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    transition: all 0.3s var(--ease-out);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    font-size: 2rem;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.stat-income .stat-icon { background: var(--accent-green-glow); }
.stat-days .stat-icon   { background: var(--accent-blue-glow); }
.stat-average .stat-icon { background: var(--accent-amber-glow); }
.stat-balance .stat-icon { background: var(--accent-purple-glow); }

.stat-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.2rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.stat-income .stat-value { color: var(--accent-green); }
.stat-days .stat-value   { color: var(--accent-blue); }
.stat-average .stat-value { color: var(--accent-amber); }
.stat-balance .stat-value { color: var(--accent-purple); }

/* ═══════════════════ UPLOAD ZONE ═══════════════════ */

.upload-section {
    padding: 1.5rem 2rem;
}

.drop-zone {
    position: relative;
    border: 2px dashed var(--border-glass-strong);
    border-radius: var(--radius-xl);
    padding: 3.5rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.35s var(--ease-out);
    background: var(--bg-glass);
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.06);
    box-shadow: var(--shadow-glow-blue);
    transform: scale(1.005);
}

.drop-zone.drag-over {
    border-style: solid;
}

.drop-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    transition: transform 0.3s var(--ease-spring);
}

.drop-zone:hover .drop-icon,
.drop-zone.drag-over .drop-icon {
    transform: scale(1.15) translateY(-4px);
}

.drop-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.drop-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.drop-hint {
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* Upload success state */
.drop-zone.loaded {
    border-color: var(--accent-green);
    background: rgba(34, 197, 94, 0.06);
    border-style: solid;
}
.drop-zone.loaded .drop-icon::after {
    content: ' ✓';
    color: var(--accent-green);
}

/* ═══════════════════ DATA TABLE ═══════════════════ */

.table-section {
    padding: 0 2rem 2rem;
    animation: slideUp 0.5s var(--ease-out) 0.1s both;
}

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

.section-title {
    font-size: 1.2rem;
    font-weight: 700;
}

.table-actions {
    display: flex;
    gap: 0.6rem;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-glass);
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow-md);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

thead th {
    padding: 0.9rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border-glass);
    position: sticky;
    top: 0;
    white-space: nowrap;
}

thead th.editable-header {
    color: var(--accent-cyan);
}
thead th.editable-header::after {
    content: ' ✏️';
    font-size: 0.7em;
}

tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.2s;
    white-space: nowrap;
}

tbody tr {
    transition: background 0.2s;
}

tbody tr:hover {
    background: var(--bg-glass-hover);
}

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

/* Editable cells */
td.editable {
    position: relative;
    cursor: text;
    min-width: 100px;
}

td.editable .cell-input {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 0.3rem 0.5rem;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.92rem;
    width: 100%;
    transition: all 0.2s;
    text-align: right;
}

td.editable .cell-input:hover {
    border-color: var(--border-glass-strong);
    background: var(--bg-glass);
}

td.editable .cell-input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.08);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.12);
}

/* Amount columns */
td.amount {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

td.amount-positive { color: var(--accent-green); }
td.amount-negative { color: var(--accent-red); }

/* Date column */
td.date-cell {
    font-weight: 600;
    color: var(--text-primary);
}

/* Saldo column */
td.saldo {
    font-weight: 700;
    text-align: right;
}

/* Table footer */
tfoot td {
    padding: 1rem;
    font-weight: 700;
    border-top: 2px solid var(--border-glass-strong);
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.95rem;
}

tfoot td.amount { font-size: 1rem; }

.table-hint {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-top: 0.8rem;
    padding-left: 0.25rem;
}

/* ═══════════════════ MODAL ═══════════════════ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.25s;
    padding: 1rem;
}

.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass-strong);
    border-radius: var(--radius-xl);
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.3s var(--ease-spring);
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.modal-field {
    margin-bottom: 1rem;
}

.modal-field label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
}

.modal-field input {
    width: 100%;
    padding: 0.65rem 0.85rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass-strong);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.modal-field input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

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

/* ═══════════════════ TOAST ═══════════════════ */

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    opacity: 0;
    transition: all 0.35s var(--ease-out);
    pointer-events: none;
    max-width: 90vw;
    text-align: center;
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: linear-gradient(135deg, var(--accent-green), #16a34a);
    color: white;
}

.toast.error {
    background: linear-gradient(135deg, var(--accent-red), #dc2626);
    color: white;
}

.toast.info {
    background: linear-gradient(135deg, var(--accent-blue), #2563eb);
    color: white;
}

.login-footer {
    margin-top: 24px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.login-footer a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.login-footer a:hover {
    color: var(--text);
    text-decoration: underline;
}

/* ═══════════════════ MAIN APPLICATION ═══════════════════ */

.hidden {
    display: none !important;
}

.shake {
    animation: shake 0.4s ease-in-out;
}

/* ═══════════════════ RESPONSIVE ═══════════════════ */

@media (max-width: 768px) {
    .app-header {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .header-title { font-size: 1rem; }

    .dashboard {
        grid-template-columns: 1fr 1fr;
        padding: 1rem;
    }

    .upload-section,
    .table-section {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .drop-zone { padding: 2rem 1.5rem; }

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

    .table-actions {
        width: 100%;
    }

    .table-actions .btn {
        flex: 1;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.2rem;
    }
}

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

    .header-right .btn span:last-child {
        display: none;
    }

    .login-container {
        padding: 2rem 1.5rem;
    }
}

/* ──── Scrollbar ──── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-glass-strong);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
