@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #F26522; /* MUJ Brand Orange */
    --primary-hover: #D84F0E;
    --primary-light: #FFF2EB;
    --text-main: #1E293B; /* Slate 800 */
    --text-muted: #64748B; /* Slate 500 */
    --bg-main: #F8FAFC; /* Slate 50 */
    --bg-card: #FFFFFF;
    --border: #E2E8F0; /* Slate 200 */
    --border-hover: #CBD5E1;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --success: #10B981; /* Emerald 500 */
    --success-light: #ECFDF5;
    --warning: #F59E0B; /* Amber 500 */
    --warning-light: #FEF3C7;
    --danger: #EF4444; /* Red 500 */
    --danger-light: #FEF2F2;
    --info: #3B82F6; /* Blue 500 */
    --info-light: #EFF6FF;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    color: var(--text-main);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

/* Navigation Shell */
header {
    background-color: var(--bg-card);
    border-bottom: 3px solid var(--primary);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-section img {
    height: 48px;
    width: auto;
}

.logo-text h1 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.1;
}

.logo-text span {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
}

.nav-links a:hover, .nav-links a.active {
    color: var(--primary);
    background-color: var(--primary-light);
}

.btn-logout {
    background-color: var(--danger-light);
    color: var(--danger) !important;
    border: 1px solid transparent;
}

.btn-logout:hover {
    background-color: var(--danger) !important;
    color: white !important;
}

/* Content Layout */
main {
    flex: 1;
    max-width: 1280px;
    width: 100%;
    margin: 2rem auto;
    padding: 0 2rem;
}

footer {
    background-color: #1E293B;
    color: #94A3B8;
    padding: 2rem;
    text-align: center;
    font-size: 0.875rem;
    border-top: 1px solid #334155;
    margin-top: auto;
}

footer p {
    margin-bottom: 0.5rem;
}

footer a {
    color: #F8FAFC;
    font-weight: 500;
}

/* Card Styling */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-hover);
}

.card-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 0.5rem;
}

/* UI Grid Systems */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
    .nav-container {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    .nav-links {
        width: 100%;
        justify-content: center;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    color: white;
}

.btn-secondary {
    background-color: white;
    color: var(--text-main);
    border-color: var(--border);
}

.btn-secondary:hover {
    background-color: var(--bg-main);
    border-color: var(--border-hover);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: #DC2626;
    color: white;
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-success:hover {
    background-color: #059669;
    color: white;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Form Styling */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background-color: white;
    color: var(--text-main);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:disabled {
    background-color: var(--bg-main);
    cursor: not-allowed;
}

/* Alert Boxes */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    border-left: 4px solid;
    font-size: 0.95rem;
}

.alert-success {
    background-color: var(--success-light);
    border-color: var(--success);
    color: #065F46;
}

.alert-danger {
    background-color: var(--danger-light);
    border-color: var(--danger);
    color: #991B1B;
}

.alert-warning {
    background-color: var(--warning-light);
    border-color: var(--warning);
    color: #92400E;
}

.alert-info {
    background-color: var(--info-light);
    border-color: var(--info);
    color: #1E40AF;
}

/* Auth Pages Specifics (Login) */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 180px);
    padding: 2rem;
}

.auth-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 450px;
    padding: 2.5rem;
    border-top: 5px solid var(--primary);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h2 {
    font-size: 1.75rem;
    margin-top: 0.5rem;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Dashboard Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-submitted { background-color: var(--info-light); color: var(--info); }
.badge-under_review { background-color: var(--warning-light); color: var(--warning); }
.badge-approved { background-color: var(--success-light); color: var(--success); }
.badge-rejected { background-color: var(--danger-light); color: var(--danger); }
.badge-query_raised { background-color: #F5F3FF; color: #7C3AED; }

.badge-pending { background-color: var(--warning-light); color: var(--warning); }

/* Multi-step Form Wizard */
.wizard-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin-bottom: 2.5rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.wizard-steps::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--border);
    transform: translateY(-50%);
    z-index: 1;
}

