/*
    Auto Tracker Master Stylesheet.
    Imports modular sub-stylesheets for Dashboard, Process, PDF Process, and Summary pages.
    This file is loaded by main.js (which injects it via <link>) and also directly by HTML pages.
*/

@import "dashboard.css";
@import "process.css";
@import "pdf-process.css";
@import "summary.css";

/* ======================================================
   BASE RESETS & DESIGN TOKENS
   ====================================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", Arial, sans-serif;
    margin: 0;
    min-height: 100vh;
    background: #f4f7fb;
    color: #172033;
}

/* ======================================================
   PAGE TYPES
   ====================================================== */
body.content-page {
    display: block !important;
    height: 100% !important;
    min-height: 100vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
    padding: 18px !important;
    background: #f4f7fb;
}

body.shell-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

body.shell-page company-navbar {
    flex: 0 0 auto;
}

body.shell-page .app-shell {
    flex: 1 1 auto;
    min-height: 0;
    padding: 64px 0 56px;
    box-sizing: border-box;
}

/* ======================================================
   APP SHELL (iframe wrapper)
   ====================================================== */
.app-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #f4f7fb;
}

.app-footer {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    min-height: 52px;
    padding: 8px 20px;
    background: #101828;
    color: #ffffff;
    font-size: 13px;
    line-height: 1.4;
    text-align: center;
    box-shadow: 0 -4px 16px rgba(16, 24, 40, 0.18);
}

/* ======================================================
   CONTAINER
   ====================================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    width: 100%;
}

/* ======================================================
   VISIBILITY UTILITIES
   ====================================================== */
[hidden] {
    display: none !important;
}

.visually-hidden-action {
    display: none !important;
}

/* ======================================================
   BUTTON VARIANTS
   ====================================================== */
.primary-button,
.secondary-button,
.success-button,
.danger-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
    line-height: 1.4;
}

.primary-button {
    background: #2563eb;
    color: #ffffff;
}
.primary-button:hover:not(:disabled) {
    background: #1d4ed8;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.secondary-button {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}
.secondary-button:hover:not(:disabled) {
    background: #e2e8f0;
}

.success-button {
    background: #10b981;
    color: #ffffff;
}
.success-button:hover:not(:disabled) {
    background: #059669;
}

.danger-button {
    background: #ef4444;
    color: #ffffff;
}
.danger-button:hover:not(:disabled) {
    background: #dc2626;
}

.primary-button:disabled,
.secondary-button:disabled,
.success-button:disabled,
.danger-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Icon-only round button (column toggle) */
.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}
.icon-button:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.column-toggle-button {
    min-width: 32px;
    min-height: 32px;
}

/* ======================================================
   SECTION TITLE (shared across pages)
   ====================================================== */
.section-title {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ======================================================
   TABLE TITLE ROW (used in all pages)
   ====================================================== */
.table-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.table-title-row h2 {
    margin: 0 0 2px;
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-title-row p {
    margin: 0;
    font-size: 12px;
    color: #64748b;
}

/* Actions area in header */
.table-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

/* ======================================================
   SEARCH FILTER (used on all pages)
   ====================================================== */
.table-search-filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 6px 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: border-color 0.15s;
}

.table-search-filter:focus-within {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.table-search-filter span {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    white-space: nowrap;
}

.table-search-filter input {
    border: none;
    outline: none;
    font-size: 13px;
    width: 220px;
    color: #1e293b;
    background: transparent;
}

/* ======================================================
   SHARED TABLE SCROLL & TABLE STYLES
   ====================================================== */
.table-scroll,
.process-table-scroll {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 60vh;
    -webkit-overflow-scrolling: touch;
}

.tracker-table,
.process-output-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12.5px;
    color: #1e293b;
    min-width: 600px;
}

.tracker-table th,
.process-output-table th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f1f5f9;
    color: #334155;
    font-weight: 700;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 2px solid #cbd5e1;
    white-space: nowrap;
}

.tracker-table td,
.process-output-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
    vertical-align: middle;
}

.tracker-table tbody tr:hover,
.process-output-table tbody tr:hover {
    background: #f0f7ff;
}

.tracker-table tbody tr:last-child td,
.process-output-table tbody tr:last-child td {
    border-bottom: none;
}

/* Number cells */
.number-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Empty state placeholder */
.empty-state {
    text-align: center;
    padding: 36px 20px;
    color: #94a3b8;
    font-size: 13px;
    font-style: italic;
}

/* ======================================================
   STICKY COLUMNS
   ====================================================== */
.sticky-col {
    position: sticky;
    background: #ffffff;
    z-index: 2;
}

.tracker-table th.sticky-col {
    z-index: 11;
    background: #f1f5f9;
}

.sticky-col-0 { left: 0; }
.sticky-col-1 { left: 40px; }
.sticky-col-2 { left: 140px; }
.sticky-col-3 { left: 280px; }
.sticky-col-4 { left: 420px; }
.sticky-col-5 { left: 520px; }
.sticky-col-6 { left: 630px; }

/* Optional (hidden by default) columns */
.optional-column {
    display: none;
}

.optional-column.col-visible {
    display: table-cell;
}

/* ======================================================
   LOADER / SPINNER
   ====================================================== */
.loader-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* ======================================================
   RESPONSIVE
   ====================================================== */
@media (max-width: 768px) {
    body.content-page {
        padding: 12px !important;
    }

    .table-title-row {
        flex-direction: column;
        gap: 10px;
    }

    .table-actions {
        width: 100%;
    }

    .table-search-filter input {
        width: 160px;
    }
}