/* ============================================================
   PORTAL & ADMIN — Shared Styles
   Uses brand variables from main.css
   ============================================================ */

:root {
    --forest: #1B4332;
    --forest-dark: #0D2818;
    --forest-light: #2D6A4F;
    --sage: #8FB996;
    --sage-light: #B7D7BE;
    --sage-pale: #DAE8DC;
    --cream: #F8F5EF;
    --white: #FFFFFF;
    --text: #2E2E2E;
    --text-light: #6B6B6B;
    --gold: #C9A84C;
    --font-heading: 'Playfair Display', Georgia, serif;
    --font-body: 'Montserrat', 'Segoe UI', sans-serif;
    --radius: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 2px 12px rgba(27,67,50,0.07);
    --shadow-md: 0 8px 30px rgba(27,67,50,0.1);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Status colors */
    --status-pending: #6B7280;
    --status-review: #3B82F6;
    --status-approved: #10B981;
    --status-rejected: #EF4444;
    --status-revision: #F59E0B;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-body); color: var(--text);
    background: var(--cream); line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-heading); color: var(--forest); line-height: 1.3; }

/* ---- LOGIN PAGE ---- */
.login-page {
    min-height: 100vh; display: flex;
    align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--forest-dark), var(--forest));
    padding: 24px;
}
.login-card {
    background: var(--white); border-radius: var(--radius-lg);
    padding: 48px 40px; width: 100%; max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.login-logo {
    text-align: center; margin-bottom: 32px;
}
.login-logo svg { margin: 0 auto 12px; display: block; }
.login-logo h1 {
    font-size: 1.4rem; margin-bottom: 4px;
}
.login-logo p {
    font-size: 0.78rem; color: var(--sage);
    text-transform: uppercase; letter-spacing: 2px;
}
.login-card .form-group { margin-bottom: 20px; }
.login-card .form-group label {
    display: block; font-weight: 500; font-size: 0.85rem;
    color: var(--forest); margin-bottom: 6px;
}
.login-card .form-group input {
    width: 100%; padding: 13px 16px;
    border: 2px solid var(--sage-pale); border-radius: var(--radius);
    font-family: var(--font-body); font-size: 0.95rem;
    color: var(--text); transition: border-color var(--transition);
}
.login-card .form-group input:focus {
    outline: none; border-color: var(--sage);
    box-shadow: 0 0 0 4px rgba(143,185,150,0.12);
}
.login-error {
    background: #FEF2F2; border: 1px solid #FECACA;
    color: #DC2626; padding: 12px 16px; border-radius: var(--radius);
    font-size: 0.85rem; margin-bottom: 16px; display: none;
}
.login-error.show { display: block; }
.login-footer {
    text-align: center; margin-top: 24px;
    font-size: 0.82rem; color: var(--text-light);
}

/* ---- LAYOUT ---- */
.portal-layout {
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    background: var(--forest-dark); color: var(--sage-light);
    padding: 24px 0; display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0; width: 260px;
    z-index: 100; overflow-y: auto;
}
.sidebar-logo {
    display: flex; align-items: center; gap: 12px;
    padding: 0 24px 24px; border-bottom: 1px solid rgba(143,185,150,0.1);
    margin-bottom: 8px;
}
.sidebar-logo svg { flex-shrink: 0; }
.sidebar-logo .logo-text {
    display: flex; flex-direction: column;
}
.sidebar-logo .logo-name {
    font-family: var(--font-heading); font-size: 1rem;
    color: var(--white); font-weight: 600;
}
.sidebar-logo .logo-sub {
    font-size: 0.68rem; color: var(--sage);
    text-transform: uppercase; letter-spacing: 1.5px;
}
.sidebar-nav { flex: 1; padding: 8px 12px; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; color: var(--sage-light);
    border-radius: 10px; font-size: 0.88rem; font-weight: 500;
    text-decoration: none; transition: all var(--transition);
    margin-bottom: 4px;
}
.sidebar-nav a:hover { background: rgba(143,185,150,0.1); color: var(--white); }
.sidebar-nav a.active { background: rgba(143,185,150,0.15); color: var(--white); font-weight: 600; }
.sidebar-nav a svg { opacity: 0.7; }
.sidebar-nav a.active svg, .sidebar-nav a:hover svg { opacity: 1; }
.sidebar-footer {
    padding: 16px 24px; border-top: 1px solid rgba(143,185,150,0.1);
    margin-top: auto;
}
.sidebar-user {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 12px;
}
.sidebar-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(143,185,150,0.2);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; color: var(--sage); font-size: 0.85rem;
}
.sidebar-user-info { font-size: 0.82rem; }
.sidebar-user-info strong { display: block; color: var(--white); }
.sidebar-user-info span { color: var(--sage); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 1px; }
.sidebar-logout {
    display: flex; align-items: center; gap: 8px;
    background: none; border: 1px solid rgba(143,185,150,0.2);
    color: var(--sage-light); padding: 8px 16px; border-radius: 8px;
    cursor: pointer; font-size: 0.82rem; width: 100%;
    justify-content: center; transition: all var(--transition);
    font-family: var(--font-body);
}
.sidebar-logout:hover { background: rgba(143,185,150,0.1); border-color: var(--sage); }

