/* 
 * Agricoop Exam Portal - Main Stylesheet
 * 
 * Professional, enterprise-grade styling for government exam portal.
 * 
 * @package    ExamPortal
 * @author     Senior PHP Developer
 * @version    1.0.0
 */

/* ============================================
   CSS Variables & Root Configuration
   ============================================ */
:root {
    /* Primary Colors - Government/Professional Theme */
    --primary-color: #1a365d;
    --primary-dark: #0f2341;
    --primary-light: #2c5282;
    
    /* Secondary Colors */
    --secondary-color: #2d8a4e;
    --secondary-dark: #236b3d;
    --secondary-light: #38a169;
    
    /* Accent Colors */
    --accent-color: #c05621;
    --accent-light: #ed8936;
    
    /* Neutral Colors */
    --white: #ffffff;
    --gray-50: #f7fafc;
    --gray-100: #edf2f7;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e0;
    --gray-400: #a0aec0;
    --gray-500: #718096;
    --gray-600: #4a5568;
    --gray-700: #2d3748;
    --gray-800: #1a202c;
    --gray-900: #171923;
    
    /* Status Colors */
    --success-color: #38a169;
    --error-color: #e53e3e;
    --warning-color: #d69e2e;
    --info-color: #3182ce;
    
    /* Typography */
    --font-primary: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    --font-heading: 'Georgia', 'Times New Roman', serif;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 50%;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
    --transition-slow: 500ms ease;
    
    /* Layout */
    --sidebar-width: 260px;
    --header-height: 70px;
}

/* ============================================
   Reset & Base Styles
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--gray-800);
    background-color: var(--gray-100);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-light);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ============================================
   LOGIN PAGE STYLES
   ============================================ */
.login-container {
    min-height: 100vh;
    display: flex;
    background: var(--white);
}

/* Left Panel - Image Side */
.login-left {
    flex: 1;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 50%, var(--primary-light) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-2xl);
    position: relative;
    overflow: hidden;
}

.login-left::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    pointer-events: none;
}

.login-branding {
    text-align: center;
    color: var(--white);
    z-index: 1;
}

.login-logo {
    width: 120px;
    height: 120px;
    background: var(--white);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--spacing-xl);
    box-shadow: var(--shadow-xl);
}

.login-logo svg {
    width: 70px;
    height: 70px;
    fill: var(--primary-color);
}

.login-branding h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-md);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.login-branding p {
    font-size: 1.125rem;
    opacity: 0.9;
    max-width: 400px;
    margin: 0 auto;
}

.login-features {
    margin-top: var(--spacing-2xl);
    z-index: 1;
}

.login-feature {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    color: var(--white);
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md) var(--spacing-lg);
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    backdrop-filter: blur(10px);
}

.login-feature svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.login-feature span {
    font-size: 0.95rem;
}

/* Right Panel - Form Side */
.login-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-2xl);
    background: var(--gray-50);
}

.login-form-container {
    width: 100%;
    max-width: 420px;
}

.login-header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
}

.login-header h2 {
    font-family: var(--font-heading);
    font-size: 1.875rem;
    color: var(--primary-dark);
    margin-bottom: var(--spacing-sm);
}

.login-header p {
    color: var(--gray-600);
    font-size: 0.95rem;
}

/* Login Form */
.login-form {
    background: var(--white);
    padding: var(--spacing-2xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
}

.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: var(--spacing-sm);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-lg);
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: var(--font-primary);
    transition: all var(--transition-fast);
    background: var(--white);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.15);
}

.form-group input::placeholder {
    color: var(--gray-400);
}

.form-group .input-icon {
    position: relative;
}

.form-group .input-icon input {
    padding-left: 48px;
}

.form-group .input-icon select {
    padding-left: 48px;
    width: 100%;
    height: 50px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 1rem;
    color: var(--gray-800);
    background: var(--white);
    appearance: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.form-group .input-icon select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.1);
}

