/* DCS Consulting CNC Portal — Main Stylesheet */

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

/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --navy:       #1a3a5c;
    --navy-dark:  #0f2540;
    --navy-light: #2a5080;
    --accent:     #2a7fd4;
    --accent-lt:  #e8f1fb;
    --success:    #1a7a4a;
    --success-lt: #e6f5ed;
    --warning:    #b86a00;
    --warning-lt: #fff4e0;
    --danger:     #b72a2a;
    --danger-lt:  #fdeaea;
    --gray-50:    #f8f9fa;
    --gray-100:   #f0f2f5;
    --gray-200:   #e2e6ea;
    --gray-300:   #ced4da;
    --gray-400:   #9ba3ad;
    --gray-500:   #6c757d;
    --gray-700:   #3d4550;
    --gray-900:   #1c2028;
    --white:      #ffffff;
    --radius-sm:  4px;
    --radius-md:  8px;
    --radius-lg:  12px;
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.10);
    --shadow-lg:  0 8px 24px rgba(0,0,0,0.12);
    --font-sans:  'Inter', system-ui, sans-serif;
    --font-mono:  'IBM Plex Mono', monospace;
    --sidebar-w:  240px;
    --header-h:   60px;
}

html { font-size: 15px; -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--font-sans);
    color: var(--gray-900);
    background: var(--gray-100);
    line-height: 1.6;
}

/* ── Layout ────────────────────────────────────────────────────────────────── */
.portal-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: var(--navy-dark);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand h1 {
    font-size: 16px;
    font-weight: 600;
    color: var(--white);
    line-height: 1.3;
}

.sidebar-brand p {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    margin-top: 2px;
}

.sidebar-nav { flex: 1; padding: 12px 0; }

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    padding: 16px 20px 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 13.5px;
    transition: background 0.15s, color 0.15s;
}

.nav-link:hover { background: rgba(255,255,255,0.06); color: var(--white); }

.nav-link.active {
    background: rgba(42,127,212,0.25);
    color: var(--white);
    border-right: 3px solid var(--accent);
}

.nav-link svg { width: 18px; height: 18px; opacity: 0.8; flex-shrink: 0; }
.nav-link.active svg { opacity: 1; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 12px;
    color: rgba(255,255,255,0.4);
}

.sidebar-footer a { color: rgba(255,255,255,0.6); text-decoration: none; }
.sidebar-footer a:hover { color: var(--white); }

/* Main Content */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-header {
    height: var(--header-h);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-header h2 {
    font-size: 17px;
    font-weight: 600;
    color: var(--gray-900);
}

.header-actions { display: flex; align-items: center; gap: 12px; }

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray-700);
}

.avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--navy);
    color: var(--white);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600;
}

.page-body { padding: 28px; flex: 1; }

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--gray-200);
}

.card-header h3 { font-size: 15px; font-weight: 600; color: var(--gray-900); }
.card-body { padding: 24px; }

/* ── Stat Cards ─────────────────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }

.stat-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.stat-card .label { font-size: 12px; color: var(--gray-500); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-card .value { font-size: 28px; font-weight: 600; color: var(--navy); margin-top: 6px; }
.stat-card .sub   { font-size: 12px; color: var(--gray-400); margin-top: 4px; }

/* ── Tables ─────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

thead tr { background: var(--gray-50); }
thead th { padding: 11px 16px; text-align: left; font-size: 11.5px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--gray-200); }
tbody tr { border-bottom: 1px solid var(--gray-100); transition: background 0.1s; }
tbody tr:hover { background: var(--gray-50); }
tbody td { padding: 12px 16px; color: var(--gray-700); }
tbody td:first-child { color: var(--gray-900); font-weight: 500; }

/* ── Badges ─────────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-draft       { background: var(--gray-100); color: var(--gray-500); }
.badge-submitted   { background: var(--accent-lt); color: #1558a0; }
.badge-reviewing   { background: var(--warning-lt); color: var(--warning); }
.badge-quoted      { background: #ede8fb; color: #5b3db0; }
.badge-approved    { background: var(--success-lt); color: var(--success); }
.badge-rejected    { background: var(--danger-lt); color: var(--danger); }
.badge-in_progress { background: #fff0d4; color: #8a5500; }
.badge-completed   { background: var(--success-lt); color: var(--success); }
.badge-cancelled   { background: var(--gray-100); color: var(--gray-500); }
.badge-issued      { background: #ede8fb; color: #5b3db0; }
.badge-expired     { background: var(--danger-lt); color: var(--danger); }

.priority-rush     { background: #fff0d4; color: #8a5500; }
.priority-critical { background: var(--danger-lt); color: var(--danger); }
.priority-standard { background: var(--gray-100); color: var(--gray-500); }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-md);
    font-size: 13.5px; font-weight: 500;
    border: none; cursor: pointer;
    text-decoration: none;
    transition: opacity 0.15s, transform 0.1s;
    white-space: nowrap;
}

.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--navy); color: var(--white); }
.btn-primary:hover { background: var(--navy-light); }
.btn-accent { background: var(--accent); color: var(--white); }
.btn-accent:hover { opacity: 0.9; }
.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { opacity: 0.9; }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { opacity: 0.9; }
.btn-outline { background: transparent; border: 1px solid var(--gray-300); color: var(--gray-700); }
.btn-outline:hover { background: var(--gray-50); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* ── Forms ───────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--gray-700); margin-bottom: 6px; }
.form-label .required { color: var(--danger); margin-left: 3px; }

.form-control {
    display: block;
    width: 100%;
    padding: 9px 13px;
    font-size: 14px;
    color: var(--gray-900);
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: var(--font-sans);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(42,127,212,0.12);
}

.form-control::placeholder { color: var(--gray-400); }
textarea.form-control { resize: vertical; min-height: 100px; line-height: 1.5; }
select.form-control { cursor: pointer; }
.form-hint { font-size: 12px; color: var(--gray-400); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* Two-column form grid */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── File Upload Zone ──────────────────────────────────────────────────────── */
.upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: var(--gray-50);
}

