/* sub-portal/style.css
   Subcontractor portal styles.
   Design system: Yancey Brand & UI Design System v2.0
   Font: Inter (Google Fonts). Colors via CSS custom properties.
   Subs may use this on a phone — big buttons, minimal clutter. */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ============================================================
   DESIGN SYSTEM TOKENS
   Kept in sync with frontend/style.css.
   ============================================================ */

:root {
    /* Amber — brand accent (Yancey Gold) */
    --amber-50:  #FFF7ED;
    --amber-100: #FFEDD5;
    --amber-500: #F97316;
    --amber-600: #EA580C;
    --amber-700: #C2410C;
    --amber-900: #7C2D12;

    /* Stone — warm neutral scale (replaces cool grays) */
    --stone-50:  #FAFAF9;
    --stone-100: #F5F5F4;
    --stone-200: #E7E5E4;
    --stone-300: #D6D3D1;
    --stone-500: #78716C;
    --stone-700: #44403C;
    --stone-900: #1C1917;
    --stone-950: #0C0A09;

    /* Semantic — status and feedback colors */
    --success-bg:   #ECFDF5;
    --success-text: #047857;
    --danger-bg:    #FEF2F2;
    --danger-text:  #B91C1C;
    --danger:       #DC2626;
    --danger-hover: #B91C1C;
    --warning-bg:   #FFFBEB;
    --warning-text: #B45309;
    --info-bg:      #EFF6FF;
    --info-text:    #1D4ED8;

    /* Spacing — 8px grid (--space-N where N = px / 4) */
    --space-1:  4px;
    --space-2:  8px;
    --space-3:  12px;
    --space-4:  16px;
    --space-6:  24px;
    --space-8:  32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Border radius */
    --radius-sm:   6px;
    --radius-md:   8px;
    --radius-lg:   12px;
    --radius-pill: 9999px;

    /* Shadows */
    --shadow-sm:    0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-card:  0 0 0 0.5px rgba(0, 0, 0, 0.05),
                    0 1px 2px rgba(0, 0, 0, 0.04),
                    0 2px 4px rgba(0, 0, 0, 0.03),
                    0 4px 8px rgba(0, 0, 0, 0.02);
    --shadow-modal: 0 8px 32px rgba(0, 0, 0, 0.3);

    /* Font */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    font-size: 15px;
    background: var(--stone-50);
    color: var(--stone-900);
}

/* ============================================================
   HEADER
   ============================================================ */

header {
    background: var(--stone-950);
    color: #ffffff;
    padding: 18px var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

header .brand {
    font-size: 16px;
    font-weight: bold;
    color: var(--amber-500);
}

header button {
    background: transparent;
    border: 1px solid var(--amber-500);
    color: var(--amber-500);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 13px;
    transition: all 150ms ease;
}

header button:hover {
    background: var(--amber-500);
    color: var(--stone-950);
}

header button:active {
    transform: scale(0.98);
}

header button:focus-visible {
    outline: 2px solid var(--amber-500);
    outline-offset: 2px;
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */

.content {
    max-width: 600px;
    margin: var(--space-6) auto;
    padding: 0 var(--space-4);
}

/* Login box */
.login-box {
    background: #ffffff;
    border: 1px solid var(--stone-200);
    border-radius: var(--radius-md);
    padding: var(--space-6);
    text-align: center;
    box-shadow: var(--shadow-card);
}

.login-box h2 {
    margin-bottom: var(--space-4);
    font-size: 18px;
}

/* ============================================================
   JOB CARDS
   ============================================================ */

.job-card {
    background: #ffffff;
    border: 1px solid var(--stone-200);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    box-shadow: var(--shadow-card);
}

.job-card .job-id {
    font-size: 13px;
    color: var(--stone-500);
    margin-bottom: var(--space-1);
}

.job-card .job-address {
    font-size: 15px;
    font-weight: bold;
    margin-bottom: var(--space-3);
}

.job-card .actions {
    display: flex;
    gap: var(--space-2);
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */

label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 13px;
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--stone-300);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 15px;
    margin-bottom: 14px;
    transition: border-color 150ms ease, outline 150ms ease;
}

input:focus, textarea:focus {
    outline: 2px solid rgba(249, 115, 22, 0.2);
    outline-offset: 0;
    border-color: var(--amber-500);
}

textarea {
    min-height: 80px;
    resize: vertical;
}

/* ============================================================
   BUTTONS — big and clear for mobile use
   ============================================================ */

.btn {
    display: inline-block;
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    width: 100%;
    margin-bottom: var(--space-2);
    box-shadow: var(--shadow-sm);
    transition: all 150ms ease;
}

/* Pressed feedback */
.btn:active {
    transform: scale(0.98);
}

/* Keyboard focus ring */
.btn:focus-visible {
    outline: 2px solid var(--amber-500);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--amber-600);
    color: #ffffff;
    border-radius: var(--radius-md); /* primary buttons get rounder corners */
}