.form-group .input-icon select:focus + svg,
.form-group .input-icon select:focus ~ svg {
    fill: var(--primary-color);
}

.form-group .input-icon svg {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    fill: var(--gray-400);
    transition: fill var(--transition-fast);
}

.form-group .input-icon input:focus + svg,
.form-group .input-icon input:focus ~ svg {
    fill: var(--primary-color);
}

/* Submit Button */
.btn-login {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-xl);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: var(--shadow-md);
}

.btn-login:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Error Message */
.alert {
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.alert-error {
    background: #fed7d7;
    border: 1px solid #fc8181;
    color: #c53030;
}

.alert-warning {
    background: #fefcbf;
    border: 1px solid #f6e05e;
    color: #b7791f;
}

.alert-success {
    background: #c6f6d5;
    border: 1px solid #68d391;
    color: #276749;
}

.alert svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Login Footer */
.login-footer {
    text-align: center;
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--gray-200);
}

.login-footer p {
    color: var(--gray-500);
    font-size: 0.85rem;
}

.login-footer .contact-info {
    margin-top: var(--spacing-sm);
    font-size: 0.8rem;
}

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    color: var(--white);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform var(--transition-normal);
}

.sidebar-header {
    padding: var(--spacing-xl);
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    width: 60px;
    height: 60px;
    background: var(--white);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--spacing-md);
}

.sidebar-logo svg {
    width: 35px;
    height: 35px;
    fill: var(--primary-color);
}

.sidebar-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

.sidebar-header span {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Navigation */
.sidebar-nav {
    padding: var(--spacing-lg) 0;
}

.nav-item {
    display: block;
    padding: var(--spacing-md) var(--spacing-xl);
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border-left-color: var(--white);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
    border-left-color: var(--accent-light);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: var(--spacing-md) var(--spacing-xl);
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top Header */
.top-header {
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-xl);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: var(--spacing-sm);
    cursor: pointer;
}

.menu-toggle svg {
    width: 24px;
    height: 24px;
    fill: var(--gray-600);
}

.page-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    color: var(--primary-dark);
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--gray-200);
}

.user-avatar-placeholder {
    width: 45px;
    height: 45px;
    border-radius: var(--radius-full);
    background: var(--primary-light);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.125rem;
}

.user-details {
    text-align: right;
}

.user-name {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 0.95rem;
}

.user-post {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.btn-logout {
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--error-color);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.btn-logout:hover {
    background: #c53030;
    transform: translateY(-1px);
}

.btn-logout svg {
    width: 16px;
    height: 16px;
}

/* Content Area */
.content-area {
    flex: 1;
    padding: var(--spacing-xl);
}

/* ============================================
   DASHBOARD CARDS & COMPONENTS
   ============================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.card-header {
    padding: var(--spacing-lg) var(--spacing-xl);
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.card-header svg {
    width: 20px;
    height: 20px;
    fill: var(--primary-color);
}

.card-body {
    padding: var(--spacing-xl);
}

/* Profile Card */
.profile-card {
    text-align: center;
}

.profile-card .profile-image {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 4px solid var(--primary-color);
    margin: 0 auto var(--spacing-lg);
    box-shadow: var(--shadow-lg);
}

.profile-card .profile-placeholder {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 600;
    margin: 0 auto var(--spacing-lg);
    box-shadow: var(--shadow-lg);
}

.profile-card h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--primary-dark);
    margin-bottom: var(--spacing-xs);
}

.profile-card .post-badge {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-md);
    background: var(--secondary-color);
    color: var(--white);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Info Card */
.info-list {
    list-style: none;
}

.info-list li {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--gray-100);
}

.info-list li:last-child {
    border-bottom: none;
}

.info-list .label {
    color: var(--gray-600);
    font-weight: 500;
}

.info-list .value {
    color: var(--gray-800);
    font-weight: 600;
}

