/* ═══════════════════════════════════════════════════════════════════════════
   Flugzeug-Reservierungssystem – CS Aviation Theme
   Hell, blau/weiß, roter Akzent
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;600;700;900&display=swap');

:root {
    --res-blue:        #0B4C8F;
    --res-blue-mid:    #2251a3;
    --res-blue-light:  #e8eef8;
    --res-red:         #c8234a;
    --res-red-light:   rgba(200,35,74,0.10);
    --res-bg:          #f0f3f8;
    --res-card:        #ffffff;
    --res-border:      #d4dce8;
    --res-surface:     #f5f7fb;
    --res-text:        #1a2535;
    --res-text-dim:    #5a6a80;
    --res-text-muted:  #9aaabb;
    --res-green:       #1e8c45;
    --res-green-light: rgba(30,140,69,0.10);
    --res-heute-bg:    rgba(26,61,124,0.07);
    --res-radius:      10px;
    --res-font:        'Lato', sans-serif;
    --res-shadow:      0 2px 12px rgba(26,61,124,0.10);
    --res-transition:  0.18s cubic-bezier(.4,0,.2,1);
}

#res-root {
    font-family: var(--res-font);
    color: var(--res-text);
    background: transparent;
    padding: 0;
    max-width: 1060px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.res-card {
    background: var(--res-card);
    border: 1px solid var(--res-border);
    border-radius: var(--res-radius);
    box-shadow: var(--res-shadow);
    overflow: hidden;
}

/* ─── Kalender-Header ─────────────────────────────────────────────────────── */

.res-kalender-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 2px solid var(--res-blue);
    background: var(--res-blue);
    flex-wrap: wrap;
}

.res-kalender-header #res-woche-label {
    flex: 1;
    text-align: center;
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #fff;
}