/* Main content */
.main-content {
    margin-left: 260px; padding: 32px;
    min-height: 100vh;
}
.portal-layout.no-sidebar .main-content {
    margin-left: 0;
}

/* Top bar for portal */
.portal-topbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 32px;
}
.portal-topbar h1 { font-size: 1.6rem; }
.breadcrumb {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.82rem; color: var(--text-light); margin-bottom: 4px;
}
.breadcrumb a { color: var(--sage); text-decoration: none; }
.breadcrumb a:hover { color: var(--forest); }

/* ---- CARDS ---- */
.card {
    background: var(--white); border-radius: var(--radius-lg);
    padding: 28px; box-shadow: var(--shadow-sm);
    border: 1px solid rgba(143,185,150,0.08);
}

/* Summary cards (dashboard) */
.summary-grid {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 20px; margin-bottom: 32px;
}
.summary-card {
    background: var(--white); border-radius: var(--radius);
    padding: 24px; box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--sage);
    transition: transform var(--transition);
}
.summary-card:hover { transform: translateY(-2px); }
.summary-card.review { border-left-color: var(--status-review); }
.summary-card.approved { border-left-color: var(--status-approved); }
.summary-card.revision { border-left-color: var(--status-revision); }
.summary-card h3 {
    font-family: var(--font-body); font-size: 0.78rem;
    text-transform: uppercase; letter-spacing: 1.5px;
    color: var(--text-light); font-weight: 600; margin-bottom: 8px;
}
.summary-card .count {
    font-family: var(--font-heading); font-size: 2rem;
    color: var(--forest); font-weight: 700;
}

