/* ============================================
   eLR-MO Portal — Design System
   Green Institutional Theme
   ============================================ */

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

/* ---- CSS Custom Properties ---- */
:root {
    --primary-dark: #0B3D2E;
    --primary: #10664E;
    --primary-light: #1A8A6A;
    --primary-pale: #E8F5F0;
    --secondary: #0D7377;
    --accent: #D4A843;
    --success: #28A745;
    --warning: #FFC107;
    --danger: #DC3545;
    --info: #17A2B8;
    --bg: #F4F7F5;
    --surface: #FFFFFF;
    --text-primary: #1E2A25;
    --text-secondary: #6B7F75;
    --border: #D1DDD7;
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 3px rgba(11,61,46,0.06);
    --shadow-md: 0 2px 8px rgba(11,61,46,0.08);
    --shadow-lg: 0 4px 20px rgba(11,61,46,0.12);
    --shadow-xl: 0 8px 32px rgba(11,61,46,0.16);
    --transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
}

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

img { max-width: 100%; height: auto; }

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: 1.3; color: var(--text-primary); }
h1 { font-size: 2rem; font-weight: 700; }
h2 { font-size: 1.57rem; }
h3 { font-size: 1.29rem; }
h4 { font-size: 1.14rem; }

.text-muted { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-accent { color: var(--accent); }

/* ---- Auth Layout ---- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0B3D2E 0%, #10664E 40%, #1A8A6A 70%, #0D7377 100%);
    position: relative;
    overflow: hidden;
}

.auth-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 50%, rgba(212,168,67,0.08) 0%, transparent 60%),
                radial-gradient(ellipse at 70% 30%, rgba(255,255,255,0.04) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(2%, -2%) rotate(1deg); }
    66% { transform: translate(-1%, 1%) rotate(-1deg); }
}

.auth-card {
    position: relative;
    width: 420px;
    max-width: 90vw;
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255,255,255,0.1);
    padding: 48px 40px;
    z-index: 1;
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo .logo-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-light));
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(11,61,46,0.2);
}

.auth-logo .logo-icon svg { width: 36px; height: 36px; color: #fff; }

.auth-logo h1 {
    font-size: 1.5rem;
    color: var(--primary-dark);
    margin-bottom: 4px;
}

.auth-logo p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ---- Form Elements ---- */
.form-group { margin-bottom: 20px; }

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.93rem;
    color: var(--text-primary);
    background: var(--surface);
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16,102,78,0.1);
}

.form-control::placeholder { color: var(--text-secondary); opacity: 0.6; }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7F75' d='M6 8.5L1 3.5h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control { resize: vertical; min-height: 80px; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.93rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16,102,78,0.3);
}

