/* ========================================
   Busreservierung - Clean Grey/White Theme
   ======================================== */

:root {
    --primary: #374151;
    --primary-hover: #1F2937;
    --primary-deep: #111827;
    --primary-light: rgba(55,65,81,0.08);
    --primary-glow: rgba(55,65,81,0.15);
    --accent: #6B7280;
    --accent-light: rgba(107,114,128,0.10);
    --success: #059669;
    --success-glow: rgba(5,150,105,0.15);
    --danger: #DC2626;
    --danger-glow: rgba(220,38,38,0.15);
    --warning: #D97706;

    --glass: rgba(255,255,255,0.80);
    --glass-border: rgba(0,0,0,0.06);
    --glass-hover: rgba(255,255,255,0.95);

    --text: #111827;
    --text-dim: #4B5563;
    --text-faint: #9CA3AF;
    --text-white: #111827;

    --blur: 20px;
    --radius: 12px;
    --radius-sm: 8px;
    --ease: 0.15s cubic-bezier(.4,0,.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text);
    height: 100%;
    background: #F3F4F6;
    -webkit-font-smoothing: antialiased;
}

body::before, body::after { display: none; }

/* ======================================== Layout ======================================== */
.app-layout { display: flex; flex-direction: column; height: 100vh; overflow: hidden; position: relative; z-index: 1; }