/* ---- STATUS BADGES ---- */
.badge {
    display: inline-block; padding: 4px 12px; border-radius: 50px;
    font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-pending { background: #F3F4F6; color: var(--status-pending); }
.badge-in_review, .badge-in-review { background: #EFF6FF; color: var(--status-review); }
.badge-approved { background: #ECFDF5; color: var(--status-approved); }
.badge-rejected { background: #FEF2F2; color: var(--status-rejected); }
.badge-revision_requested, .badge-revision-requested { background: #FFFBEB; color: var(--status-revision); }

/* ---- TABLE ---- */
.data-table {
    width: 100%; border-collapse: collapse;
}
.data-table th {
    text-align: left; padding: 12px 16px;
    font-size: 0.75rem; text-transform: uppercase;
    letter-spacing: 1px; color: var(--text-light);
    border-bottom: 2px solid var(--sage-pale); font-weight: 600;
}
.data-table td {
    padding: 14px 16px; border-bottom: 1px solid rgba(143,185,150,0.08);
    font-size: 0.9rem;
}
.data-table tr { transition: background var(--transition); cursor: pointer; }
.data-table tbody tr:hover { background: rgba(143,185,150,0.04); }

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 24px; font-family: var(--font-body);
    font-size: 0.88rem; font-weight: 600; border: none;
    border-radius: 50px; cursor: pointer;
    transition: all var(--transition); text-decoration: none;
}
.btn-sm { padding: 8px 16px; font-size: 0.8rem; }
.btn-primary { background: var(--forest); color: var(--white); }
.btn-primary:hover { background: var(--forest-light); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-success { background: var(--status-approved); color: var(--white); }
.btn-success:hover { background: #059669; }
.btn-warning { background: var(--status-revision); color: var(--white); }
.btn-warning:hover { background: #D97706; }
.btn-danger { background: var(--status-rejected); color: var(--white); }
.btn-danger:hover { background: #DC2626; }
.btn-outline {
    background: transparent; color: var(--forest);
    border: 2px solid var(--sage-pale);
}
.btn-outline:hover { border-color: var(--sage); background: var(--sage-pale); }
.btn-ghost { background: transparent; color: var(--text-light); padding: 8px 12px; }
.btn-ghost:hover { color: var(--forest); background: var(--sage-pale); }

/* ---- FORMS ---- */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block; font-weight: 500; font-size: 0.85rem;
    color: var(--forest); margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%; padding: 12px 16px;
    border: 2px solid var(--sage-pale); border-radius: var(--radius);
    font-family: var(--font-body); font-size: 0.92rem;
    color: var(--text); background: var(--white);
    transition: all var(--transition);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none; border-color: var(--sage);
    box-shadow: 0 0 0 4px rgba(143,185,150,0.12);
}
.form-group textarea { resize: vertical; min-height: 100px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---- UPLOAD ZONE ---- */
.upload-zone {
    border: 2px dashed var(--sage-pale); border-radius: var(--radius-lg);
    padding: 40px; text-align: center; cursor: pointer;
    transition: all var(--transition); background: var(--white);
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--sage); background: rgba(143,185,150,0.04);
}
.upload-zone svg { color: var(--sage); margin-bottom: 12px; }
.upload-zone p { color: var(--text-light); font-size: 0.9rem; }
.upload-zone .upload-hint { font-size: 0.78rem; margin-top: 8px; color: var(--sage); }
.upload-zone input[type="file"] { display: none; }
.upload-progress {
    margin-top: 16px; display: none;
}
.upload-progress.show { display: block; }
.progress-bar {
    height: 6px; background: var(--sage-pale); border-radius: 3px; overflow: hidden;
}
.progress-bar-fill {
    height: 100%; background: var(--sage); border-radius: 3px;
    transition: width 0.3s ease; width: 0;
}

/* ---- IMAGE GALLERY ---- */
.design-gallery {
    background: var(--white); border-radius: var(--radius-lg);
    padding: 16px; margin-bottom: 8px;
    box-shadow: var(--shadow-sm); border: 1px solid rgba(143,185,150,0.08);
}
.gallery-display {
    position: relative; display: flex; align-items: center;
    justify-content: center; min-height: 300px;
    background: var(--cream); border-radius: var(--radius);
    overflow: hidden;
}
.gallery-slide {
    display: flex; align-items: center; justify-content: center;
    width: 100%; min-height: 300px; padding: 16px;
}
.gallery-arrow {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(255,255,255,0.9); border: 1px solid var(--sage-pale);
    color: var(--forest); cursor: pointer; z-index: 5;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition); box-shadow: var(--shadow-sm);
}
.gallery-arrow:hover { background: var(--white); border-color: var(--sage); box-shadow: var(--shadow-md); }
.gallery-prev { left: 12px; }
.gallery-next { right: 12px; }
.gallery-dots {
    display: flex; justify-content: center; gap: 8px;
    padding: 12px 0 4px;
}
.gallery-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--sage-pale); border: none; cursor: pointer;
    transition: all var(--transition);
}
.gallery-dot.active { background: var(--forest); transform: scale(1.2); }
.gallery-dot:hover:not(.active) { background: var(--sage); }

/* Gallery footer — buttons under image */
.gallery-footer {
    padding: 12px 4px 0;
}
.gallery-footer-row {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px;
}
.gallery-label {
    font-weight: 600; font-size: 0.95rem; color: var(--text);
}
.gallery-meta {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.82rem; color: var(--text-light);
}
.gallery-actions {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

/* ---- DESIGN TIMELINE ---- */
.design-timeline { margin-top: 24px; }
.design-version {
    background: var(--white); border-radius: var(--radius-lg);
    padding: 24px; margin-bottom: 16px;
    box-shadow: var(--shadow-sm); border: 1px solid rgba(143,185,150,0.08);
}
.design-version.latest {
    border: 2px solid var(--sage); box-shadow: var(--shadow-md);
}
.design-version-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px; flex-wrap: wrap; gap: 12px;
}
.design-version-header h3 { font-size: 1.1rem; }
.design-meta {
    display: flex; align-items: center; gap: 12px;
    font-size: 0.82rem; color: var(--text-light);
}
.design-preview {
    border-radius: var(--radius); overflow: hidden;
    background: var(--sage-pale); margin-bottom: 16px;
    max-height: 500px; display: flex;
    align-items: center; justify-content: center;
}
.design-preview img {
    max-width: 100%; max-height: 500px; object-fit: contain;
}
.design-preview .pdf-icon {
    padding: 60px; text-align: center; color: var(--forest);
}
.design-preview .pdf-icon svg { margin: 0 auto 12px; display: block; }
.design-actions {
    display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px;
}

/* ---- COMMENTS ---- */
.comments-section { margin-top: 24px; }
.comments-section h4 { margin-bottom: 16px; font-size: 1rem; }
.comment {
    display: flex; gap: 12px; margin-bottom: 16px;
    padding-bottom: 16px; border-bottom: 1px solid rgba(143,185,150,0.08);
}
.comment:last-child { border-bottom: none; }
.comment-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--sage-pale); flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 0.78rem; color: var(--forest);
}
.comment-avatar.admin { background: var(--forest); color: var(--white); }
.comment-body { flex: 1; }
.comment-header {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 4px;
}
.comment-header strong { font-size: 0.88rem; color: var(--forest); }
.comment-header time { font-size: 0.75rem; color: var(--text-light); }
.comment-header .admin-tag {
    font-size: 0.65rem; background: var(--forest);
    color: var(--white); padding: 2px 8px;
    border-radius: 50px; text-transform: uppercase; letter-spacing: 0.5px;
}
.comment-text { font-size: 0.9rem; color: var(--text); line-height: 1.6; }
.comment-form {
    display: flex; gap: 12px; margin-top: 16px;
}
.comment-form textarea {
    flex: 1; padding: 12px; border: 2px solid var(--sage-pale);
    border-radius: var(--radius); font-family: var(--font-body);
    font-size: 0.88rem; resize: none; min-height: 60px;
    transition: border-color var(--transition);
}
.comment-form textarea:focus { outline: none; border-color: var(--sage); }

/* ---- MODAL ---- */
.modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(13,40,24,0.6); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    padding: 24px; opacity: 0; visibility: hidden;
    transition: all var(--transition);
}
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal {
    background: var(--white); border-radius: var(--radius-lg);
    padding: 36px; width: 100%; max-width: 520px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    transform: translateY(20px); transition: transform var(--transition);
}
.modal-overlay.show .modal { transform: translateY(0); }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px;
}
.modal-header h2 { font-size: 1.3rem; }
.modal-close {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--sage-pale); border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--forest); transition: all var(--transition);
}
.modal-close:hover { background: var(--sage); color: var(--white); }
.modal-footer {
    display: flex; justify-content: flex-end; gap: 12px;
    margin-top: 24px; padding-top: 20px;
    border-top: 1px solid var(--sage-pale);
}

