/* =========================================================
   NOTAM Display — Unified CSS (Cleaned & Centralized Buttons)
   ========================================================= */

/* === COLOR & STYLE VARIABLES === */
:root {
    /* NOTAM status colors */
    --color-inactive: #ddd;
    --color-expiring-8h: #fa0202;
    --color-expiring-24h: #ff5f15;
    --color-expiring-72h: #ffff00;
    --color-expiring-72h-plus: #90ee90;

    /* Heading color */
    --heading-color: #0755A1;

    /* Text colors */
    --text-dark: #111;
    --text-light: #000;

    /* Label and ID colors */
    --label-active-color: #111;
    --label-inactive-color: #111;
    --id-hint-color: #999;

    /* === BUTTON COLORS === */
    /* Terms Toggle Button */
    --terms-toggle-bg: #0073aa;       /* Toggle terms button background */
    --terms-toggle-hover-bg: #005f8a; /* Toggle terms button hover */
    --terms-toggle-text: #fff;        /* Toggle terms button text */

    /* Modal Buttons (Save/Submit & Cancel) */
    --modal-save-bg: #0073aa;         /* Modal save/submit button background */
    --modal-save-hover-bg: #005f8a;   /* Modal save/submit hover */
    --modal-cancel-bg: #ccc;          /* Modal cancel button background */
    --modal-cancel-hover-bg: #bbb;    /* Modal cancel button hover */
    --modal-button-text: #fff;        /* Text color for modal buttons */

    /* === PANELS & MODAL === */
    --terms-bg: #f9f9f9;              /* Background for terms-of-use panel */
    --terms-border: #ccc;             /* Border color for terms panel */

    --modal-bg: #fff;                 /* Modal content background */
    --modal-overlay-bg: #00000080;   /* Modal overlay (50% black) */
    --modal-shadow: #0000004D;       /* Shadow for modal content */

    /* Border and shadow tones */
    --border-color-default: #0000001A;
    --border-color-light: #0000000D;
    --border-color-medium: #00000033;

    --shadow-small: 0 2px 4px #0000001A;
    --shadow-medium: 0 4px 10px #00000033;

    /* Typography */
    --font-family-base: system-ui, sans-serif;
    --font-size-header: 1rem;
    --font-size-base: 0.9rem;
    --font-size-footer: 0.85rem;

    /* Scrollbars */
    --scrollbar-thumb: #00000033;
    --scrollbar-thumb-hover: #00000066;

    /* Layout spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 16px;
    --spacing-xl: 20px;
    --spacing-checkbox-label: 6px;
}

/* =========================================================
   ICAO Checkboxes
   ========================================================= */
.icao-checkbox + label {
  margin-left: var(--spacing-checkbox-label);
}

/* =========================================================
   NOTAM STATE COLORS
   ========================================================= */
.notam-item.notam-inactive          { background-color: var(--color-inactive); }
.notam-item.notam-expiring-8h       { background-color: var(--color-expiring-8h); }
.notam-item.notam-expiring-24h      { background-color: var(--color-expiring-24h); }
.notam-item.notam-expiring-72h      { background-color: var(--color-expiring-72h); }
.notam-item.notam-expiring-72h-plus { background-color: var(--color-expiring-72h-plus); }

/* Text color overrides */
.notam-item.text-dark  { color: var(--text-dark); }
.notam-item.text-light { color: var(--text-light); }

/* Active/Inactive labels */
.label-active   { color: var(--label-active-color); font-weight: bold; }
.label-inactive { color: var(--label-inactive-color); font-weight: bold; }

/* Debug ID */
.notam-id-hint { font-size: 10px; color: var(--id-hint-color); margin-top: var(--spacing-xs); }

/* =========================================================
   GRID & CARD STRUCTURE
   ========================================================= */
.notam-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-sm);
    align-items: stretch;
}

@media (max-width: 1000px) {
    .notam-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--spacing-md); }
}

@media (max-width: 600px) {
    .notam-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--spacing-sm); }
}

@media (max-width: 400px) {
    .notam-grid { grid-template-columns: 1fr; gap: var(--spacing-xs); }
}

/* === NOTAM Card === */
.notam-item {
    border: 1px solid var(--border-color-default);
    border-radius: 12px;
    box-shadow: var(--shadow-small);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-height: 400px;
    overflow: hidden;
    background: inherit;
    font-family: var(--font-family-base);
    color: var(--text-dark);
}

.notam-item:hover { transform: translateY(-4px); box-shadow: var(--shadow-medium); }