/* ======================================== Top Navigation ======================================== */
.topnav {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 28px; gap: 16px;
    background: #FFFFFF;
    border-bottom: 1px solid #E5E7EB;
    position: relative; z-index: 10;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.topnav-brand {
    display: flex; align-items: center; gap: 10px;
    text-decoration: none; color: var(--text);
}

.topnav-logo { color: var(--primary); }

.topnav-title { font-size: 18px; font-weight: 800; letter-spacing: -0.3px; }

.topnav-links {
    display: flex; align-items: center; gap: 4px;
}

.topnav-link {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: 8px;
    color: var(--text-dim); text-decoration: none;
    font-size: 13px; font-weight: 500;
    transition: all var(--ease);
}

.topnav-link:hover { color: var(--text); background: #F3F4F6; }

.topnav-link.active {
    color: var(--text);
    background: #F3F4F6;
    border: 1px solid #E5E7EB;
    font-weight: 700;
}

.topnav-right {
    display: flex; align-items: center; gap: 12px;
}

.topnav-user {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; color: var(--text-dim);
}

.topnav-logout {
    display: flex; align-items: center; gap: 5px;
    padding: 6px 14px; border-radius: 20px;
    border: 1px solid #E5E7EB;
    color: var(--text-dim); text-decoration: none;
    font-size: 12px; font-weight: 600;
    transition: all var(--ease);
}

.topnav-logout:hover {
    color: var(--danger);
    background: #FEF2F2;
    border-color: #FECACA;
}

/* ======================================== Main Content ======================================== */
.main-content {
    flex: 1; overflow-y: auto; padding: 24px 28px;
}

.main-content > * { max-width: 960px; margin-left: auto; margin-right: auto; }

.main-content::-webkit-scrollbar { width: 4px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 4px; }

/* ======================================== Typography ======================================== */
h1 { font-size: 22px; font-weight: 800; margin-bottom: 18px; letter-spacing: -0.5px; color: var(--text-white); }
h2 { font-size: 17px; font-weight: 700; margin-bottom: 12px; color: var(--text-white); }
h3 {
    font-size: 11px; font-weight: 700; margin-bottom: 10px;
    color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.8px;
}

.page-header { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.page-icon { color: var(--accent); filter: drop-shadow(0 0 8px var(--primary-glow)); }

/* ======================================== Card ======================================== */
.card {
    position: relative; overflow: hidden;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: var(--radius); padding: 18px; margin-bottom: 12px;
    transition: all var(--ease);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.card::before { display: none; }

.card:hover {
    border-color: #D1D5DB;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* ======================================== Buttons ======================================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 16px; border: 1px solid transparent; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600; cursor: pointer;
    transition: all var(--ease); text-decoration: none; font-family: inherit;
}

.btn-primary {
    background: var(--primary); color: white;
    border-color: var(--primary-deep);
}
.btn-primary:hover { background: var(--primary-deep); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.12); }

.btn-success {
    background: linear-gradient(135deg, #1B5E20, var(--success));
    color: white; border-color: rgba(46,125,50,0.30);
    box-shadow: 0 3px 14px var(--success-glow);
}
.btn-success:hover { box-shadow: 0 6px 24px rgba(46,125,50,0.30); transform: translateY(-1px); }

.btn-danger {
    background: linear-gradient(135deg, #B71C1C, var(--danger));
    color: white; border-color: rgba(198,40,40,0.30);
    box-shadow: 0 3px 14px var(--danger-glow);
}
.btn-danger:hover { box-shadow: 0 6px 24px rgba(198,40,40,0.30); transform: translateY(-1px); }

.btn-secondary {
    background: #FFFFFF; color: var(--text);
    border: 1px solid #D1D5DB;
}
.btn-secondary:hover { background: #F9FAFB; border-color: #9CA3AF; }

.btn-icon {
    background: transparent; border: none; padding: 6px;
    border-radius: 6px; cursor: pointer;
    transition: all var(--ease); color: var(--text-dim);
}
.btn-icon:hover { background: #F3F4F6; color: var(--text); }

.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ======================================== Forms ======================================== */
.form-group { margin-bottom: 12px; }

.form-label {
    display: block; font-size: 10px; font-weight: 700;
    color: var(--text-faint); text-transform: uppercase;
    letter-spacing: 1px; margin-bottom: 5px;
}

.form-control {
    width: 100%; height: 38px; padding: 7px 12px;
    border: 1px solid #D1D5DB; border-radius: var(--radius-sm);
    font-size: 13px; font-family: inherit;
    background: #FFFFFF; color: var(--text);
    outline: none; transition: all var(--ease);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(55,65,81,0.08);
}

.form-control::placeholder { color: var(--text-faint); }

select.form-control {
    cursor: pointer; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239CA3AF' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
    padding-right: 28px; background-color: white;
}

.form-row { display: flex; gap: 12px; align-items: end; }
.form-row .form-group { flex: 1; }

/* ======================================== Tables ======================================== */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.data-table th {
    text-align: left; padding: 7px 8px;
    font-size: 10px; font-weight: 700;
    color: var(--text-faint); text-transform: uppercase;
    letter-spacing: 1px; border-bottom: 1px solid #E5E7EB;
}

.data-table td { padding: 7px 8px; border-bottom: 1px solid #F3F4F6; }
.data-table tbody tr { transition: background var(--ease); }
.data-table tbody tr:hover { background: #F9FAFB; }

.text-right { text-align: right; }
.text-center { text-align: center; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -18px; padding: 0 18px; }

/* ======================================== Tabs ======================================== */
.tab-bar {
    display: flex; gap: 3px; margin-bottom: 16px;
    padding: 3px; background: #F3F4F6;
    border-radius: var(--radius-sm);
    border: 1px solid #E5E7EB;
    width: fit-content;
}

.tab-btn {
    padding: 6px 14px; border: 1px solid transparent;
    background: transparent; color: var(--text-dim);
    font-size: 12.5px; font-weight: 600; font-family: inherit;
    cursor: pointer; border-radius: 7px; transition: all var(--ease);
}
.tab-btn:hover { color: var(--text); background: #E5E7EB; }

.tab-btn.active {
    color: var(--text); background: #FFFFFF;
    border-color: #D1D5DB;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    font-weight: 700;
}

/* ======================================== Badges ======================================== */
.badge {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 2px 8px; border-radius: 999px;
    font-size: 11px; font-weight: 700; border: 1px solid transparent;
}

.badge-bestaetigt { background: #ECFDF5; color: #059669; border-color: #A7F3D0; }
.badge-angefragt { background: #FFFBEB; color: #D97706; border-color: #FDE68A; }
.badge-abgelehnt { background: #FEF2F2; color: #DC2626; border-color: #FECACA; }
.badge-storniert { background: #F3F4F6; color: #9CA3AF; border-color: #E5E7EB; }

/* ======================================== Booking Card ======================================== */
.booking-card { position: relative; }

.booking-card.status-confirmed { border-left: 3px solid var(--success); }
.booking-card.status-pending { border-left: 3px solid var(--warning); }
.booking-card.status-rejected { border-left: 3px solid var(--danger); opacity: 0.6; }
.booking-card.status-cancelled { border-left: 3px solid #D1D5DB; opacity: 0.5; }

.booking-card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px; gap: 8px;
}

.booking-card-date {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 600; color: var(--text);
}

.booking-time {
    font-size: 11px; font-weight: 500; color: var(--text-faint);
    background: #F3F4F6; padding: 1px 6px; border-radius: 4px;
}

.booking-card-body { position: relative; z-index: 1; }
.booking-purpose { font-size: 13px; color: var(--text-dim); margin-bottom: 4px; }

.booking-user {
    display: flex; align-items: center; gap: 4px;
    font-size: 11px; color: var(--text-faint);
}

.booking-note {
    display: flex; align-items: center; gap: 4px;
    font-size: 11px; color: #D97706;
    background: #FFFBEB;
    padding: 4px 8px; border-radius: 6px; margin-top: 6px;
    position: relative; z-index: 1;
}

.booking-actions {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    margin-top: 8px; padding-top: 8px;
    border-top: 1px solid #F3F4F6;
    position: relative; z-index: 1;
}

/* ======================================== Vertical Week View ======================================== */
.weekv-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.weekv-table {
    width: 100%; border-collapse: collapse;
    table-layout: fixed; min-width: 500px;
}

.weekv-table th, .weekv-table td { border: 1px solid #F3F4F6; }

.weekv-time-header { width: 48px; min-width: 48px; padding: 6px; }

.weekv-day-header {
    text-align: center; padding: 8px 4px;
    font-size: 12px; font-weight: 600;
}

.weekv-day-name {
    display: block; font-size: 10px; font-weight: 600;
    color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.5px;
}

.weekv-day-num { font-size: 16px; font-weight: 800; color: var(--text); line-height: 1.4; }

.weekv-today-col { background: #F3F4F6; }

.weekv-today-num {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary); color: white;
    width: 28px; height: 28px; border-radius: 50%; font-weight: 800;
}

.weekv-weekend-col { background: #FEFCE8; }
.weekv-weekend-col .weekv-day-name { color: #A16207; }

.weekv-time-label {
    width: 48px; min-width: 48px; padding: 4px 6px;
    font-size: 11px; font-weight: 600; color: var(--text-faint);
    text-align: right; vertical-align: top;
}

.weekv-slot {
    height: 42px; padding: 1px; vertical-align: top;
    cursor: pointer; transition: background var(--ease);
    position: relative;
}
.weekv-slot:hover { background: #F3F4F6; }

.weekv-today-slot { background: rgba(243,244,246,0.5); }
.weekv-weekend-slot { background: rgba(254,252,232,0.5); }

.weekv-booked { padding: 1px; cursor: default; }
.weekv-booked:hover { background: transparent; }

.weekv-disabled { background: #F9FAFB; cursor: default; }
.weekv-disabled:hover { background: #F9FAFB; }

.weekv-allday-row { background: #FAFAFA; }
.weekv-allday-slot { padding: 2px; }

.weekv-block {
    border-radius: 6px; padding: 4px 6px;
    font-size: 11px; font-weight: 600; height: 100%;
    display: flex; flex-direction: column; justify-content: center; gap: 2px;
    overflow: hidden;
}

.weekv-block .block-time { font-size: 10px; font-weight: 700; opacity: 0.85; }
.weekv-block .block-title { font-size: 12px; font-weight: 700; white-space: normal; word-break: break-word; line-height: 1.3; }
.weekv-block .block-user { font-size: 10px; opacity: 0.75; }

.block-confirmed { background: #ECFDF5; color: #065F46; border-left: 3px solid #059669; }
.block-pending { background: #FFFBEB; color: #92400E; border-left: 3px solid #D97706; }

.block-time { font-size: 9px; font-weight: 700; opacity: 0.8; }
.block-title { font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.block-user { font-size: 10px; opacity: 0.7; display: flex; align-items: center; gap: 3px; }

/* ======================================== Modal ======================================== */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.50);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; animation: fadeIn .2s ease;
}

.modal-dialog {
    position: relative; overflow: hidden;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: var(--radius);
    padding: 24px; min-width: 340px; max-width: 480px; width: 94%;
    box-shadow: 0 24px 64px rgba(0,0,0,0.15);
    animation: slideUp .3s cubic-bezier(.4,0,.2,1);
}

.modal-dialog::before { display: none; }

.modal-header h2 { font-size: 17px; color: var(--text); }
.modal-body { color: var(--text-dim); }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; }

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { opacity: 0; transform: translateY(14px) scale(.98) } to { opacity: 1; transform: none } }

/* ======================================== Messages ======================================== */
.success-message {
    text-align: center; padding: 24px;
    color: var(--success); position: relative; z-index: 1;
}
.success-message h2 { color: var(--success); }

.success-msg {
    background: #ECFDF5; color: #059669;
    border: 1px solid #A7F3D0;
    padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px;
}

.error-message {
    background: #FEF2F2; color: #DC2626;
    border: 1px solid #FECACA;
    padding: 8px 12px; border-radius: var(--radius-sm);
    font-size: 13px; display: flex; align-items: center; gap: 6px;
}

/* ======================================== Dashboard ======================================== */
.dash-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px; margin-bottom: 16px;
}

.dash-title { display: flex; align-items: center; gap: 10px; }

.dash-logo {
    width: 36px; height: 36px; object-fit: contain;
    border-radius: 8px;
}

.info-banner {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 10px 14px; margin-bottom: 8px;
    background: #FFFBEB; border-color: #FDE68A;
    font-size: 13px; color: #92400E; line-height: 1.5;
    white-space: pre-line;
}

.dash-calendar-card { padding: 12px; }

.sponsor-bar {
    display: flex; align-items: center; justify-content: center;
    gap: 24px; padding: 12px 16px; margin-bottom: 12px;
    flex-wrap: wrap;
}
.sponsor-logo {
    max-height: 48px; max-width: 140px; object-fit: contain;
    opacity: 0.8; transition: opacity var(--ease);
}
.sponsor-logo:hover { opacity: 1; }

.dash-bottom {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px;
}

/* ======================================== Settings ======================================== */
.settings-grid {
    display: grid; grid-template-columns: 1fr 350px; gap: 16px;
}

.color-row {
    display: flex; align-items: center; gap: 8px;
}

.color-picker {
    width: 40px; height: 38px; border: 1px solid #D1D5DB;
    border-radius: var(--radius-sm); cursor: pointer; padding: 2px;
    background: white;
}

.color-preview {
    width: 100%; height: 38px; border-radius: var(--radius-sm);
    border: 1px solid #E5E7EB; flex: 1;
}

.upload-preview {
    margin-bottom: 8px; min-height: 40px;
    display: flex; align-items: center; justify-content: center;
}

.upload-img {
    max-width: 200px; max-height: 80px; object-fit: contain;
    border-radius: 8px; border: 1px solid #E5E7EB;
}

.upload-input { font-size: 12px; color: var(--text-dim); }

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

/* ======================================== Utilities ======================================== */
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-secondary { color: var(--text-dim) !important; }
.text-muted { color: var(--text-faint) !important; }
.icon { display: inline-block; vertical-align: middle; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 14px; }
.mt-3 { margin-top: 20px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 14px; }
.gap-2 { gap: 14px; }

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }

/* ======================================== Login ======================================== */
.login-page {
    min-height: 100vh; display: flex;
    align-items: center; justify-content: center;
}

.login-card {
    position: relative; overflow: hidden;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 18px; padding: 40px 32px; width: 380px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.08);
    animation: slideUp .5s cubic-bezier(.4,0,.2,1);
}

.login-card::before { display: none; }

.login-title { text-align: center; margin-bottom: 28px; }
.login-icon { color: var(--primary); }
.login-title h1 { font-size: 22px; margin-bottom: 3px; color: var(--text); }
.login-title p { color: var(--text-dim); font-size: 13px; }

/* ======================================== Blazor Error ======================================== */
#blazor-error-ui {
    background: rgba(185,28,28,0.9); backdrop-filter: blur(8px);
    color: white; padding: 8px 16px; position: fixed;
    bottom: 0; width: 100%; z-index: 9999; display: none;
}
#blazor-error-ui .reload, #blazor-error-ui .dismiss { color: white; margin-left: 8px; }

/* ======================================== Print ======================================== */
@media print {
    .topnav, .mobile-nav { display: none; }
    .main-content { padding: 0; }
    body { background: white; color: black; }
    body::before, body::after { display: none; }
    .card { background: white; border: 1px solid #ddd; backdrop-filter: none; }
}

/* ======================================== Mobile Nav ======================================== */
.mobile-nav {
    display: none; position: fixed; bottom: 0; left: 0; right: 0;
    background: #FFFFFF;
    border-top: 1px solid #E5E7EB;
    z-index: 900; padding: 6px 0;
    padding-bottom: env(safe-area-inset-bottom, 6px);
    justify-content: center; gap: 8px;
    box-shadow: 0 -1px 3px rgba(0,0,0,0.04);
}

.mobile-nav-item {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; gap: 2px; padding: 5px 3px;
    color: var(--text-faint); text-decoration: none;
    font-size: 9px; font-weight: 600;
    background: none; border: none; cursor: pointer;
    transition: color var(--ease); font-family: inherit;
}
.mobile-nav-item:hover, .mobile-nav-item.active { color: var(--primary); }

/* ======================================== Responsive ======================================== */
@media (max-width: 900px) {
    .dash-bottom { grid-template-columns: 1fr; }
    .dash-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 768px) {
    .topnav { display: none; }
    .mobile-nav { display: flex; }

    .main-content { padding: 12px; padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }

    .card { padding: 12px; margin-bottom: 8px; border-radius: 12px; }

    .page-header { margin-bottom: 12px; }
    .page-header h1 { font-size: 18px; margin-bottom: 0; }

    .form-row { flex-direction: column; gap: 0; }
    .form-group { margin-bottom: 8px; }
    .form-control { height: 46px; font-size: 16px; padding: 10px 12px; border-radius: 10px; }

    .btn { padding: 10px 14px; font-size: 13px; border-radius: 10px; min-height: 42px; }
    .btn-sm { padding: 7px 12px; min-height: 36px; }

    .data-table { font-size: 12px; }
    .data-table th { padding: 6px 4px; font-size: 9px; }
    .data-table td { padding: 7px 4px; }

    h1 { font-size: 18px; margin-bottom: 12px; }
    h3 { font-size: 10px; margin-bottom: 8px; }

    .modal-dialog { min-width: auto; width: 94%; padding: 18px; border-radius: 12px; }
    .login-card { width: 94%; min-width: 0; padding: 24px 18px; border-radius: 14px; }

    .weekv-table { min-width: 420px; }
    .weekv-time-header, .weekv-time-label { width: 38px; min-width: 38px; font-size: 10px; padding: 3px 4px; }
    .weekv-day-header { padding: 6px 2px; }
    .weekv-day-name { font-size: 9px; }
    .weekv-day-num { font-size: 13px; }
    .weekv-today-num { width: 24px; height: 24px; font-size: 13px; }
    .weekv-slot { height: 32px; }
    .weekv-block { padding: 2px 3px; }
    .weekv-block .block-time { font-size: 7px; }
    .weekv-block .block-title { font-size: 9px; }
    .weekv-block .block-user { font-size: 8px; }
    .dash-calendar-card { padding: 6px; }
    .calendar-nav { flex-wrap: wrap; gap: 6px; }
    .calendar-month-label { font-size: 13px; }
}

@media (max-width: 380px) {
    .main-content { padding: 8px; }
    .card { padding: 10px; }
    .mobile-nav-item span { font-size: 8px; }
}