/* Signature Card */
.signature-container {
    text-align: center;
}

.signature-container img {
    max-width: 200px;
    max-height: 80px;
    margin: 0 auto;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: var(--spacing-sm);
    background: var(--white);
}

.signature-placeholder {
    padding: var(--spacing-xl);
    background: var(--gray-100);
    border-radius: var(--radius-md);
    color: var(--gray-500);
    font-style: italic;
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table thead {
    background: var(--primary-dark);
    color: var(--white);
}

.data-table th {
    padding: var(--spacing-md) var(--spacing-lg);
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--gray-200);
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

.data-table tbody tr:nth-child(even) {
    background: var(--gray-50);
}

.data-table tbody tr:nth-child(even):hover {
    background: var(--gray-100);
}

.data-table td {
    padding: var(--spacing-md) var(--spacing-lg);
    color: var(--gray-700);
}

/* Status Badges */
.badge {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-correct {
    background: #c6f6d5;
    color: #276749;
}

.badge-incorrect {
    background: #fed7d7;
    color: #c53030;
}

.badge-pass {
    background: #c6f6d5;
    color: #276749;
}

.badge-fail {
    background: #fed7d7;
    color: #c53030;
}

/* Result Summary */
.result-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.result-stat {
    text-align: center;
    padding: var(--spacing-xl);
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
}

.result-stat .stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: var(--spacing-xs);
}

.result-stat .stat-label {
    color: var(--gray-600);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-stat.pass .stat-value {
    color: var(--success-color);
}

.result-stat.fail .stat-value {
    color: var(--error-color);
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    padding: var(--spacing-lg) var(--spacing-xl);
    text-align: center;
    color: var(--gray-500);
    font-size: 0.85rem;
}

.footer-links {
    margin-top: var(--spacing-sm);
}

.footer-links a {
    color: var(--gray-500);
    margin: 0 var(--spacing-md);
}

.footer-links a:hover {
    color: var(--primary-color);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 240px;
    }
}

@media (max-width: 768px) {
    .login-container {
        flex-direction: column;
    }
    
    .login-left {
        min-height: auto;
        padding: var(--spacing-lg);
    }
    
    .login-branding h1 {
        font-size: 1.75rem;
    }
    
    .login-features {
        display: block !important;
        font-size: 0.875rem;
        margin-top: 1rem;
    }
    
    .login-features p {
        margin-bottom: 0.75rem !important;
    }
    
    .login-features div {
        display: block !important;
    }
    
    .login-right {
        padding: var(--spacing-lg);
    }
    
    .login-form {
        padding: var(--spacing-lg);
    }
    
    /* Dashboard Mobile */
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .user-details {
        display: none;
    }
    
    .content-area {
        padding: var(--spacing-md);
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .login-form-container {
        padding: 0 var(--spacing-md);
    }
    
    .login-features {
        display: block !important;
        font-size: 0.8rem;
        margin-top: 1rem;
        padding: 0 !important;
    }
    
    .login-features div {
        display: block !important;
    }
    
    .top-header {
        padding: 0 var(--spacing-md);
    }
    
    .page-title {
        font-size: 1rem;
    }
    
    .btn-logout span {
        display: none;
    }
    
    .data-table th,
    .data-table td {
        padding: var(--spacing-sm);
        font-size: 0.8rem;
    }
}

/* ============================================
   UTILITIES
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-1 { margin-top: var(--spacing-md); }
.mt-2 { margin-top: var(--spacing-lg); }
.mt-3 { margin-top: var(--spacing-xl); }

.mb-1 { margin-bottom: var(--spacing-md); }
.mb-2 { margin-bottom: var(--spacing-lg); }
.mb-3 { margin-bottom: var(--spacing-xl); }

.hidden { display: none !important; }

/* Print Styles */
@media print {
    .sidebar,
    .top-header,
    .btn-logout {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}
