/* 
   SECURE DOCS PORTAL — portal.css
   Semantic Custom CSS (Non-Tailwind)
   Scoped to .sdp-body for theme compatibility.
*/

:root {
    /* Colors */
    --sdp-slate-50: #f8fafc;
    --sdp-slate-100: #f1f5f9;
    --sdp-slate-200: #e2e8f0;
    --sdp-slate-300: #cbd5e1;
    --sdp-slate-400: #94a3b8;
    --sdp-slate-500: #64748b;
    --sdp-slate-600: #475569;
    --sdp-slate-700: #334155;
    --sdp-slate-800: #1e293b;
    --sdp-slate-900: #0f172a;
    
    --sdp-emerald-50: #ecfdf5;
    --sdp-emerald-100: #dcfce7;
    --sdp-emerald-500: #10b981;
    --sdp-emerald-600: #059669;
    
    --sdp-amber-50: #fffbeb;
    --sdp-amber-100: #fef3c7;
    --sdp-amber-500: #f59e0b;
    --sdp-amber-700: #b45309;
    
    --sdp-white: #ffffff;
    --sdp-accent: #50c878;
    --sdp-accent-dark: #45b068;

    /* Spacing & Radii */
    --sdp-radius: 12px;
    --sdp-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --sdp-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* ── Base ─────────────────────────────────────────────── */
.sdp-body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--sdp-slate-800);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.sdp-body * {
    box-sizing: border-box;
}

.sdp-body.min-h-screen { min-height: 100vh; }
.sdp-body.pb-20 { padding-bottom: 5rem; }
.sdp-body.py-20 { padding-top: 5rem; padding-bottom: 5rem; }

/* ── Layout Helpers ───────────────────────────────────── */
/* ── Header Styles ────────────────────────────────────── */
.sdp-portal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 2.5rem;
    background: var(--sdp-white);
    border-bottom: 1px solid var(--sdp-slate-100);
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 1rem;
}

@media (max-width: 640px) {
    .sdp-portal-header {
        padding: 0.65rem 0.85rem;
        gap: 0.35rem;
    }
}

.sdp-header-btn {
    padding: 0.45rem 0.8rem;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 8px;
    white-space: nowrap;
    transition: all 0.2s;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

@media (max-width: 400px) {
    .sdp-header-btn {
        padding: 0.4rem 0.6rem;
        font-size: 10px;
    }
}

.sdp-header-btn-primary {
    background: var(--sdp-accent);
    color: #fff !important;
}

.sdp-header-btn-primary:hover {
    background: var(--sdp-accent-dark);
}

.sdp-header-btn-secondary {
    background: transparent;
    border: 1.5px solid var(--sdp-slate-200);
    color: var(--sdp-slate-700) !important;
}

.sdp-header-btn-secondary:hover {
    background: var(--sdp-slate-50);
}

.sdp-injected-hero .sdp-flex {
    flex-wrap: wrap;
    justify-content: center;
}

@media (max-width: 640px) {
    .sdp-injected-hero .sdp-flex {
        flex-direction: column !important;
        width: 100%;
        max-width: 280px;
        margin: 0 auto;
    }
    .sdp-injected-hero .sdp-btn-submit {
        width: 100% !important;
        text-align: center;
    }
}

.sdp-container {
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 2.5rem;
}

@media (max-width: 640px) {
    .sdp-container { padding: 0 1rem; }
}

.sdp-flex { display: flex; }
.sdp-flex-col { flex-direction: column; }
.sdp-items-center { align-items: center; }
.sdp-justify-between { justify-content: space-between; }
.sdp-justify-center { justify-content: center; }
.sdp-gap-2 { gap: 0.5rem; }
.sdp-gap-3 { gap: 0.75rem; }
.sdp-gap-4 { gap: 1rem; }
.sdp-flex-grow { flex-grow: 1; }

.sdp-hidden { display: none !important; }

/* ── Dashboard Shell ──────────────────────────────────── */
.sdp-status-bar {
    background: var(--sdp-white);
    border-bottom: 1px solid var(--sdp-slate-200);
    padding: 0.75rem 2.5rem;
    margin-bottom: 2rem;
}

.sdp-user-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sdp-avatar-placeholder {
    width: 2rem;
    height: 2rem;
    background: var(--sdp-slate-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Listing Grid ─────────────────────────────────────── */
.listing-grid {
    display: grid !important;
    grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
    gap: 1.125rem !important;
    margin-top: 3rem !important;
    margin-bottom: 5rem !important;
}

@media (min-width: 640px) {
    .listing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (min-width: 900px) {
    .listing-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}
@media (min-width: 1200px) {
    .listing-grid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
}
@media (min-width: 1500px) {
    .listing-grid { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
}
@media (min-width: 1800px) {
    .listing-grid { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; }
}

.listing-grid::before, .listing-grid::after { display: none !important; content: none !important; }

/* ── Document Cards (Compact Design) ───────────────────── */
.document-card-v {
    background: var(--sdp-white) !important;
    border: 1px solid rgba(0,0,0,0.06) !important;
    border-radius: var(--sdp-radius) !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1) !important;
    cursor: pointer !important;
    width: 100% !important;
    position: relative !important;
    text-decoration: none !important;
    color: inherit !important;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02) !important;
}

.document-card-v:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 12px 24px rgba(0,0,0,0.06) !important;
    border-color: var(--sdp-accent) !important;
}

.sdp-card-thumb {
    aspect-ratio: 1 / 1.3;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--sdp-slate-100);
}

.sdp-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.document-card-v:hover .sdp-card-thumb img {
    transform: scale(1.05);
}

.sdp-card-body {
    padding: 1rem 0.85rem !important;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 160px;
}

.sdp-card-title {
    font-size: 0.9rem !important;
    font-weight: 700 !important;
    color: var(--sdp-slate-900) !important;
    margin-bottom: 0.5rem !important;
    line-height: 1.2 !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
    min-height: 2.4em;
}

.sdp-card-desc {
    font-size: 0.8rem !important;
    color: var(--sdp-slate-500) !important;
    margin-bottom: 0.75rem !important;
    line-height: 1.4 !important;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    line-clamp: 4;
    overflow: hidden;
    min-height: 5.6em;
}

.sdp-card-footer {
    padding-top: 0.75rem;
    border-top: 1px solid var(--sdp-slate-50);
    margin-top: auto;
}

/* ── Badges ───────────────────────────────────────────── */
.sdp-badge-overlay {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.625rem;
    border-radius: 6px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.2);
    z-index: 10;
}