.step-indicator {
    position: relative;
    z-index: 2;
    background-color: var(--bg-main);
    padding: 0 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.step-number {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: var(--bg-card);
    border: 3px solid var(--border);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.step-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.step-indicator.active .step-number {
    border-color: var(--primary);
    background-color: var(--primary);
    color: white;
    box-shadow: 0 0 0 4px var(--primary-light);
}

.step-indicator.active .step-label {
    color: var(--primary);
}

.step-indicator.completed .step-number {
    border-color: var(--success);
    background-color: var(--success);
    color: white;
}

.step-indicator.completed .step-label {
    color: var(--success);
}

.wizard-step {
    display: none;
}

.wizard-step.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* File Upload Grid and Slots */
.upload-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.upload-slot {
    background-color: var(--bg-main);
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
}

.upload-slot:hover {
    border-color: var(--primary);
}

.upload-info h4 {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.upload-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.upload-action {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.upload-status {
    font-size: 0.85rem;
    font-weight: 600;
}

.upload-status.success { color: var(--success); }
.upload-status.error { color: var(--danger); }

/* File progress bar */
.progress-container {
    width: 100%;
    background-color: var(--border);
    height: 6px;
    border-radius: 3px;
    margin-top: 8px;
    overflow: hidden;
    display: none;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background-color: var(--primary);
    transition: width 0.1s ease;
}

/* Admin Split Review Layout */
.review-container {
    display: flex;
    height: calc(100vh - 120px);
    margin: -2rem -2rem; /* offset main margins */
    overflow: hidden;
}

.review-left {
    flex: 1;
    background-color: #E2E8F0; /* Slate 200 */
    border-right: 2px solid var(--border);
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.review-right {
    width: 550px;
    background-color: var(--bg-card);
    overflow-y: auto;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
}

@media (max-width: 1024px) {
    .review-container {
        flex-direction: column;
        height: auto;
        overflow: visible;
        margin: 0;
    }
    .review-right {
        width: 100%;
        margin-top: 2rem;
    }
}

.doc-viewer-card {
    background-color: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border-top: 4px solid var(--primary);
}

.doc-viewer-header {
    background-color: var(--bg-main);
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.doc-viewer-header h3 {
    font-size: 1rem;
}

.doc-viewer-body {
    padding: 1rem;
    text-align: center;
    background-color: #FAFAFA;
}

.doc-preview-img {
    max-width: 100%;
    height: auto;
    max-height: 500px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.doc-preview-iframe {
    width: 100%;
    height: 500px;
    border: none;
    border-radius: var(--radius-sm);
}

.review-group {
    background-color: var(--bg-main);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.review-group h3 {
    font-size: 1.1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.review-table {
    width: 100%;
    border-collapse: collapse;
}

.review-table th, .review-table td {
    padding: 0.5rem 0;
    font-size: 0.9rem;
    text-align: left;
}

.review-table th {
    color: var(--text-muted);
    font-weight: 500;
    width: 180px;
}

.review-table td {
    font-weight: 600;
}

.review-decisions {
    margin-top: auto;
}

.scholarship-decision-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1rem;
    background-color: white;
}

.scholarship-decision-card.actioned {
    border-left: 5px solid var(--success);
}

.decision-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Browser-like Horizontal Tab Document Viewer */
.browser-tab-bar {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    background-color: var(--bg-main);
    padding-top: 8px;
    padding-left: 8px;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.browser-tab {
    background-color: var(--bg-main);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-bottom: none;
    padding: 0.6rem 1.25rem;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    font-family: 'Outfit', sans-serif;
    white-space: nowrap;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.browser-tab:hover {
    color: var(--primary);
    background-color: var(--primary-light);
}

.browser-tab.active {
    background-color: white;
    border-color: var(--border);
    border-bottom: 2px solid white;
    color: var(--primary);
    border-top: 3px solid var(--primary);
    font-weight: 700;
    margin-bottom: -2px;
    z-index: 2;
}

.browser-tab-content {
    display: none;
    flex-direction: column;
    height: calc(100vh - 250px);
}

.browser-tab-content.active {
    display: flex;
}

.browser-url-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f8fafc;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-top: none;
    font-size: 0.8rem;
    font-family: 'Outfit', sans-serif;
}

/* Full Screen Review Page Workspace Override */
body.review-page {
    overflow: hidden;
    height: 100vh;
}

body.review-page footer {
    display: none !important;
}

body.review-page main {
    padding: 0;
    margin: 0;
    max-width: 100%;
}

body.review-page .review-container {
    height: calc(100vh - 73px); /* Fits exact viewport below top header */
    margin: 0;
    overflow: hidden;
    border-radius: 0;
}

/* Responsive Zoom Override for Review Page */
@media (max-width: 1200px) {
    body.review-page {
        overflow-y: auto !important;
        height: auto !important;
    }
    body.review-page .review-container {
        display: flex;
        flex-direction: column !important;
        height: auto !important;
        overflow: visible !important;
    }
    .review-left, .review-right {
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        flex: none !important;
    }
    .review-right {
        border-left: none !important;
        border-top: 3px solid var(--primary) !important;
        background-color: var(--bg-card);
        padding: 2rem 1.5rem !important;
    }
    .review-left {
        padding: 1.5rem !important;
    }
    .browser-tab-content {
        height: 600px !important; /* Fixed preview height on stacked layouts */
    }
}

/* Print Styles */
@media print {
    body {
        background-color: white;
        color: black;
    }
    header, footer, .btn, .no-print {
        display: none !important;
    }
    main {
        margin: 0;
        padding: 0;
        max-width: 100%;
    }
    .card {
        border: none;
        box-shadow: none;
        padding: 0;
        margin-bottom: 2rem;
    }
    .review-table th {
        width: 250px;
    }
}
