/* ============================================
   GSF-QAPS - Modern UI Stylesheet
   Global Sparks Foundation - Quality Access Program
   Based on Dynasty Manufacturing UI theme
   ============================================ */

/* 1. BASE & RESET */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { overflow-x: hidden; }
body { font-family: 'Inter', sans-serif; background: #f0f2f5; min-height: 100vh; }
header { z-index: 100 !important; }

/* 2. TOPBAR & NAVIGATION */
.topbar {
    background: #1e3a5f; color: white; padding: 0 29px; height: 72px;
    display: flex; align-items: center; justify-content: space-between;
}
.topbar h1 { font-size: 24px; font-weight: 700; display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.topbar-nav { display: flex; gap: 2px; flex-wrap: wrap; }
.topbar-nav a {
    color: white; text-decoration: none; padding: 10px 19px;
    font-size: 19px; font-weight: 500; border-radius: 7px; transition: all 0.15s;
    background: rgba(255,255,255,0.35);
}
.topbar-nav a:hover { background: rgba(255,255,255,0.5); color: white; }
.topbar-nav a.active { background: rgba(255,255,255,0.35); color: white; }

/* 3. CONTAINER & LAYOUT */
.container { padding: 10px 29px; max-width: 100%; }

/* 4. META BAR (Legend + Load) */
.meta-bar {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 14px; margin-bottom: 10px;
}
.legend { display: flex; gap: 29px; font-size: 19px; font-weight: 500; }
.legend span { display: flex; align-items: center; gap: 10px; }
.ldot { width: 17px; height: 17px; border-radius: 4px; display: inline-block; }
.ldot-g { background: #16a34a; }
.ldot-b { background: #2563eb; }
.ldot-r { background: #dc2626; }
.load-group { display: flex; align-items: center; gap: 12px; }
.load-group label { font-size: 22px; font-weight: 700; color: #dc2626; }

/* 5. FORM CONTROLS (outside tables) */
.ctrl-input {
    border: 2px solid #cbd5e1; border-radius: 7px; padding: 7px 10px;
    font-size: 16px; color: #1e293b; outline: none; font-family: 'Inter', sans-serif;
    background: white; max-width: 100%;
}
.ctrl-input:focus { border-color: #1e3a5f; }
.ctrl-select {
    border: 2px solid #cbd5e1; border-radius: 7px; padding: 7px 10px;
    font-size: 16px; color: #1e293b; outline: none; font-family: 'Inter', sans-serif;
    background: white; max-width: 100%;
}

/* 6. FILTER BAR */
.filter-bar {
    background: #e2e8f0; border: 2px solid #cbd5e1; border-radius: 10px;
    padding: 14px 22px; margin-bottom: 14px;
    display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
}
.btn-submit {
    background: #1e3a5f; color: white; border: none; padding: 7px 17px;
    border-radius: 7px; font-size: 16px; font-weight: 600; cursor: pointer;
    font-family: 'Inter', sans-serif;
}
.btn-submit:hover { background: #15304e; }
.result-count {
    background: #1e3a5f; color: white; padding: 5px 12px; border-radius: 7px;
    font-size: 17px; font-weight: 800;
}
.btn-clear-filter {
    color: #64748b; text-decoration: none; font-size: 14px; font-weight: 500;
    padding: 5px 10px; border: 1px solid #cbd5e1; border-radius: 6px;
    background: #fff; white-space: nowrap; transition: all 0.15s;
}
.btn-clear-filter:hover { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.btn-clear-filter i { margin-right: 2px; font-size: 12px; }

/* 7. TABLE CONTAINER */
.table-wrap {
    background: white; border: 2px solid #94a3b8; border-radius: 10px;
}

/* 8. TABLE STYLES */
table { width: 100%; border-collapse: collapse; font-size: 17px; }

/* Header */
.mytable thead th,
.mytable th,
thead th {
    background: #1e3a5f; color: white; padding: 9px 5px;
    font-size: 14px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.3px; text-align: center; white-space: normal;
    border-right: 1px solid rgba(255,255,255,0.2);
    border-bottom: 3px solid #0f2440;
}
thead th:last-child,
.mytable th:last-child { border-right: none; }

/* Sticky headers */
.mytable th { position: sticky; top: 0; z-index: 10; }

/* Compact controls inside table headers */
thead th .ctrl-input,
thead th .ctrl-select {
    font-size: 14px; padding: 4px 5px; border-width: 1px; border-radius: 5px;
}
thead th .btn-submit {
    font-size: 12px; padding: 4px 7px; border-radius: 5px;
}

/* White box around buttons on navy backgrounds */
thead th .btn-submit,
.topbar .btn-submit,
.scanner-bar .btn-submit {
    background: rgba(255,255,255,0.35); color: white;
    border: none;
}
thead th .btn-submit:hover,
.topbar .btn-submit:hover,
.scanner-bar .btn-submit:hover {
    background: rgba(255,255,255,0.5);
}

/* Body rows */
tbody tr {
    border-bottom: 2px solid #cbd5e1;
    transition: background 0.1s;
}
tbody tr td { background-color: #ffffff; }
tbody tr.row-alt td { background-color: #f2f2f2 !important; }
tbody tr:hover td { background-color: #e2e2e2 !important; }

/* Body cells */
tbody td {
    padding: 8px 5px;
    border-right: 1px solid #e2e8f0;
    vertical-align: middle;
    line-height: 1.3;
    text-align: center;
    color: #1e293b;
}
tbody td:last-child { border-right: none; }

/* Alignment helpers */
td.r, th.r { text-align: right; }
td.c, th.c { text-align: center; }
td.l, th.l { text-align: left; }

/* 9. ROW STATUS CLASSES */
tr.row-warning td { color: #dc2626; background-color: #fef3c7 !important; }
tr.row-ready td { color: #16a34a; }
tr.row-yellow td { color: #eab308; }
tr.row-partial td { color: #2563eb; }
tr.row-notready td { color: #dc2626; }
tr.row-blue-bg td { color: white; background-color: #2563eb !important; }
tr.row-green-bg td { color: white; background-color: #16a34a !important; }

/* 10. LINKS */
.link-cell { color: #1e40af; text-decoration: underline; font-weight: 700; font-size: 17px; cursor: pointer; }
.link-cell:hover { color: #1e3a8a; }
a { color: #1e40af; text-decoration: underline; font-weight: 600; }
a:hover { color: #1e3a8a; }

/* 11. TYPOGRAPHY UTILITIES */
.mono { font-family: 'JetBrains Mono', 'Consolas', monospace; }
.fw600 { font-weight: 600; }
.fw700 { font-weight: 700; }

.c-green { color: #16a34a; font-weight: 700; font-size: 17px; }
.c-blue { color: #2563eb; font-weight: 700; font-size: 17px; }
.c-red { color: #dc2626; font-weight: 700; font-size: 17px; }

.big-num { font-size: 19px; font-weight: 800; }
.med-num { font-size: 17px; font-weight: 700; }

/* 12. MINI CONTROLS (inline in tables) */
.mini-sel {
    border: 1px solid #94a3b8; border-radius: 5px; padding: 1px 4px;
    font-size: 14px; color: #475569; background: white;
    font-family: 'Inter', sans-serif;
}
.chk { width: 20px; height: 20px; accent-color: #1e3a5f; cursor: pointer; }

/* 13. STATUS BADGES */
.status-badge {
    display: inline-block; padding: 5px 19px; border-radius: 5px;
    font-size: 20px; font-weight: 700; letter-spacing: 0.6px;
}
.badge-p { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.badge-g { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.badge-r { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* 14. SCANNER / LOGO HEADER */
.scanner-bar {
    background: #1e3a5f; color: white; padding: 14px 29px;
    display: flex; align-items: center; gap: 24px;
}
.scanner-bar img { border-radius: 7px; }
.scanner-bar label { font-size: 22px; font-weight: 700; color: white; }
.scanner-bar input {
    border: 2px solid rgba(255,255,255,0.3); border-radius: 7px; padding: 10px 17px;
    font-size: 19px; color: #1e293b; outline: none; font-family: 'Inter', sans-serif;
    background: white;
}
.scanner-bar input:focus { border-color: rgba(255,255,255,0.8); }

/* 15. TOPBAR - direct links */
.topbar > a {
    color: white; text-decoration: none; padding: 10px 19px;
    font-size: 19px; font-weight: 500; border-radius: 7px;
    background: rgba(255,255,255,0.35); transition: all 0.15s;
}
.topbar > a:hover { background: rgba(255,255,255,0.5); color: white; }

/* 16. STYLE IMAGE DISPLAY */
.style-display {
    padding: 19px 29px;
    display: flex; align-items: flex-start; gap: 29px; flex-wrap: wrap;
}
.style-display img { border-radius: 10px; border: 2px solid #cbd5e1; }
.style-info { font-size: 22px; font-weight: 600; color: #1e293b; }

/* 17. GREEN HIGHLIGHT HEADERS */
th.highlight-green { background-color: #16a34a !important; }

/* 18. CHECK MARK */
.check-success { color: #16a34a; font-size: 58px; }

/* 19. PRIORITY DROPDOWN */
.priority-sel {
    border: 1px solid #cbd5e1; border-radius: 5px; padding: 1px 4px;
    font-size: 14px; color: #1e293b; background: white;
    font-family: 'Inter', sans-serif;
}

/* 20. YELLOW BADGE */
.badge-y { background: #fef3c7; color: #92400e; border: 1px solid #fbbf24; }

/* 21. KPI CARDS */
.kpi-row { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.kpi-card { background: white; border: 2px solid #94a3b8; border-radius: 10px;
            padding: 20px; flex: 1; min-width: 180px; text-align: center; }
.kpi-label { color: #64748b; font-size: 13px; text-transform: uppercase; font-weight: 600; }
.kpi-value { color: #1e3a5f; font-size: 32px; font-weight: 800; margin-top: 5px; }

/* 22. SORTABLE COLUMNS */
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { background: #15304e; }
th.sort-asc::after  { content: ' \25B2'; font-size: 10px; }
th.sort-desc::after { content: ' \25BC'; font-size: 10px; }

/* 23. SUMMARY BAR */
.summary-bar { background: white; border: 2px solid #94a3b8; border-radius: 10px;
               padding: 10px 20px; margin-bottom: 14px;
               display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }

/* ============================================
   RESPONSIVE - TABLETS (max-width: 1024px)
   ============================================ */
@media (max-width: 1024px) {
    .topbar {
        flex-direction: column; height: auto; padding: 12px 14px; gap: 7px;
    }
    .topbar h1 { font-size: 19px; }
    .topbar-nav { flex-wrap: wrap; gap: 2px; justify-content: center; }
    .topbar-nav a { padding: 5px 10px; font-size: 16px; }

    .container { padding: 6px 6px; }

    .meta-bar { flex-direction: column; align-items: flex-start; gap: 7px; }
    .legend { flex-wrap: wrap; gap: 12px; font-size: 16px; }
    .load-group label { font-size: 17px; }

    .ctrl-input, .ctrl-select { padding: 5px 7px; font-size: 14px; }
    .btn-submit { padding: 6px 12px; font-size: 14px; }

    table { font-size: 15px; }
    .mytable thead th, .mytable th, thead th {
        padding: 6px 4px; font-size: 12px;
    }
    tbody td { padding: 6px 4px; }

    thead th .ctrl-input, thead th .ctrl-select { font-size: 12px; padding: 3px 4px; }
    thead th .btn-submit { font-size: 11px; padding: 3px 5px; }

    .big-num { font-size: 16px; }
    .med-num { font-size: 15px; }
    .link-cell { font-size: 15px; }
    .result-count { font-size: 16px; padding: 5px 12px; }

    .mini-sel { font-size: 12px; padding: 1px 3px; }
    .chk { width: 17px; height: 17px; }

    .scanner-bar { flex-wrap: wrap; padding: 10px 14px; gap: 10px; }
    .scanner-bar label { font-size: 17px; }
    .scanner-bar input { font-size: 14px; padding: 5px 10px; }

    .style-display { padding: 10px 14px; gap: 14px; }
    .style-display img { max-width: 100%; height: auto; }

    .kpi-value { font-size: 26px; }
    .kpi-card { padding: 14px; min-width: 140px; }
}

/* ============================================
   RESPONSIVE - PHONES (max-width: 640px)
   ============================================ */
@media (max-width: 640px) {
    .topbar { padding: 10px 10px; gap: 5px; }
    .topbar h1 { font-size: 17px; gap: 5px; }
    .topbar-nav a { padding: 4px 7px; font-size: 13px; }

    .container { padding: 4px 4px; }

    .meta-bar { margin-bottom: 5px; gap: 5px; }
    .legend { font-size: 13px; gap: 7px; }
    .load-group { gap: 5px; }
    .load-group label { font-size: 14px; }

    .ctrl-input, .ctrl-select { padding: 4px 5px; font-size: 13px; }
    .btn-submit { padding: 5px 10px; font-size: 13px; }

    table { font-size: 12px; }
    .mytable thead th, .mytable th, thead th {
        padding: 5px 2px; font-size: 10px;
    }
    tbody td { padding: 5px 2px; }

    thead th .ctrl-input, thead th .ctrl-select { font-size: 10px; padding: 2px 3px; }
    thead th .btn-submit { font-size: 10px; padding: 2px 4px; }

    .big-num { font-size: 14px; }
    .med-num { font-size: 12px; }
    .link-cell { font-size: 12px; }
    .result-count { font-size: 12px; padding: 4px 7px; }

    .mini-sel { font-size: 10px; padding: 1px 2px; }
    .chk { width: 15px; height: 15px; }
    .priority-sel { font-size: 10px; padding: 1px 2px; }

    .scanner-bar { padding: 7px 10px; gap: 7px; }
    .scanner-bar label { font-size: 13px; }
    .scanner-bar input { font-size: 13px; padding: 4px 7px; }

    .table-wrap { border-radius: 5px; border-width: 1px; }

    .style-display { padding: 5px 7px; gap: 7px; }

    .kpi-value { font-size: 22px; }
    .kpi-card { padding: 10px; min-width: 120px; }
    .summary-bar { padding: 8px 12px; gap: 10px; font-size: 13px; }
}