.sdp-badge-text {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--sdp-white);
}

.sdp-bg-approved { background: rgba(16, 185, 129, 0.9); }
.sdp-bg-pending  { background: rgba(245, 158, 11, 0.9); }
.sdp-bg-locked   { background: rgba(15, 23, 42, 0.4); }

.sdp-badge-expiry {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.125rem 0.5rem;
    background: var(--sdp-amber-50);
    border: 1px solid var(--sdp-amber-100);
    border-radius: 6px;
}

.sdp-expiry-text {
    font-size: 12px;
    font-weight: 700;
    color: var(--sdp-amber-700);
    text-transform: uppercase;
}

/* ── Hero Styles ──────────────────────────────────────── */
.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--sdp-slate-900);
}

.sdp-injected-hero {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* ── Auth Styles (Login/Register) ─────────────────────── */
.sdp-auth-wrap {
    min-height: calc(100vh - 100px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.sdp-auth-card {
    background: var(--sdp-white);
    border: 1px solid var(--sdp-slate-200);
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--sdp-shadow);
}

.sdp-auth-card-wide {
    max-width: 640px;
}

.sdp-auth-icon {
    width: 64px;
    height: 64px;
    background: var(--sdp-emerald-50);
    color: var(--sdp-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.sdp-auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--sdp-slate-900);
    margin-bottom: 0.5rem;
    text-align: center;
}

.sdp-auth-sub {
    font-size: 0.875rem;
    color: var(--sdp-slate-500);
    text-align: center;
    margin-bottom: 2rem;
}

.sdp-field { margin-bottom: 1.25rem; }
.sdp-field label {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--sdp-slate-600);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.sdp-field input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--sdp-slate-200);
    border-radius: 8px;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s;
}

.sdp-field input:focus { border-color: var(--sdp-accent); }

.sdp-pass-wrap {
    position: relative;
    width: 100%;
}

.sdp-eye-btn {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--sdp-slate-400);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 10;
}

.sdp-eye-btn:hover { color: var(--sdp-slate-600); }

.sdp-form-row {
    display: flex;
    gap: 1.25rem;
}

.sdp-form-row .sdp-field { flex: 1; }

@media (max-width: 640px) {
    .sdp-form-row { flex-direction: column; gap: 0; }
}

.sdp-required { color: var(--sdp-amber-700); }
.sdp-field-hint { font-size: 0.75rem; color: var(--sdp-slate-400); margin-top: 0.25rem; display: block; }

.sdp-alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.sdp-alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fee2e2; }
.sdp-alert-success { background: #f0fdf4; color: #166534; border: 1px solid #dcfce7; }

.sdp-btn-submit {
    width: 100%;
    padding: 0.75rem;
    background: var(--sdp-accent);
    color: var(--sdp-white);
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.sdp-btn-submit:hover {
    background: var(--sdp-accent-dark);
    transform: translateY(-1px);
}

.sdp-auth-footer {
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: var(--sdp-slate-500);
    text-align: center;
}

.sdp-auth-footer a {
    color: var(--sdp-accent);
    font-weight: 600;
    text-decoration: underline;
}

.sdp-auth-footer a:hover {
    color: var(--sdp-accent-dark);
}

/* ── Modals & Reg Access ─────────────────────────────── */
.sdp-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.sdp-modal-card {
    background: var(--sdp-white);
    border-radius: var(--sdp-radius);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--sdp-shadow-lg);
    overflow: hidden;
}

/* ── Viewer Specific ─────────────────────────────────── */
.sdp-viewer-nav {
    height: 3.5rem;
    background: var(--sdp-white);
    border-bottom: 1px solid var(--sdp-slate-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 50;
}

.sdp-viewer-controls {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid var(--sdp-slate-200);
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    z-index: 40;
    display: flex;
    align-items: center;
    box-shadow: var(--sdp-shadow);
}

.sdp-viewer-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 1rem;
    color: var(--sdp-slate-400);
}

.sdp-viewport-area {
    flex-grow: 1;
    position: relative;
    background: #f3f6f9;
}

.sdp-spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--sdp-slate-200);
    border-top-color: var(--sdp-accent);
    border-radius: 50%;
    animation: sdp-spin 0.8s linear infinite;
}

@keyframes sdp-spin {
    to { transform: rotate(360deg); }
}

/* ── Utility ────────────────────────────────────────── */
.sdp-border-b { border-bottom: 1px solid var(--sdp-slate-200); }
.sdp-mb-2 { margin-bottom: 0.5rem; }
.sdp-mb-3 { margin-bottom: 0.75rem; }
.sdp-mb-5 { margin-bottom: 1.25rem; }
.sdp-mb-8 { margin-bottom: 2rem; }
.sdp-text-xs { font-size: 0.75rem; }
.sdp-font-bold { font-weight: 700; }
.sdp-w-full { width: 100% !important; }
.sdp-h-auto { height: auto !important; }