.btn-primary:hover {
    background: var(--amber-700);
}

.btn-secondary {
    background: var(--stone-100);
    color: var(--stone-700);
    border: 1px solid var(--stone-300);
    width: auto;
    padding: 10px var(--space-4);
    font-size: 13px;
}

.btn-secondary:hover {
    background: var(--stone-200);
}

/* ============================================================
   MODAL
   ============================================================ */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: #ffffff;
    border-radius: var(--radius-md);
    padding: var(--space-6);
    width: 90%;
    max-width: 480px;
}

.modal h3 {
    margin-bottom: var(--space-4);
    font-size: 16px;
}

.modal .close-btn {
    float: right;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--stone-500);
}

/* ============================================================
   MESSAGES
   ============================================================ */

.message {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-4);
    font-size: 14px;
}

.message-success { background: var(--success-bg); color: var(--success-text); }
.message-error   { background: var(--danger-bg);  color: var(--danger-text);  }

/* ============================================================
   PHASE 3 POLISH — Loading States & Animations (Sub Portal)
   ============================================================ */

@keyframes skeleton-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes error-shake {
    0%, 100% { transform: translateX(0); }
    25%       { transform: translateX(-8px); }
    75%       { transform: translateX(8px); }
}

.skeleton-line {
    height: 12px;
    border-radius: 4px;
    background: var(--stone-100);
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    margin-bottom: 8px;
}
.skeleton-line.sk-short  { width: 45%; }
.skeleton-line.sk-medium { width: 70%; }
.skeleton-line.sk-full   { width: 100%; }

.btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

.shake { animation: error-shake 400ms ease; }

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 24px;
    max-width: 400px;
    margin: 0 auto;
}

.empty-state-icon    { color: var(--stone-300); margin-bottom: 16px; }
.empty-state-heading { font-size: 18px; font-weight: 600; color: var(--stone-700); margin-bottom: 8px; }
.empty-state-desc    { font-size: 14px; color: var(--stone-500); line-height: 1.5; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--amber-600);
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 0 0 6px 0;
    z-index: 9999;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: top 150ms ease;
}
.skip-link:focus { top: 0; }

:focus-visible { outline: 2px solid var(--amber-500); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

@media print {
    header, .btn, .no-print { display: none !important; }
    body { overflow: visible; }
    * { color: #000 !important; background: #fff !important; box-shadow: none !important; }
}

/* ============================================================
   MOBILE RESPONSIVE — Sub Portal
   Sub-portal users are almost always on phones on job sites.
   ============================================================ */

@media (max-width: 767px) {
    /* Header: tighter on mobile */
    header {
        padding: 12px var(--space-4);
    }

    /* Content area: full-width with comfortable side padding */
    .content {
        margin: var(--space-3) auto;
        padding: 0 var(--space-3);
    }

    /* Touch targets: 44px minimum on all interactive elements */
    .btn {
        min-height: 48px;
        padding: 12px var(--space-4);
        font-size: 15px;
    }

    header button {
        min-height: 44px;
        padding: 8px 14px;
    }

    /* Job cards: bigger address text, more action button spacing */
    .job-card .job-address {
        font-size: 16px;
    }

    .job-card .actions {
        flex-direction: column;
        gap: var(--space-2);
    }

    .job-card .actions .btn {
        width: 100%;
        text-align: center;
    }

    /* Forms: larger inputs for easier mobile typing */
    input[type="text"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    textarea,
    select {
        font-size: 16px; /* prevents iOS auto-zoom on input focus */
        min-height: 44px;
    }

    /* Modal: bottom sheet on mobile */
    .modal-overlay {
        align-items: flex-end;
    }

    .modal {
        width: 100%;
        max-width: 100%;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-height: 88vh;
        overflow-y: auto;
    }

    /* Login box: full-width card */
    .login-box {
        padding: var(--space-4);
    }

    /* File drop zone on mobile */
    .file-drop-zone {
        min-height: 100px;
        cursor: pointer;
    }
}
