/* static/css/style.css */

/* Define missing CSS variables used by templates */
:root {
    --border-main: var(--border-subtle, #e5e7eb);
    --filter-label-offset: 23px;  /* Label height (~18px) + margin (~5px) for filter button alignment */
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    background: #f4f4f4;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #222;
    color: #fff;
    padding: 10px 20px;
}

.topbar .menu a {
    color: #fff;
    margin-left: 15px;
    text-decoration: none;
    font-size: 14px;
}

.topbar .menu a:hover {
    text-decoration: underline;
}

.content {
    padding: 20px;
}

/* Datalist dropdown styling - show max 10 items with scroll */
input[list]::-webkit-calendar-picker-indicator {
    display: none !important;
}
input[list] {
    width: 100%;
}
/* Browser-native datalist shows ~10 items by default; no additional CSS needed for scroll */

/* =====================================================
   GLOBAL SHARED UI CLASSES
   Per UI_UX_STANDARDS.md — DO NOT DUPLICATE IN TEMPLATES
   ===================================================== */

/* Form field styling - consistent borders for input/select/textarea */
.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 12px;
    border: 2px solid var(--border-subtle, #e5e7eb);
    border-radius: 6px;
    font-size: 14px;
    width: 100%;
    background: #ffffff;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent, #2563eb);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

/* Button base */
.btn {
    padding: 10px 18px;
    background: #2563eb;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    display: inline-block;
    transition: background 0.2s;
}
.btn:hover {
    background: #1d4ed8;
}

/* Button variants */
.btn-primary {
    background: #2563eb;
}
.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #6b7280;
}
.btn-secondary:hover {
    background: #4b5563;
}

.btn-danger {
    background: #dc2626;
}
.btn-danger:hover {
    background: #b91c1c;
}

.btn-success {
    background: #10b981;
    color: white;
}
.btn-success:hover {
    background: #059669;
}

.btn-warning {
    background: #f59e0b;
    color: #000;
}
.btn-warning:hover {
    background: #d97706;
}

/* Small button */
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Action buttons container (for row actions) */
.action-buttons {
    display: flex;
    gap: 4px;
    justify-content: center;
}

/* Table scroll wrapper */
.table-scroll-wrapper {
    overflow-x: auto;
}

/* Data table base */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
    border-bottom: 2px solid var(--border-subtle, #e5e7eb);
    background: #f9fafb;
}
.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle, #e5e7eb);
}
.data-table tbody tr:hover {
    background: var(--accent-soft, #f8fafc);
}

/* Read-only view field borders (Phase: UI consistency) */
.view-card .detail-item,
.form-card .info-item,
.card .detail-row .detail-item {
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle, #e1e4ea);
}

.view-card .detail-item:last-child,
.form-card .info-item:last-child {
    border-bottom: none;
}

/* Read-only dividers for .info-grid containers */
.info-grid .info-item {
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle, #e1e4ea);
}

.info-grid .info-item:last-child {
    border-bottom: none;
}

/* Form field dividers (between form groups in grid) - only on narrow/stacked layouts */
@media (max-width: 768px) {
    .form-card .form-grid .form-group + .form-group {
        border-top: 1px solid var(--border-subtle, #e1e4ea);
        padding-top: 12px;
        margin-top: 12px;
    }
}

/* Filter form dividers (between form groups) - only on narrow/stacked layouts */
@media (max-width: 768px) {
    .filter-card .filter-form .form-group + .form-group {
        border-top: 1px solid var(--border-subtle, #e1e4ea);
        padding-top: 12px;
        margin-top: 12px;
    }
}

/* HCL form dividers - only on narrow/stacked layouts */
@media (max-width: 768px) {
    .hcl-form-card .hcl-form-grid .form-group + .form-group {
        border-top: 1px solid var(--border-subtle, #e1e4ea);
        padding-top: 12px;
        margin-top: 12px;
    }
}

/* SOPEP view dividers - only on narrow/stacked layouts */
@media (max-width: 768px) {
    .form-card .view-grid .view-group + .view-group {
        border-top: 1px solid var(--border-subtle, #e1e4ea);
        padding-top: 12px;
        margin-top: 12px;
    }
}

/* Crew certificates view dividers - only on narrow/stacked layouts */
@media (max-width: 768px) {
    .cert-view-card .crew-info-grid .crew-info-item + .crew-info-item {
        border-top: 1px solid var(--border-subtle, #e1e4ea);
        padding-top: 12px;
        margin-top: 12px;
    }
}

/* Filter form action buttons - remove separator line from filter contexts */
.filter-form .form-actions {
    border-top: none;
    padding-top: var(--filter-label-offset);
    margin-top: 0;
    align-self: end;
    grid-column: 1 / -1;
    flex-wrap: wrap;
}

/* Searchable dropdown — global canonical rules */
.searchable-dropdown {
    position: relative;
    width: 100%;
    --dropdown-max-rows: 10;
    --dropdown-row-height: 32px;
}
.searchable-dropdown .dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: calc(var(--dropdown-max-rows) * var(--dropdown-row-height));
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.searchable-dropdown .dropdown-list.show {
    display: block;
}
.searchable-dropdown .dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
}
.searchable-dropdown .dropdown-item:hover,
.searchable-dropdown .dropdown-item.active {
    background: #eff6ff;
}
.searchable-dropdown .dropdown-item.selected {
    background: #2563eb;
    color: white;
}