/* =====================================================
   X3WEB Revision Portal — Stylesheet
   ===================================================== */

:root {
    --navy:        #0f1b2d;
    --navy-mid:    #162235;
    --orange:      #f05a22;
    --orange-dark: #d44d1a;
    --bg:          #f0f2f5;
    --white:       #ffffff;
    --text:        #1a1a2e;
    --muted:       #6b7280;
    --border:      #e5e7eb;
    --radius:      10px;
    --shadow:      0 2px 12px rgba(0, 0, 0, .07);
}

/* --- Reset ----------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
}

h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.2; }
p          { margin: 0; }
a          { color: var(--orange); text-decoration: none; }
a:hover    { text-decoration: underline; }

/* --- Topbar ---------------------------------------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--navy);
    padding: 0 32px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    margin-left: 24px;
}

.topbar-link {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, .55);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    transition: color .15s, background .15s;
    white-space: nowrap;
}

.topbar-link:hover { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }
.topbar-link.active { color: #fff; background: rgba(255,255,255,.12); }

.topbar-brand {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--orange);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.admin-email {
    font-size: 13px;
    color: rgba(255, 255, 255, .55);
}

/* --- Layout ---------------------------------------- */
.main      { padding: 40px 32px; }
.container { max-width: 1200px; margin: 0 auto; }

/* --- Page header ----------------------------------- */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
}

.page-header h1  { font-size: 24px; }
.page-header > div > p { font-size: 14px; color: var(--muted); margin-top: 4px; }

/* --- Card ------------------------------------------ */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px 32px;
    margin-bottom: 24px;
}

.card-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--muted);
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

/* --- Buttons --------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, color .15s;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1;
}

.btn-primary       { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-dark); color: #fff; text-decoration: none; }

.btn-secondary       { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #d1d5db; color: var(--text); text-decoration: none; }

.btn-ghost       { background: transparent; color: rgba(255,255,255,.7); border: 1px solid rgba(255,255,255,.2); }
.btn-ghost:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }

.btn-danger       { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; text-decoration: none; }

.btn-sm { padding: 6px 13px; font-size: 13px; }

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

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

thead th  {
    text-align: left;
    padding: 11px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--muted);
    background: #f9fafb;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td  {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td      { background: #f9fafb; }

/* --- Status badges --------------------------------- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-blue  { background: #eff6ff; color: #1d4ed8; }
.badge-amber { background: #fffbeb; color: #b45309; }
.badge-green { background: #f0fdf4; color: #166534; }
.badge-teal  { background: #ecfdf5; color: #065f46; }
.badge-grey  { background: #f3f4f6; color: #374151; }

/* --- Forms ----------------------------------------- */
.form-grid                    { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 28px; }
.form-grid .full              { grid-column: 1 / -1; }
.form-group                   { display: flex; flex-direction: column; gap: 6px; }

label       { font-size: 13px; font-weight: 600; color: #374151; }
label small { font-weight: 400; color: var(--muted); }

input[type=text],
input[type=email],
input[type=url],
input[type=password],
select,
textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
    transition: border-color .15s, box-shadow .15s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(240, 90, 34, .1);
}

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

.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

/* --- Client link box ------------------------------- */
.link-box       { display: flex; align-items: center; gap: 10px; }
.link-box input { flex: 1; font-family: monospace; font-size: 13px; background: #f9fafb; }

/* --- Alerts ---------------------------------------- */
.alert {
    padding: 13px 18px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 24px;
    line-height: 1.5;
}
.alert-success { background: #f0fdf4; border: 1px solid #4ade80; color: #166534; }
.alert-error   { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }

/* --- Empty state ----------------------------------- */
.empty-state       { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state strong { display: block; font-size: 16px; color: var(--text); margin-bottom: 6px; }

/* --- Project code display -------------------------- */
.project-code { font-family: 'Courier New', monospace; font-size: 14px; font-weight: 700; letter-spacing: 1px; color: var(--navy); }

/* --- Meta grid (project detail) -------------------- */
.meta-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }

.meta-item label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 5px; }
.meta-item span  { font-size: 15px; color: var(--text); }

/* --- Login page ------------------------------------ */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 4px 24px rgba(0, 0, 0, .08);
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
}

.login-brand {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--orange);
    margin-bottom: 8px;
}

.login-title { font-size: 22px; margin-bottom: 28px; }

.login-card .form-group { margin-bottom: 18px; }

.login-card .btn-submit {
    width: 100%;
    padding: 13px;
    font-size: 15px;
    margin-top: 6px;
}

