/* CLIENT PORTAL DESIGN SYSTEM - INTEGRATED WITH MAIN SITE STYLE */
:root {
    --bg-body: #f0f2f5; 
    --bg-card: #ffffff; 
    --bg-input: #f9fafb;
    --border-color: #d1d5db; 
    --text-main: #111827; 
    --text-muted: #6b7280; 
    --accent-red: #d50000; 
    --accent-hover: #b91c1c; 
    --success: #10b981;
    --font-main: 'Inter', sans-serif;
    --shadow-sleek: 0 4px 15px rgba(0,0,0,0.03);
}

body { 
    font-family: var(--font-main); 
    background-color: var(--bg-body); 
    color: var(--text-main); 
    margin: 0; 
    padding: 40px 20px; 
    -webkit-font-smoothing: antialiased; 
}

.portal-container { 
    max-width: 1000px; 
    margin: auto; 
    display: grid; 
    grid-template-columns: 80px 1fr; 
    gap: 30px; 
}

/* Sidebar Styling */
.sidebar { 
    background-color: var(--bg-card); 
    border-radius: 6px; 
    border: 1px solid var(--border-color);
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    padding: 30px 0; 
    gap: 25px; 
    height: fit-content;
    box-shadow: var(--shadow-sleek);
}

.sidebar-icon { 
    width: 40px; 
    height: 40px; 
    border-radius: 4px; 
    background-color: var(--bg-input); 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    color: var(--text-muted); 
    font-weight: bold; 
    border: 1px solid var(--border-color);
}

.sidebar-icon.active { 
    background-color: var(--accent-red); 
    color: white; 
    border-color: var(--accent-red);
}

/* Page Headers */
h1 { 
    font-size: 1.8rem; 
    font-weight: 800; 
    letter-spacing: 1px; 
    margin: 0 0 10px 0; 
    color: #000; 
}

.page-header p { 
    margin: 0 0 40px 0; 
    color: var(--text-muted); 
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

/* Card System */
.ui-card { 
    background: var(--bg-card); 
    padding: 30px; 
    border: 1px solid var(--border-color); 
    border-top: 4px solid var(--accent-red); 
    border-radius: 6px; 
    margin-bottom: 30px; 
    box-shadow: var(--shadow-sleek);
}

.card-title { 
    margin-top: 0; 
    margin-bottom: 20px; 
    font-size: 1.1rem; 
    font-weight: 700;
    display: flex; 
    align-items: center; 
    gap: 10px; 
    border-bottom: 1px solid var(--border-color); 
    padding-bottom: 12px; 
}

.tag-pill { 
    background-color: #fef2f2; 
    border: 1px solid rgba(213, 0, 0, 0.2);
    padding: 3px 10px; 
    border-radius: 4px; 
    font-size: 0.7rem; 
    color: var(--accent-red); 
    font-weight: 700; 
    text-transform: uppercase; 
}

/* Grid & Inputs */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }

.input-group label { 
    display: block; 
    font-size: 0.85rem; 
    color: var(--text-main); 
    margin-bottom: 8px; 
    font-weight: 600; 
}

.soft-input { 
    width: 100%; 
    padding: 12px; 
    background: var(--bg-input); 
    border: 1px solid var(--border-color); 
    color: var(--text-main); 
    font-family: var(--font-main); 
    font-size: 0.95rem; 
    border-radius: 4px; 
    box-sizing: border-box; 
    transition: all 0.3s ease; 
}

.soft-input:focus { 
    outline: none; 
    border-color: var(--accent-red); 
    background: white;
    box-shadow: 0 0 0 3px rgba(213, 0, 0, 0.08); 
}

.soft-input[readonly] { 
    background-color: #f3f4f6; 
    color: var(--text-muted); 
    cursor: not-allowed; 
}

/* Specific Dropdown Style from main site */
select.soft-input { 
    appearance: none; 
    background-image: url('data:image/svg+xml;utf8,<svg fill="%236b7280" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>'); 
    background-repeat: no-repeat; 
    background-position: right 12px center; 
}

/* Interactive Elements */
.checkbox-group { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    margin-top: 5px; 
    background-color: var(--bg-input); 
    padding: 15px; 
    border-radius: 4px; 
    border: 1px solid var(--border-color);
}

.checkbox-group input { 
    width: 18px; 
    height: 18px; 
    accent-color: var(--accent-red); 
    cursor: pointer;
}

