/* ─── JacobsDR Client Portal Styles ─────────────────────────────────────── */

:root {
    --brand:        #1a3a5c;
    --brand-dark:   #122840;
    --brand-light:  #e8f0f8;
    --accent:       #2d7dd2;
    --accent-hover: #1a5fa8;
    --danger:       #c0392b;
    --danger-hover: #922b21;
    --success:      #27ae60;
    --warning:      #e67e22;
    --text:         #1a1a2e;
    --text-muted:   #6b7280;
    --border:       #d1d5db;
    --bg:           #f4f6f9;
    --card:         #ffffff;
    --radius:       10px;
    --shadow:       0 2px 12px rgba(0,0,0,0.08);
    --shadow-lg:    0 8px 32px rgba(0,0,0,0.14);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ─── Typography ──────────────────────────────────────────────────────────── */
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 600; margin-bottom: .75rem; }
.muted { color: var(--text-muted); font-size: .9rem; }

/* ─── Layout ──────────────────────────────────────────────────────────────── */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* ─── Header ──────────────────────────────────────────────────────────────── */
.portal-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: .75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.header-logo {
    max-width: 140px;
    height: auto;
    max-height: 48px;
    display: block;
}

.login-logo-img {
    max-width: 220px;
    height: auto;
    max-height: 80px;
    display: block;
    margin: 0 auto 1rem;
}

.portal-wordmark {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: .02em;
    color: var(--brand);
}

.header-sep { margin: 0 .25rem; color: var(--border); }
.header-client { font-size: .95rem; color: var(--text-muted); }

.header-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-user { font-size: .85rem; color: var(--text-muted); }

.portal-header .btn-outline {
    color: var(--brand);
    border: 1px solid var(--brand);
    background: transparent;
}
.portal-header .btn-outline:hover { background: var(--brand-light); }

/* ─── Footer ──────────────────────────────────────────────────────────────── */
.portal-footer {
    margin-top: auto;
    text-align: center;
    padding: 1.25rem;
    font-size: .82rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    background: var(--card);
}
.portal-footer a { color: var(--text-muted); }
.portal-footer a:hover { color: var(--accent); }

.portal-main { flex: 1; }

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1.2rem;
    border-radius: 6px;
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background .15s, color .15s, border-color .15s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-outline {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255,255,255,.5);
}
.btn-outline:hover { background: rgba(255,255,255,.1); }

