/* LHEM PPR Admin Stylesheet */

/* CSS Variables */
:root {
    --primary-color: #1e3a8a;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary-color: #64748b;
    --accent-color: #f59e0b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-dark: #0f172a;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-light: #ffffff;
    
    --border-color: #e2e8f0;
    --border-radius: 8px;
    --border-radius-lg: 12px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    --transition: all 0.3s ease;
    
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    
    --sidebar-width: 250px;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

/* Login Screen */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    padding: 20px;
}

.login-container {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    overflow: hidden;
}

.login-header {
    background: var(--primary-color);
    color: var(--text-light);
    padding: 40px 30px;
    text-align: center;
}

.login-header h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

.login-header p {
    opacity: 0.9;
}

.login-form {
    padding: 40px 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    min-height: 48px;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--text-light);
    width: 100%;
}

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

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

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

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

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

.btn-danger:hover {
    background: #dc2626;
}

.error-message {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin-top: 16px;
    text-align: center;
}

/* Admin Dashboard */
.admin-dashboard {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: 70px 1fr;
    grid-template-areas: 
        "header header"
        "nav main";
}

.admin-header {
    grid-area: header;
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    padding: 0 30px;
}

.header-content {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content h1 {
    color: var(--primary-color);
    font-size: 24px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    color: var(--text-secondary);
    font-size: 14px;
}

.admin-nav {
    grid-area: nav;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    padding: 30px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    font-weight: 500;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary-color);
    color: var(--text-light);
}

.nav-icon {
    font-size: 20px;
}

.admin-main {
    grid-area: main;
    padding: 30px;
    overflow-y: auto;
}

.admin-section {
    display: none;
}

.admin-section.active {
    display: block;
}

.admin-section h2 {
    color: var(--primary-color);
    margin-bottom: 30px;
    font-size: 28px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-primary);
    padding: 24px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    font-size: 40px;
}

.stat-content h3 {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.stat-label {
    color: var(--text-muted);
    font-size: 14px;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

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

/* Requests Table */
.requests-table-container {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

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

.requests-table th {
    background: var(--bg-tertiary);
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.requests-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.requests-table tr:hover {
    background: var(--bg-secondary);
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-approved {
    background: #d1fae5;
    color: #065f46;
}

.status-rejected {
    background: #fee2e2;
    color: #991b1b;
}

.status-cancelled {
    background: #e5e7eb;
    color: #374151;
}

.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: var(--transition);
}

.action-btn:hover {
    opacity: 0.8;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: var(--bg-primary);
    margin: 5% auto;
    padding: 0;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: var(--primary-color);
}

.close {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: var(--text-muted);
}

.close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 30px;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Request Detail */
.request-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.detail-group {
    margin-bottom: 16px;
}

.detail-group label {
    display: block;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-size: 12px;
    text-transform: uppercase;
}

.detail-group p {
    color: var(--text-primary);
    font-size: 16px;
}

/* Settings Grid */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.setting-group {
    background: var(--bg-primary);
    padding: 20px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
}

.setting-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.setting-description {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.settings-actions {
    margin-top: 30px;
    text-align: right;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: white;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .admin-dashboard {
        grid-template-columns: 1fr;
        grid-template-rows: 70px auto 1fr;
        grid-template-areas: 
            "header"
            "nav"
            "main";
    }
    
    .admin-nav {
        display: flex;
        overflow-x: auto;
        padding: 0;
    }
    
    .nav-item {
        white-space: nowrap;
        padding: 16px 20px;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .section-actions {
        flex-direction: column;
    }
    
    .requests-table {
        font-size: 14px;
    }
    
    .requests-table th,
    .requests-table td {
        padding: 12px 8px;
    }
    
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .request-detail {
        grid-template-columns: 1fr;
    }
    
    .modal-footer {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .login-container {
        margin: 20px;
    }
    
    .admin-main {
        padding: 20px;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
    }
}