/* --- Client portal header -------------------------- */
.client-header {
    background: var(--navy);
    padding: 0 32px;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}

.client-header-brand {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--orange);
}

.client-header-sep   { color: rgba(255, 255, 255, .25); font-size: 16px; }
.client-header-label { font-size: 14px; color: rgba(255, 255, 255, .5); }

/* --- Project summary (client status page) ---------- */
.project-summary {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.project-summary-eyebrow {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--muted);
    margin-bottom: 6px;
}

.project-summary-name   { font-size: 22px; margin-bottom: 4px; }
.project-summary-client { font-size: 14px; color: var(--muted); }

.project-preview-link {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--muted);
}

.project-preview-link a { margin-left: 8px; }

/* --- Status card ----------------------------------- */
.status-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
    margin-bottom: 20px;
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.status-card--placeholder {
    background: #f9fafb;
    border: 2px dashed var(--border);
    box-shadow: none;
}

.status-icon {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
}

.status-icon--open    { background: #eff6ff; color: #1d4ed8; }
.status-icon--pending { background: #fffbeb; color: #b45309; }
.status-icon--complete { background: #f0fdf4; color: #166534; }

.status-body    { flex: 1; }
.status-heading { font-size: 20px; margin-bottom: 12px; }
.status-message { font-size: 15px; color: #374151; line-height: 1.65; }

/* --- Contact grid (revisions_complete) ------------- */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.contact-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px 28px;
}

.contact-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--muted);
    margin-bottom: 8px;
}

.contact-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.contact-note {
    margin-top: 6px;
    font-size: 13px;
    color: var(--muted);
}

/* --- Revision detail view -------------------------- */
.revision-detail-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    background: var(--white);
    overflow: hidden;
}

.revision-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    background: #f9fafb;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.revision-detail-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--navy);
}

.revision-detail-body { padding: 20px; }

.revision-detail-field { margin-bottom: 16px; }
.revision-detail-field:last-child { margin-bottom: 0; }

.revision-detail-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--muted);
    margin-bottom: 4px;
}

.revision-detail-value { font-size: 14px; color: var(--text); line-height: 1.6; white-space: pre-wrap; }

.file-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }

.file-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: #f9fafb;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
}

.file-row-name { flex: 1; font-weight: 500; word-break: break-all; }
.file-row-size { color: var(--muted); white-space: nowrap; }

/* --- Revision items -------------------------------- */
.revision-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
    background: #f9fafb;
}

.revision-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.revision-item-num {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--navy);
}

/* File input */
input[type=file].file-input {
    padding: 8px 10px;
    font-size: 13px;
    color: var(--muted);
    background: #f9fafb;
    cursor: pointer;
}

/* Confirmation checkbox row */
.confirm-check {
    margin-bottom: 24px;
    padding: 16px 20px;
    background: #fffbeb;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    transition: box-shadow .2s, border-color .2s;
}

.confirm-check--error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .15);
}

.confirm-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    font-weight: 500;
}

.confirm-label input[type=checkbox] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--orange);
}

/* --- Round boxes (project "All Revision Changes") -- */
.round-box {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
}
.round-box:last-child { margin-bottom: 0; }

.round-box-header {
    padding: 12px 20px;
    background: #f9fafb;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 14px;
    color: var(--navy);
}

.round-box-empty {
    padding: 20px;
    color: var(--muted);
    font-size: 14px;
    font-style: italic;
}

.round-box-items { padding: 16px; }
.round-box-items .revision-detail-item:last-child { margin-bottom: 0; }

/* --- Replacement text block ------------------------ */
.replacement-block {
    background: #f9fafb;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    font-size: 14px;
    line-height: 1.65;
    color: var(--text);
    white-space: pre-wrap;
    text-align: left;
}

.replacement-block--empty {
    color: var(--muted);
    font-style: italic;
}

/* --- Responsive ------------------------------------ */
@media (max-width: 768px) {
    .topbar         { padding: 0 16px; }
    .client-header  { padding: 0 16px; }
    .main           { padding: 24px 16px; }
    .card           { padding: 20px; }
    .form-grid      { grid-template-columns: 1fr; }
    .form-grid .full { grid-column: 1; }
    .page-header    { flex-direction: column; align-items: flex-start; }
    .login-card     { padding: 32px 24px; }
    .status-card    { flex-direction: column; gap: 16px; padding: 24px 20px; }
    .contact-grid   { grid-template-columns: 1fr; }
}