.res-nav-btn {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 5px;
    padding: 5px 13px;
    font-family: var(--res-font);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--res-transition);
    line-height: 1.4;
}
.res-nav-btn:hover { background: rgba(255,255,255,0.28); border-color: rgba(255,255,255,0.6); }
.res-heute-btn {
    margin-left: auto;
    font-size: 0.76rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: var(--res-red);
    border-color: var(--res-red);
}
.res-heute-btn:hover { background: #e02a55; border-color: #e02a55; }

/* ─── Kalender-Grid ───────────────────────────────────────────────────────── */

.res-kalender-grid { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.res-kal-header-row {
    display: flex;
    border-bottom: 1px solid var(--res-border);
    background: var(--res-blue-light);
    position: sticky;
    top: 0;
    z-index: 5;
}

.res-kal-time-gutter { min-width: 42px; width: 42px; flex-shrink: 0; border-right: 1px solid var(--res-border); }

.res-kal-col-head {
    flex: 1;
    min-width: 76px;
    padding: 7px 4px;
    text-align: center;
    border-right: 1px solid var(--res-border);
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.res-kal-col-head:last-child { border-right: none; }
.res-kal-col-head.res-heute { background: var(--res-heute-bg); }

.res-kal-day-short { font-size: 0.68rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.07em; color: var(--res-blue-mid); }
.res-kal-day-num   { font-size: 0.82rem; font-weight: 700; color: var(--res-text); }
.res-kal-col-head.res-heute .res-kal-day-short,
.res-kal-col-head.res-heute .res-kal-day-num { color: var(--res-red); }

.res-kal-body { display: flex; position: relative; }

.res-kal-time-gutter-col {
    min-width: 42px; width: 42px; flex-shrink: 0;
    position: relative;
    border-right: 1px solid var(--res-border);
    background: var(--res-surface);
}

.res-kal-time-label {
    position: absolute; left: 0; right: 0;
    text-align: right; padding-right: 5px;
    font-size: 0.60rem; font-weight: 600;
    color: var(--res-text-muted);
    transform: translateY(-50%);
    user-select: none; pointer-events: none;
}

.res-kal-col {
    flex: 1; min-width: 76px;
    position: relative;
    border-right: 1px solid var(--res-border);
    background: #fff;
}
.res-kal-col:last-child { border-right: none; }
.res-kal-col.res-heute-col { background: var(--res-heute-bg); }

.res-kal-grid-line {
    position: absolute; left: 0; right: 0;
    height: 1px; background: var(--res-border); opacity: 0.5;
    pointer-events: none;
}

/* ─── Buchungs-Blöcke ─────────────────────────────────────────────────────── */

.res-buchung {
    position: absolute;
    border-radius: 4px;
    padding: 3px 5px;
    box-sizing: border-box;
    overflow: visible;
    cursor: pointer;
    z-index: 2;
    transition: filter var(--res-transition), box-shadow var(--res-transition);
}
.res-buchung:hover,
.res-buchung:focus {
    filter: brightness(1.08);
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    z-index: 20;
    outline: none;
}
.res-buchung:hover .res-tooltip,
.res-buchung:focus .res-tooltip {
    display: block;
    animation: resFadeIn 0.15s ease;
}

@keyframes resFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.res-b-pilot {
    font-size: 0.68rem; font-weight: 700;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    color: rgba(255,255,255,0.96);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    line-height: 1.3;
}
.res-b-time {
    font-size: 0.60rem; font-weight: 600;
    color: rgba(255,255,255,0.82); white-space: nowrap; line-height: 1.3;
}

/* ─── Tooltip-Popup ───────────────────────────────────────────────────────── */

.res-tooltip {
    position: fixed;
    min-width: 220px;
    max-width: 270px;
    background: #fff;
    border: 1px solid var(--res-border);
    border-top: 3px solid var(--res-blue);
    border-radius: 8px;
    z-index: 99999;
    box-shadow: 0 8px 28px rgba(26,61,124,0.18);
    pointer-events: none;
    white-space: normal;
    word-break: break-word;
    overflow: hidden;
    animation: resFadeIn 0.15s ease;
}

.res-tip-header {
    background: var(--res-blue);
    color: #fff;
    padding: 8px 12px;
    font-size: 0.82rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}
.res-tip-body {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.res-tip-row { display: flex; gap: 6px; font-size: 0.77rem; line-height: 1.4; }
.res-tip-label {
    color: var(--res-text-muted);
    font-weight: 700;
    min-width: 72px;
    text-transform: uppercase;
    font-size: 0.66rem;
    letter-spacing: 0.04em;
    padding-top: 1px;
    flex-shrink: 0;
}
.res-tip-val { color: var(--res-text); font-weight: 600; }
.res-tip-divider { height: 1px; background: var(--res-border); margin: 2px 0; }
.res-tip-desc-row {
    font-size: 0.74rem; color: var(--res-text-dim);
    font-style: italic; line-height: 1.4;
}

/* ─── Formular ────────────────────────────────────────────────────────────── */

#res-formular-wrapper { padding: 22px 24px 20px; }

.res-form-title {
    font-size: 1.05rem; font-weight: 900;
    letter-spacing: 0.04em; text-transform: uppercase;
    color: var(--res-blue);
    margin: 0 0 18px; padding-bottom: 10px;
    border-bottom: 2px solid var(--res-blue-light);
    display: flex; align-items: center; gap: 8px;
}
.res-form-title::before { content: '✈'; font-size: 1.1rem; }

.res-form-row {
    display: flex; align-items: center; gap: 16px;
    padding: 9px 0; border-bottom: 1px solid var(--res-blue-light);
}
.res-form-row:last-child { border-bottom: none; }

.res-form-row label {
    min-width: 190px; max-width: 190px;
    font-size: 0.80rem; font-weight: 700;
    letter-spacing: 0.02em; color: var(--res-text-dim);
    text-transform: uppercase;
}
.req { color: var(--res-red); margin-left: 2px; }

.res-form-row select,
.res-form-row input[type="datetime-local"],
.res-form-row textarea {
    flex: 1;
    background: var(--res-surface);
    border: 1.5px solid var(--res-border);
    border-radius: 6px;
    color: var(--res-text);
    font-family: var(--res-font);
    font-size: 0.87rem;
    padding: 7px 11px;
    appearance: none; -webkit-appearance: none;
    transition: border-color var(--res-transition), box-shadow var(--res-transition);
    outline: none; width: 100%; box-sizing: border-box;
}
.res-form-row select:focus,
.res-form-row input[type="datetime-local"]:focus,
.res-form-row textarea:focus {
    border-color: var(--res-blue-mid);
    box-shadow: 0 0 0 3px rgba(34,81,163,0.12);
    background: #fff;
}
.res-form-row textarea { resize: vertical; min-height: 68px; line-height: 1.5; align-self: flex-start; margin-top: 4px; }

.res-form-submit { padding-top: 16px; border-bottom: none; justify-content: flex-end; }

#res-submit-btn {
    background: var(--res-blue); color: #fff; border: none;
    border-radius: 7px; padding: 11px 30px;
    font-family: var(--res-font); font-size: 0.88rem; font-weight: 900;
    letter-spacing: 0.06em; text-transform: uppercase;
    cursor: pointer; transition: all var(--res-transition);
    box-shadow: 0 3px 12px rgba(26,61,124,0.25);
}
#res-submit-btn:hover { background: var(--res-blue-mid); transform: translateY(-1px); box-shadow: 0 5px 18px rgba(26,61,124,0.35); }
#res-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ─── Meldungen ───────────────────────────────────────────────────────────── */

.res-meldung { padding: 11px 15px; border-radius: 6px; font-size: 0.85rem; font-weight: 700; margin-bottom: 14px; border-left: 4px solid; }
.res-meldung-success { background: var(--res-green-light); border-color: var(--res-green); color: var(--res-green); }
.res-meldung-error   { background: var(--res-red-light);   border-color: var(--res-red);   color: var(--res-red); }

/* ─── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 680px) {
    #res-root { gap: 14px; }
    .res-kalender-header { padding: 10px 12px; gap: 8px; }
    .res-kalender-header #res-woche-label { font-size: 0.76rem; }
    .res-nav-btn { padding: 4px 10px; font-size: 0.76rem; }
    .res-kal-time-gutter, .res-kal-time-gutter-col { min-width: 30px; width: 30px; }
    .res-kal-time-label { font-size: 0.55rem; padding-right: 3px; }
    .res-kal-col, .res-kal-col-head { min-width: 46px; }
    .res-kal-day-short { font-size: 0.60rem; }
    .res-kal-day-num   { font-size: 0.72rem; }
    .res-b-pilot { font-size: 0.60rem; }
    .res-b-time  { font-size: 0.54rem; }
    .res-tooltip { left: auto; right: calc(100% + 8px); min-width: 180px; }
    #res-formular-wrapper { padding: 14px 12px; }
    .res-form-row { flex-direction: column; align-items: flex-start; gap: 5px; }
    .res-form-row label { min-width: unset; max-width: unset; }
    .res-form-submit { justify-content: stretch; }
    #res-submit-btn { width: 100%; }
}

/* ─── Login-Hinweis ───────────────────────────────────────────────────────── */

.res-login-hinweis {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 24px;
    color: var(--res-text-dim);
    font-size: 0.92rem;
}
.res-login-icon { font-size: 1.4rem; }
.res-login-hinweis a {
    color: var(--res-blue);
    font-weight: 700;
    text-decoration: underline;
}
.res-login-hinweis a:hover { color: var(--res-red); }

/* ─── Grüner "Neue Reservierung" Button ───────────────────────────────────── */

.res-neu-btn {
    background: #1e8c45 !important;
    border-color: #1e8c45 !important;
    color: #fff !important;
    font-weight: 900 !important;
    letter-spacing: 0.04em;
    box-shadow: 0 2px 8px rgba(30,140,69,0.30);
    transition: background var(--res-transition), box-shadow var(--res-transition), transform var(--res-transition) !important;
}
.res-neu-btn:hover {
    background: #22a050 !important;
    border-color: #22a050 !important;
    box-shadow: 0 4px 14px rgba(30,140,69,0.45) !important;
    transform: translateY(-1px);
}

/* ─── Overlay ─────────────────────────────────────────────────────────────── */

.res-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,20,40,0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.res-modal {
    width: 100%;
    max-width: 580px;
    max-height: 92vh;
    overflow-y: auto;
    border-radius: var(--res-radius);
    box-shadow: 0 16px 48px rgba(10,20,40,0.35);
    animation: resModalIn 0.22s cubic-bezier(.4,0,.2,1);
}

@keyframes resModalIn {
    from { opacity: 0; transform: translateY(18px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* ─── Modal-Header ────────────────────────────────────────────────────────── */

.res-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 0;
}

.res-modal-header .res-form-title {
    margin: 0;
    padding-bottom: 0;
    border-bottom: none;
    font-size: 1rem;
}

.res-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--res-text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 5px;
    transition: background var(--res-transition), color var(--res-transition);
}
.res-modal-close:hover {
    background: var(--res-red-light);
    color: var(--res-red);
}

/* Body-Lock verhindert Scrollen im Hintergrund */
.res-body-lock { overflow: hidden; }

/* Formular innerhalb Modal etwas kompakter */
.res-modal #res-formular-wrapper,
.res-modal.res-card {
    padding: 0;
}
.res-modal #res-meldung { margin: 0 22px 0; }
.res-modal .res-form-row { padding: 8px 22px; }
.res-modal .res-form-row:last-child { padding-bottom: 20px; }

@media (max-width: 600px) {
    .res-modal { max-height: 96vh; }
    .res-modal .res-form-row { padding: 7px 14px; flex-direction: column; align-items: flex-start; gap: 4px; }
    .res-modal .res-form-row label { min-width: unset; max-width: unset; }
    .res-modal .res-form-submit { justify-content: stretch; }
    .res-modal #res-submit-btn { width: 100%; }
    .res-modal-header { padding: 14px 14px 0; }
}

/* ─── Edit-Modal Aktionen ─────────────────────────────────────────────────── */

.res-edit-actions {
    justify-content: space-between !important;
    gap: 10px;
}

.res-btn-danger {
    background: transparent;
    color: var(--res-red);
    border: 1.5px solid var(--res-red);
    border-radius: 7px;
    padding: 10px 20px;
    font-family: var(--res-font);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--res-transition);
}
.res-btn-danger:hover {
    background: var(--res-red);
    color: #fff;
}

/* Buchungsblöcke mit Bearbeitungsrecht leicht hervorheben */
.res-buchung[title] {
    box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.35);
}