.btn-secondary { background: #e2e8f0; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #cbd5e1; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }

.btn-download {
    background: var(--brand-light);
    color: var(--brand);
    border: 1px solid #c5d8ed;
    flex-shrink: 0;
}
.btn-download:hover { background: #cdddf0; }

.btn-sm { padding: .35rem .85rem; font-size: .82rem; }
.btn-full { width: 100%; justify-content: center; padding: .75rem; }

/* ─── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: .85rem;
    font-weight: 500;
    margin-bottom: .35rem;
    color: var(--text-muted);
}
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"] {
    width: 100%;
    padding: .6rem .85rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: .95rem;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
    background: #fff;
}
.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(45,125,210,.15);
}

/* ─── Flash Messages ──────────────────────────────────────────────────────── */
.flash {
    padding: .85rem 1.1rem;
    border-radius: 6px;
    margin-bottom: 1.25rem;
    font-size: .9rem;
    font-weight: 500;
}
.flash-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.flash-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.flash-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.flash-info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ─── Session Timeout Banner ──────────────────────────────────────────────── */
.timeout-banner {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 999;
    background: var(--warning);
    color: #fff;
    text-align: center;
    padding: .65rem 1rem;
    font-size: .9rem;
    font-weight: 500;
}
.timeout-banner a { color: #fff; font-weight: 700; margin-left: .5rem; }
.hidden { display: none !important; }

/* ─── Login Page ──────────────────────────────────────────────────────────── */
.login-body {
    background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 60%, #1e5a8a 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem 2.25rem;
    width: 100%;
    max-width: 420px;
}

.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo .portal-wordmark { font-size: 2rem; color: var(--brand); }
.portal-subtitle { color: var(--text-muted); font-size: .95rem; margin-top: .2rem; text-align: center; }

.login-footer {
    color: rgba(255,255,255,.5);
    font-size: .8rem;
    margin-top: 1.5rem;
    text-align: center;
}

/* ─── Client Dashboard Hero ───────────────────────────────────────────────── */
.client-hero {
    text-align: center;
    padding: 2.5rem 1rem 2rem;
}

.client-logo {
    max-height: 120px;
    max-width: 320px;
    object-fit: contain;
    margin-bottom: 1.25rem;
}

.client-logo-placeholder {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
}

.client-welcome  { font-size: 1.5rem; margin-bottom: .4rem; }
.client-tagline  { color: var(--text-muted); }

/* ─── Important Links — pill strip ───────────────────────────────────────── */
.link-strip-wrapper {
    text-align: center;
    margin-bottom: 2rem;
}

.link-strip-label {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: .75rem;
}

.link-strip-label::before,
.link-strip-label::after {
    content: '';
    display: inline-block;
    width: 32px;
    height: 1px;
    background: var(--border);
    vertical-align: middle;
}

.link-pill-strip {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    justify-content: center;
}

.link-pill {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem 1.15rem;
    background: var(--brand-light);
    color: var(--brand);
    border: 1px solid #c5d8ed;
    border-radius: 999px;
    font-size: .88rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, box-shadow .15s;
}
.link-pill:hover {
    background: #cdddf0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.09);
}
.link-pill-arrow { opacity: .65; font-size: .8rem; }

/* ─── Folder Cards ────────────────────────────────────────────────────────── */
.folder-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.folder-header {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: 1.25rem;
    padding-bottom: .85rem;
    border-bottom: 1px solid var(--border);
}
.folder-icon { font-size: 1.4rem; }
.folder-header h2 { margin: 0; flex: 1; font-size: 1.1rem; font-weight: 700; }
.folder-count {
    font-size: .78rem;
    color: var(--text-muted);
    background: var(--bg);
    padding: .2rem .6rem;
    border-radius: 12px;
}
.folder-empty { color: var(--text-muted); font-size: .9rem; font-style: italic; }

/* ─── Two-column grid for Training + Client Materials ─────────────────────── */
.folders-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
.folders-grid .folder-card { margin-bottom: 0; }
@media (max-width: 640px) {
    .folders-grid { grid-template-columns: 1fr; }
}

/* ─── Recently Added ──────────────────────────────────────────────────────── */
.recently-added-section {
    border-left: 4px solid var(--accent);
}

.badge-new {
    display: inline-block;
    font-size: .65rem;
    font-weight: 700;
    color: #fff;
    background: var(--accent);
    padding: .1rem .4rem;
    border-radius: 4px;
    letter-spacing: .04em;
    vertical-align: middle;
    margin-left: .4rem;
}

/* ─── News Section ────────────────────────────────────────────────────────── */
.news-item {
    padding: .85rem 1rem;
    background: var(--bg);
    border-radius: 6px;
    border: 1px solid var(--border);
    line-height: 1.6;
}
.news-item + .news-item { margin-top: .6rem; }

.news-item-headline { display: block; font-size: .9rem; font-weight: 700; }
.news-item-text     { display: inline; font-size: .88rem; color: var(--text); }
.news-item-link     { display: inline; font-size: .82rem; color: var(--accent); font-weight: 500; text-decoration: none; }
.news-item-link:hover { text-decoration: underline; }
.news-item-date     { display: block; font-size: .7rem; color: var(--text-muted); margin-top: .25rem; }

/* ─── File List ───────────────────────────────────────────────────────────── */
.file-list { list-style: none; display: flex; flex-direction: column; gap: .6rem; }

.file-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem .85rem;
    background: var(--bg);
    border-radius: 6px;
    border: 1px solid var(--border);
}

.file-icon { font-size: 1.2rem; flex-shrink: 0; }
.file-info { flex: 1; min-width: 0; }
.file-name {
    display: block;
    font-size: .88rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-meta { font-size: .78rem; color: var(--text-muted); }

/* ─── Show more / fewer ───────────────────────────────────────────────────── */
.file-extra { display: none; }
.file-list.expanded .file-extra { display: flex; }

.show-more-btn {
    display: block;
    width: 100%;
    margin-top: .85rem;
    padding: .55rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: .85rem;
    color: var(--accent);
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: background .15s;
}
.show-more-btn:hover { background: var(--brand-light); }

/* ─── Admin Panel ─────────────────────────────────────────────────────────── */
.admin-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
}
.admin-page-title { font-size: 1.4rem; }

.client-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.client-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.client-card-logo {
    width: 52px; height: 52px;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg);
    padding: 4px;
    flex-shrink: 0;
}

.client-card-initials {
    width: 52px; height: 52px;
    background: var(--brand);
    color: #fff;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.client-card-info { flex: 1; min-width: 0; }
.client-card-name { font-weight: 600; font-size: .95rem; }
.client-card-meta { font-size: .8rem; color: var(--text-muted); }

.admin-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.admin-danger-card { border: 1px solid #f5c6cb; background: #fff8f8; }

.admin-logo-preview {
    max-height: 80px; max-width: 200px;
    object-fit: contain;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px;
    background: var(--bg);
    display: block;
}

.admin-edit-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 1.5rem;
    align-items: start;
}
@media (max-width: 800px) { .admin-edit-grid { grid-template-columns: 1fr; } }

.upload-form { margin-bottom: 1rem; }
.upload-row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.upload-row input[type="file"] { flex: 1; min-width: 0; font-size: .85rem; }

.admin-file-list .file-item { background: var(--bg); }

.empty-state {
    text-align: center;
    padding: 3rem;
    background: var(--card);
    border-radius: var(--radius);
    color: var(--text-muted);
}

/* ─── Modal ───────────────────────────────────────────────────────────────── */
.modal {
    position: fixed; inset: 0; z-index: 500;
    display: flex; align-items: center; justify-content: center;
    padding: 1.5rem;
}
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.modal-box {
    position: relative;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2rem; width: 100%; max-width: 460px; z-index: 1;
}
.modal-box h2 { margin-bottom: 1.25rem; }
.modal-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1.25rem; }

/* Admin outline buttons — dark on white */
.admin-toolbar .btn-outline,
.modal-actions .btn-outline,
.admin-card .btn-outline {
    color: var(--text);
    border-color: var(--border);
}
.admin-toolbar .btn-outline:hover,
.modal-actions .btn-outline:hover,
.admin-card .btn-outline:hover { background: var(--bg); }