.btn-secondary {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn-secondary:hover {
    background: var(--primary-pale);
    color: var(--primary-dark);
}

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c82333; color: #fff; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #218838; color: #fff; }

.btn-block { width: 100%; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }

/* ---- Alerts & Flash ---- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-danger { background: #F8D7DA; color: #721C24; border: 1px solid #F5C6CB; }
.alert-success { background: #D4EDDA; color: #155724; border: 1px solid #C3E6CB; }
.alert-warning { background: #FFF3CD; color: #856404; border: 1px solid #FFEEBA; }
.alert-info { background: #D1ECF1; color: #0C5460; border: 1px solid #BEE5EB; }

/* ---- App Layout ---- */
.app-layout { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0B3D2E 0%, #0D4A36 100%);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: 2px 0 12px rgba(0,0,0,0.15);
}

.sidebar-brand {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand .brand-icon {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.12);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-brand .brand-icon svg { width: 22px; height: 22px; color: var(--accent); }

.sidebar-brand h2 { font-size: 1rem; font-weight: 700; color: #fff; }
.sidebar-brand small { font-size: 0.7rem; color: rgba(255,255,255,0.5); display: block; }

.sidebar-nav { flex: 1; padding: 16px 0; }

.nav-section { padding: 8px 24px 4px; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px; color: rgba(255,255,255,0.35); margin-top: 8px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    color: rgba(255,255,255,0.65);
    font-size: 0.9rem;
    font-weight: 400;
    transition: var(--transition);
    border-left: 3px solid transparent;
    cursor: pointer;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255,255,255,0.06);
}

.nav-item.active {
    color: #fff;
    background: rgba(255,255,255,0.1);
    border-left-color: var(--accent);
    font-weight: 500;
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.7; }
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user .user-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    flex-shrink: 0;
}

.sidebar-user .user-info { min-width: 0; }
.sidebar-user .user-name { font-size: 0.85rem; font-weight: 500; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { font-size: 0.7rem; color: rgba(255,255,255,0.45); text-transform: capitalize; }

/* ---- Main Content ---- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.top-header {
    height: var(--header-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.top-header h1 { font-size: 1.3rem; font-weight: 600; }

.page-content { padding: 28px 32px; }

/* ---- Cards ---- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

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

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 { font-size: 1rem; font-weight: 600; }

.card-body { padding: 24px; }

/* ---- Stat Cards ---- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card .stat-icon svg { width: 24px; height: 24px; }

.stat-card .stat-icon.green { background: #D4EDDA; color: #155724; }
.stat-card .stat-icon.blue { background: #D1ECF1; color: #0C5460; }
.stat-card .stat-icon.amber { background: #FFF3CD; color: #856404; }
.stat-card .stat-icon.red { background: #F8D7DA; color: #721C24; }
.stat-card .stat-icon.teal { background: #CCE5E7; color: #0D7377; }
.stat-card .stat-icon.gold { background: #FBF3E0; color: #8B6914; }

.stat-card .stat-label { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 4px; font-weight: 500; }
.stat-card .stat-value { font-size: 1.7rem; font-weight: 700; color: var(--text-primary); line-height: 1.1; }
.stat-card .stat-change { font-size: 0.75rem; color: var(--success); margin-top: 4px; }

/* ---- Status Badges ---- */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-approved { background: #D4EDDA; color: #155724; border: 1px solid #C3E6CB; }
.badge-revision { background: #FFF3CD; color: #856404; border: 1px solid #FFEEBA; }
.badge-pending { background: #D1ECF1; color: #0C5460; border: 1px solid #BEE5EB; }
.badge-not-reviewed { background: #E2E3E5; color: #383D41; border: 1px solid #D6D8DB; }
.badge-insufficient { background: #F8D7DA; color: #721C24; border: 1px solid #F5C6CB; }
.badge-sufficient { background: #D4EDDA; color: #155724; border: 1px solid #C3E6CB; }
.badge-active { background: #D4EDDA; color: #155724; }
.badge-inactive { background: #E2E3E5; color: #383D41; }
.badge-published { background: #CCE5E7; color: #0D7377; border: 1px solid #B8DDE0; }
.badge-submitted { background: #D6E4F0; color: #1B4F72; border: 1px solid #C5D9E8; }

/* ---- Tables ---- */
.table-wrapper { overflow-x: auto; }

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

table thead th {
    background: var(--primary-dark);
    color: #fff;
    padding: 12px 16px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    white-space: nowrap;
}

table thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
table thead th:last-child { border-radius: 0 var(--radius-sm) 0 0; }

table tbody td {
    padding: 12px 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

table tbody tr:nth-child(even) { background: var(--bg); }
table tbody tr:hover { background: var(--primary-pale); }

/* ---- Module Placeholder ---- */
.module-placeholder {
    text-align: center;
    padding: 80px 40px;
}

.module-placeholder .module-icon {
    width: 80px;
    height: 80px;
    background: var(--primary-pale);
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.module-placeholder .module-icon svg { width: 40px; height: 40px; color: var(--primary); }

.module-placeholder h2 { font-size: 1.5rem; margin-bottom: 12px; color: var(--primary-dark); }
.module-placeholder p { color: var(--text-secondary); max-width: 500px; margin: 0 auto; }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); transition: var(--transition); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .stat-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

@media (max-width: 768px) {
    .auth-card { padding: 32px 24px; }
    .page-content { padding: 20px 16px; }
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
}