/* Password reveal box */
.password-reveal {
    background: #ECFDF5; border: 2px solid var(--status-approved);
    border-radius: var(--radius); padding: 20px;
    margin-top: 16px; text-align: center;
}
.password-reveal p { font-size: 0.85rem; color: var(--text); margin-bottom: 8px; }
.password-reveal .password-value {
    font-family: monospace; font-size: 1.3rem;
    color: var(--forest); font-weight: 700;
    padding: 8px 16px; background: var(--white);
    border-radius: 8px; display: inline-block;
    margin-bottom: 8px; user-select: all;
}
.password-reveal .copy-btn {
    font-size: 0.78rem; color: var(--status-approved);
    background: none; border: none; cursor: pointer;
    font-weight: 600; font-family: var(--font-body);
}

/* ---- TOAST ---- */
.toast-container {
    position: fixed; top: 24px; right: 24px; z-index: 2000;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    padding: 14px 24px; border-radius: var(--radius);
    font-size: 0.88rem; font-weight: 500;
    box-shadow: var(--shadow-md); color: var(--white);
    display: flex; align-items: center; gap: 10px;
    transform: translateX(120%); transition: transform 0.3s ease;
    min-width: 280px;
}
.toast.show { transform: translateX(0); }
.toast-success { background: var(--status-approved); }
.toast-error { background: var(--status-rejected); }
.toast-info { background: var(--status-review); }

/* ---- EMPTY STATE ---- */
.empty-state {
    text-align: center; padding: 60px 24px;
    color: var(--text-light);
}
.empty-state svg { color: var(--sage); margin-bottom: 16px; }
.empty-state h3 { color: var(--forest); margin-bottom: 8px; }
.empty-state p { font-size: 0.92rem; max-width: 400px; margin: 0 auto; }

/* ---- LOADING ---- */
.spinner {
    width: 32px; height: 32px; border: 3px solid var(--sage-pale);
    border-top-color: var(--sage); border-radius: 50%;
    animation: spin 0.8s linear infinite; margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- MOBILE SIDEBAR TOGGLE ---- */
.sidebar-toggle {
    display: none; position: fixed; bottom: 24px; left: 24px;
    z-index: 200; width: 48px; height: 48px;
    background: var(--forest); color: var(--white);
    border: none; border-radius: 50%; cursor: pointer;
    box-shadow: var(--shadow-md);
    align-items: center; justify-content: center;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 1024px) {
    .summary-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition);
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 20px 16px; }
    .sidebar-toggle { display: flex; }
    .summary-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .design-version-header { flex-direction: column; align-items: flex-start; }
    .portal-topbar { flex-direction: column; align-items: flex-start; gap: 12px; }
    .data-table { font-size: 0.82rem; }
    .data-table th, .data-table td { padding: 10px 8px; }
    .modal { padding: 24px; margin: 16px; }
}