.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-lt);
}

.upload-zone svg { width: 40px; height: 40px; color: var(--gray-400); margin-bottom: 12px; }
.upload-zone p { color: var(--gray-500); font-size: 14px; }
.upload-zone strong { color: var(--accent); }
.upload-zone small { display: block; margin-top: 8px; font-size: 12px; color: var(--gray-400); }

.file-list { margin-top: 16px; }

.file-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    font-size: 13px;
}

.file-item .file-icon { color: var(--accent); flex-shrink: 0; }
.file-item .file-name { flex: 1; color: var(--gray-900); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .file-size { color: var(--gray-400); font-size: 12px; white-space: nowrap; }
.file-item .file-remove { color: var(--gray-400); cursor: pointer; border: none; background: none; padding: 2px; }
.file-item .file-remove:hover { color: var(--danger); }
.file-item .file-category { font-size: 11px; color: var(--gray-400); }

/* ── Signature Pad ───────────────────────────────────────────────────────────── */
.signature-container {
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--white);
}

#signature-pad {
    display: block;
    width: 100%;
    height: 180px;
    cursor: crosshair;
    touch-action: none;
}

.signature-controls {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    font-size: 12px;
    color: var(--gray-500);
}

/* ── Alerts ─────────────────────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    margin-bottom: 16px;
    display: flex; align-items: flex-start; gap: 10px;
}

.alert-success { background: var(--success-lt); color: var(--success); border: 1px solid #b4dcca; }
.alert-danger   { background: var(--danger-lt); color: var(--danger); border: 1px solid #f5c0c0; }
.alert-warning  { background: var(--warning-lt); color: var(--warning); border: 1px solid #f0d58c; }
.alert-info     { background: var(--accent-lt); color: #1558a0; border: 1px solid #b4d0f0; }

/* ── Auth Pages ─────────────────────────────────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    background: var(--gray-100);
    display: flex; align-items: center; justify-content: center;
    padding: 32px 16px;
}

.auth-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}

.auth-header {
    background: var(--navy-dark);
    padding: 28px 32px;
    text-align: center;
}

.auth-header h1 { color: var(--white); font-size: 20px; font-weight: 600; }
.auth-header p  { color: rgba(255,255,255,0.5); font-size: 12px; margin-top: 4px; }
.auth-body { padding: 32px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 13px; color: var(--gray-500); }
.auth-footer a { color: var(--accent); text-decoration: none; }

/* ── Timeline / Activity Log ─────────────────────────────────────────────────── */
.timeline { padding: 4px 0; }
.timeline-item { display: flex; gap: 14px; padding: 10px 0; }
.timeline-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex-shrink: 0; margin-top: 5px; }
.timeline-content { flex: 1; }
.timeline-action { font-size: 13.5px; font-weight: 500; color: var(--gray-900); }
.timeline-detail { font-size: 12.5px; color: var(--gray-500); margin-top: 2px; }
.timeline-time   { font-size: 11.5px; color: var(--gray-400); margin-top: 2px; }

/* ── Notifications ───────────────────────────────────────────────────────────── */
.notif-badge {
    background: var(--danger);
    color: var(--white);
    border-radius: 50%;
    min-width: 18px; height: 18px;
    font-size: 10px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 4px;
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.25s; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .form-grid-2 { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .page-body { padding: 16px; }
}

/* ── Utilities ───────────────────────────────────────────────────────────────── */
.text-muted   { color: var(--gray-500); }
.text-sm      { font-size: 12.5px; }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.w-100 { width: 100%; }
.font-mono { font-family: var(--font-mono); }