/* Header */
.notam-item-header {
    padding: var(--spacing-md);
    font-size: var(--font-size-header);
    font-weight: bold;
    border-bottom: 1px solid var(--border-color-medium);
    color: inherit;
}

/* Content */
.notam-item-content {
    flex: 1;
    overflow-y: auto;
    margin: 0;
    padding: var(--spacing-sm) var(--spacing-md);
    line-height: 1.4;
    color: inherit;
    background: inherit;
}

.notam-item-content::after {
    content: "";
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(to bottom, transparent, inherit);
    pointer-events: none;
}

/* Scrollbars */
.notam-item-content::-webkit-scrollbar { width: 6px; }
.notam-item-content::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 6px; }
.notam-item-content::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

/* Paragraphs */
.notam-item-content p { font-size: var(--font-size-base); margin: 6px 0; }

/* Footer */
.notam-item-footer {
    display: block;
    padding: var(--spacing-sm) var(--spacing-md);
    border-top: 1px solid var(--border-color-medium);
    font-size: var(--font-size-footer);
    color: inherit;
}

/* Checkbox */
.notam-item-checkbox {
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--border-color-light);
    display: block;
}
.notam-item-checkbox.hidden { display: none; }

/* =========================================================
   INTRODUCTION & LEGEND
   ========================================================= */
.notam-intro { margin-bottom: var(--spacing-xl); font-family: var(--font-family-base); }

/* Headings inside .notam-intro */
.notam-intro h1, .notam-intro h2, .notam-intro h3,
.notam-intro h4, .notam-intro h5, .notam-intro h6 {
    color: var(--heading-color);
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

/* Paragraphs inside .notam-intro */
.notam-intro p { margin-bottom: var(--spacing-lg); font-size: var(--font-size-base); line-height: 1.5; color: var(--text-dark); }

/* Legend container */
.notam-legend {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm) var(--spacing-lg);
    font-size: var(--font-size-base);
}

/* Each legend item */
.notam-legend li { display: flex; align-items: center; gap: var(--spacing-xs); }

/* Colored boxes */
.legend-box {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 1px solid var(--border-color-medium);
    border-radius: 4px;
    box-shadow: var(--shadow-small);
}
.legend-box.notam-inactive          { background: var(--color-inactive); }
.legend-box.notam-expiring-8h       { background: var(--color-expiring-8h); }
.legend-box.notam-expiring-24h      { background: var(--color-expiring-24h); }
.legend-box.notam-expiring-72h      { background: var(--color-expiring-72h); }
.legend-box.notam-expiring-72h-plus { background: var(--color-expiring-72h-plus); }

/* =========================================================
   TERMS PANEL & BUTTON
   ========================================================= */
#toggle-terms {
    display: block;
    margin-bottom: var(--spacing-md);
    background-color: var(--terms-toggle-bg) !important;  /* Toggle terms button background */
    color: var(--terms-toggle-text) !important;           /* Toggle terms button text */
    border: none;
    padding: 10px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-family-base);
    transition: background 0.2s ease;
}
#toggle-terms:hover { background-color: var(--terms-toggle-hover-bg) !important; }

#terms-of-use {
    display: none;
    border: 1px solid var(--terms-border);
    background-color: var(--terms-bg);
    padding: var(--spacing-lg);
    margin: var(--spacing-lg) 0;
    border-radius: 8px;
    line-height: 1.6;
    font-family: var(--font-family-base);
}

/* =========================================================
   MODAL (Hidden by Default) & BUTTONS
   ========================================================= */
#tracking-modal {
    display: none;
    position: fixed;
    inset: 0;
    background-color: var(--modal-overlay-bg);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
#tracking-modal.active { display: flex; }

#tracking-modal .modal-content {
    background-color: var(--modal-bg);
    padding: var(--spacing-lg);
    border-radius: 8px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 5px 15px var(--modal-shadow);
}

#tracking-modal .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
}

#tracking-modal button {
    padding: 6px 12px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-family: var(--font-family-base);
}

/* Modal Cancel button */
#cancel-tracking {
    background-color: var(--modal-cancel-bg) !important;     /* Cancel button background */
    color: var(--text-dark) !important;
}
#cancel-tracking:hover {
    background-color: var(--modal-cancel-hover-bg) !important;
}

/* Modal Save/Submit button */
#tracking-modal button[type="submit"] {
    background-color: var(--modal-save-bg) !important;       /* Save/Submit button background */
    color: var(--modal-button-text) !important;
}
#tracking-modal button[type="submit"]:hover {
    background-color: var(--modal-save-hover-bg) !important;
}

/* =========================================================
   Global Header Settings <h3>
   ========================================================= */
h3 { color: var(--heading-color) !important; }