.checkbox-group label { 
    font-size: 0.9rem; 
    font-weight: 500; 
    color: var(--text-main); 
    margin: 0; 
    cursor: pointer;
}

.btn-submit { 
    padding: 14px 30px; 
    border: none; 
    background: var(--accent-red); 
    color: #fff; 
    font-family: var(--font-main); 
    font-weight: 700; 
    font-size: 1rem; 
    cursor: pointer; 
    border-radius: 4px; 
    transition: all 0.2s ease; 
}

.btn-submit:hover { 
    background: var(--accent-hover); 
}

.alert-success { 
    background: #ecfdf5; 
    border-left: 4px solid var(--success); 
    color: #065f46; 
    padding: 16px 20px; 
    margin-bottom: 30px; 
    font-weight: 600; 
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); 
}

#dynamic_form_container { display: flex; flex-direction: column; gap: 10px; }

@media (max-width: 768px) {
    .portal-container { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .two-col { grid-template-columns: 1fr; }
}

/* --- TOP BAR NAVIGATION SYSTEM --- */
.top-bar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    height: 70px;
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 20px;
    box-shadow: var(--shadow-sleek);
    margin: -40px -20px 40px -20px; /* Counteracts body padding */
}

.nav-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo { display: flex; align-items: center; gap: 8px; }
.logo-text { font-size: 1.5rem; font-weight: 800; color: var(--text-main); letter-spacing: -1px; }

.nav-links { display: flex; list-style: none; gap: 5px; margin: 0; padding: 0; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.nav-item:hover { background: var(--bg-input); color: var(--accent-red); }
.nav-item.active { background: #fef2f2; color: var(--accent-red); }

.nav-user { display: flex; align-items: center; gap: 20px; }
.user-info { text-align: right; line-height: 1.2; }
.user-name { display: block; font-size: 0.9rem; font-weight: 700; color: var(--text-main); }
.user-role { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }

.logout-pill {
    background: white;
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--accent-red);
    transition: all 0.2s;
}
.logout-pill:hover { background: #fef2f2; border-color: var(--accent-red); }

/* --- CONTENT OVERRIDES --- */
.portal-container { 
    display: block; /* Removed the sidebar grid */
    max-width: 1200px;
}

.main-content { 
    max-width: 1000px; 
    margin: 0 auto; 
}

/* App Switcher Pills */
.app-switcher { margin-bottom: 30px; display: flex; gap: 10px; flex-wrap: wrap; }
.app-pill { 
    text-decoration: none; 
    padding: 10px 18px; 
    border-radius: 30px; 
    background: var(--bg-card); 
    color: var(--text-muted); 
    font-size: 0.85rem; 
    font-weight: 600; 
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}
.app-pill.active { background: var(--accent-red); color: white; border-color: var(--accent-red); }

@media (max-width: 768px) {
    .nav-links { display: none; } /* Consider a hamburger menu for mobile later */
    .user-info { display: none; }
}
/* --- DASHBOARD DOCUMENT LIST REFINEMENTS --- */
.doc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 0;
    border-bottom: 1px solid var(--border-color);
}
.doc-row:last-child { border-bottom: none; }

.doc-info { display: flex; flex-direction: column; gap: 2px; }
.doc-name { font-weight: 700; font-size: 1rem; color: var(--text-main); }
.doc-category { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.doc-actions { display: flex; align-items: center; gap: 15px; }

/* Status Badges */
.status-badge { 
    font-size: 0.7rem; 
    padding: 4px 10px; 
    border-radius: 4px; 
    font-weight: 700; 
    text-transform: uppercase; 
    border: 1px solid transparent; 
}
.status-pending { background: #fff7ed; color: #9a3412; border-color: #fed7aa; }
.status-uploaded { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.status-approved { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.status-rejected { background: #fef2f2; color: #991b1b; border-color: #fecaca; }

/* The Stylized Upload Button */
.btn-upload {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 4px;
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-block;
}

.btn-upload:hover {
    background-color: var(--accent-red);
    color: #ffffff;
    border-color: var(--accent-red);
    box-shadow: 0 2px 8px rgba(213, 0, 0, 0.2);
}

.received-check {
    color: var(--success);
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
}
/* Drag and Drop Redesign */
.doc-row {
    background: #ffffff;
    border: 2px dashed #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.doc-row.uploadable:hover {
    border-color: var(--accent-red);
    background: #fffafa;
}

.doc-row.dragover {
    border-color: var(--accent-red);
    background: #fef2f2;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.doc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.doc-info {
    flex: 1;
}

.doc-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

.doc-category {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.upload-instruction {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #9ca3af;
    font-size: 0.85rem;
    margin-top: 5px;
}

.drop-icon {
    font-size: 1.2rem;
}

/* File Items */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    background: #f3f4f6;
    border-radius: 6px;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #e5e7eb;
}

.file-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-uploader-tag {
    font-size: 0.7rem;
    background: var(--text-main);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.btn-browse {
    background: #f3f4f6;
    color: var(--text-main);
    border: 1px solid #d1d5db;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
}

.btn-browse:hover {
    background: #e5e7eb;
}
body { font-family: 'Inter', sans-serif; background-color: #f1f5f9; margin: 0; padding: 0; color: #334155; }
.navbar { background-color: #1e293b; padding: 15px 30px; display: flex; justify-content: space-between; align-items: center; color: white; }
.navbar a { color: white; text-decoration: none; font-weight: 600; margin-left: 20px; font-size: 0.9rem;}
.navbar a:hover { color: #38bdf8; }
.container { max-width: 1000px; margin: 40px auto; padding: 0 20px; }
.card { background: white; border-radius: 8px; padding: 25px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); margin-bottom: 25px; border: 1px solid #e2e8f0; }

h1, h2, h3 { color: #0f172a; margin-top: 0; }
.text-center { text-align: center; }

/* Grid System */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; }

/* Form Elements */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 15px; }
.form-group label { font-size: 0.85rem; font-weight: 700; color: #475569; text-transform: uppercase; letter-spacing: 0.5px; }
.form-group input, .form-group select { padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 1rem; width: 100%; box-sizing: border-box; background: #fdfaff; transition: 0.2s;}
.form-group input:focus, .form-group select:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }

/* Buttons */
.btn { display: inline-block; padding: 10px 20px; border-radius: 6px; font-weight: 600; text-decoration: none; cursor: pointer; border: none; font-size: 0.95rem; transition: 0.2s; text-align: center;}
.btn-primary { background-color: #3b82f6; color: white; }
.btn-primary:hover { background-color: #2563eb; }
.btn-success { background-color: #10b981; color: white; }
.btn-success:hover { background-color: #059669; }
.btn-outline { background-color: transparent; border: 2px solid #3b82f6; color: #3b82f6; }
.btn-outline:hover { background-color: #eff6ff; }
.btn-save { background: #10b981; color: white; border: none; padding: 12px 24px; font-weight: bold; border-radius: 6px; cursor: pointer; font-size: 1rem; transition: 0.2s; width: 100%;}
.btn-save:hover { background: #059669; }

/* Document Rows */
.doc-row { border: 1px solid #e2e8f0; background: #f8fafc; border-radius: 8px; padding: 15px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px;}
.doc-info { flex-grow: 1; }
.doc-name { font-weight: bold; color: #0f172a; font-size: 1.05rem; }
.doc-desc { font-size: 0.85rem; color: #64748b; margin-top: 4px; }
.doc-status { font-size: 0.75rem; font-weight: 700; padding: 4px 10px; border-radius: 12px; text-transform: uppercase; }
.status-pending { background: #fef3c7; color: #b45309; }
.status-received { background: #d1fae5; color: #047857; }

/* Upload Area */
.upload-area { display: flex; align-items: center; gap: 10px; }
.file-input { display: none; }
.upload-btn { background: #e0e7ff; color: #3730a3; border: 1px dashed #a5b4fc; padding: 8px 15px; border-radius: 6px; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: 0.2s;}
.upload-btn:hover { background: #c7d2fe; }

/* Modals */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.7); z-index: 9999; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.modal-overlay.active { display: flex; animation: fadeIn 0.2s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box { background: white; width: 90%; max-width: 500px; border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); }
.modal-header { padding: 20px; border-bottom: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center; background: #f8fafc; }
.modal-header h3 { margin: 0; font-size: 1.25rem; color: #0f172a; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #64748b; line-height: 1; }
.modal-close:hover { color: #ef4444; }
.modal-body { padding: 20px; overflow-y: auto; max-height: 70vh;}
.modal-footer { padding: 15px 20px; border-top: 1px solid #e2e8f0; background: #f8fafc; }

.alert { padding: 12px 20px; border-radius: 6px; margin-bottom: 20px; font-weight: 600; }
.alert-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.alert-success { background: #d1fae5; color: #047857; border: 1px solid #34d399; }