/**
 * Main Stylesheet - Single Source of Truth
 * @package Dilla_University_Curriculum
 * @version 4.1.0
 */

/* ============================================================
   ROOT VARIABLES
   ============================================================ */
:root {
    /* Primary Colors */
    --primary: #1a202c;
    --primary-light: #2d3748;
    --secondary: #f5a623;
    --secondary-dark: #d69e2e;
    --secondary-light: #fefcf5;
    
    /* Status Colors */
    --success: #38a169;
    --success-light: #c6f6d5;
    --danger: #e53e3e;
    --danger-light: #fed7d7;
    --warning: #f5a623;
    --warning-light: #fefcbf;
    --info: #3182ce;
    --info-light: #bee3f8;
    
    /* Grays */
    --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;
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --header-height: 64px;
    --footer-height: 48px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow: hidden; /* Prevents body scroll */
}

a {
    text-decoration: none;
    color: inherit;
}

/* ============================================================
   FONT AWESOME FALLBACKS
   ============================================================ */
.fas, .far, .fal, .fab, .fa-solid {
    font-family: 'Font Awesome 6 Free', 'Segoe UI', Arial, sans-serif !important;
    display: inline-block !important;
    font-style: normal !important;
    font-variant: normal !important;
    text-rendering: auto !important;
    line-height: 1 !important;
}

.fa-gauge-high:before { content: "📊" !important; }
.fa-book-open:before { content: "📖" !important; }
.fa-cubes:before { content: "🧩" !important; }
.fa-sitemap:before { content: "🗺️" !important; }
.fa-bullseye:before { content: "🎯" !important; }
.fa-check-double:before { content: "✅" !important; }
.fa-file-alt:before { content: "📄" !important; }
.fa-search:before { content: "🔍" !important; }
.fa-folder-open:before { content: "📂" !important; }
.fa-cog:before { content: "⚙️" !important; }
.fa-graduation-cap:before { content: "🎓" !important; }
.fa-bars:before { content: "☰" !important; }
.fa-times:before { content: "✕" !important; }
.fa-chevron-down:before { content: "▼" !important; }
.fa-home:before { content: "🏠" !important; }
.fa-sign-in-alt:before { content: "🔑" !important; }
.fa-sign-out-alt:before { content: "🚪" !important; }
.fa-code-branch:before { content: "🌿" !important; }
.fa-question-circle:before { content: "❓" !important; }
.fa-book:before { content: "📚" !important; }

/* ============================================================
   HEADER - FIXED AT TOP
   ============================================================ */
.site-header {
    width: 100%;
    max-width: 100%;
    background: var(--primary);
    min-height: var(--header-height);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--gray-700);
    left: 0;
    right: 0;
    flex-shrink: 0;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1.5rem;
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    min-height: var(--header-height);
    gap: 0.5rem;
}

.logo-area {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    max-width: 55%;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    min-width: 0;
}

.logo-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    line-height: 1;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    overflow: hidden;
    min-width: 0;
}

.logo-text h1 {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    margin: 0;
    padding: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logo-text span {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 400;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.nav-links a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.nav-links a.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    margin-left: 0.5rem;
}

.user-badge .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--secondary);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.user-badge .user-info .name {
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
}

.user-badge .user-info .role {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.btn-login, .btn-logout {
    color: rgba(255, 255, 255, 0.7) !important;
    padding: 0.4rem 0.75rem !important;
    border-radius: var(--radius-sm) !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    transition: all var(--transition-fast) !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
}

.btn-login:hover, .btn-logout:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

.btn-logout:hover {
    background: rgba(229, 62, 62, 0.2) !important;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
    gap: 4px;
}

.nav-toggle-bar {
    display: block;
    width: 24px;
    height: 2.5px;
    background: #fff;
    border-radius: 2px;
    transition: all var(--transition-fast);
}

.nav-toggle.active .nav-toggle-bar:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.nav-toggle.active .nav-toggle-bar:nth-child(2) {
    opacity: 0;
}
.nav-toggle.active .nav-toggle-bar:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ============================================================
   MAIN WRAPPER - FLEX CONTAINER
   ============================================================ */
.main-wrapper {
    display: flex;
    width: 100%;
    max-width: 100%;
    min-height: calc(100vh - var(--header-height) - var(--footer-height));
    background: var(--gray-50);
    overflow: hidden;
    flex: 1;
}

.main-wrapper.default-layout {
    display: flex;
}

.main-wrapper.public-layout {
    display: block;
}

.main-wrapper.public-layout .sidebar {
    display: none !important;
}

/* ============================================================
   SIDEBAR - FIXED/STICKY ON LEFT
   ============================================================ */
.sidebar {
    width: 280px;
    min-width: 280px;
    max-width: 280px;
    flex: 0 0 280px;
    flex-shrink: 0;
    flex-grow: 0;
    background: #fff;
    border-right: 1px solid var(--gray-200);
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
    padding: 0;
    margin: 0;
}

.sidebar-inner {
    padding: 0.5rem 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem 0.5rem;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.sidebar-brand i {
    color: var(--secondary);
}

.sidebar-close {
    background: none;
    border: none;
    color: var(--gray-400);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem;
}

.sidebar-nav {
    padding: 0 0.5rem;
    flex: 1;
    overflow-y: auto;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-item {
    margin-bottom: 0.125rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius-md);
    color: var(--gray-600);
    text-decoration: none;
    transition: all var(--transition-fast);
    gap: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.sidebar-link:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.sidebar-link.active {
    background: var(--secondary-light);
    color: var(--secondary);
    font-weight: 600;
}

.sidebar-icon {
    font-size: 1rem;
    flex-shrink: 0;
    width: 1.25rem;
    text-align: center;
}

.sidebar-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-arrow {
    font-size: 0.65rem;
    color: var(--gray-400);
    transition: transform var(--transition-fast);
}

.sidebar-link.active .sidebar-arrow {
    transform: rotate(180deg);
}

.sidebar-submenu {
    list-style: none;
    padding: 0;
    margin: 0.125rem 0 0.25rem 0.5rem;
    display: none;
    border-left: 2px solid var(--gray-200);
    padding-left: 0.75rem;
}

.sidebar-submenu.show {
    display: block;
}

.sidebar-sublink {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--gray-500);
    text-decoration: none;
    font-size: 0.8125rem;
    transition: all var(--transition-fast);
    gap: 0.5rem;
}

.sidebar-sublink:hover {
    background: var(--gray-50);
    color: var(--gray-700);
}

.sidebar-sublink.active {
    color: var(--secondary);
    font-weight: 500;
    background: var(--secondary-light);
}

.submenu-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--gray-300);
    flex-shrink: 0;
}

.sidebar-sublink.active .submenu-dot {
    background: var(--secondary);
}

.sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--gray-200);
    margin-top: auto;
    font-size: 0.75rem;
    color: var(--gray-400);
    flex-shrink: 0;
}

.sidebar-footer .sidebar-help a {
    color: var(--gray-400);
    text-decoration: none;
    font-size: 1rem;
}

.sidebar-footer .sidebar-help a:hover {
    color: var(--gray-600);
}

.sidebar-toggle {
    display: none;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.sidebar-overlay.show {
    display: block;
}

/* ============================================================
   MAIN CONTENT - SCROLLABLE
   ============================================================ */
.main-content {
    flex: 1 1 auto;
    width: calc(100% - 280px);
    max-width: calc(100% - 280px);
    min-width: 0;
    padding: 1.5rem 2rem;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--gray-50);
    min-height: calc(100vh - var(--header-height) - var(--footer-height));
    max-height: calc(100vh - var(--header-height) - var(--footer-height));
}

.main-wrapper.public-layout .main-content {
    width: 100%;
    max-width: 100%;
    padding: 1.5rem 2rem;
    max-height: none;
    min-height: calc(100vh - var(--header-height) - var(--footer-height));
}

.main-content .container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ============================================================
   FOOTER - FIXED AT BOTTOM
   ============================================================ */
.site-footer {
    width: 100%;
    max-width: 100%;
    background: var(--primary);
    color: var(--gray-400);
    padding: 0.75rem 0;
    flex-shrink: 0;
    border-top: 1px solid var(--gray-700);
    position: sticky;
    bottom: 0;
    z-index: 100;
    min-height: var(--footer-height);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.footer-copyright {
    font-size: 0.875rem;
}

.footer-divider {
    margin: 0 0.5rem;
    color: var(--gray-600);
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 0;
    font-size: 0.875rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--gray-400);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: #fff;
}

/* ============================================================
   RESPONSIVE: TABLET (1024px and below)
   ============================================================ */
@media (max-width: 1024px) {
    .sidebar {
        width: 72px;
        min-width: 72px;
        max-width: 72px;
        flex: 0 0 72px;
    }
    
    .sidebar .sidebar-label,
    .sidebar .sidebar-arrow,
    .sidebar .sidebar-brand span,
    .sidebar .sidebar-footer .sidebar-version {
        display: none !important;
    }
    
    .sidebar .sidebar-link {
        justify-content: center;
        padding: 12px;
        margin: 0 4px;
    }
    
    .sidebar .sidebar-icon {
        font-size: 1.25rem;
        margin: 0;
    }
    
    .sidebar .sidebar-header {
        justify-content: center;
        padding: 0 4px 8px;
    }
    
    .sidebar .sidebar-footer {
        justify-content: center;
    }
    
    .sidebar .sidebar-footer .sidebar-help {
        display: none;
    }
    
    .sidebar .sidebar-close {
        display: none;
    }
    
    .sidebar .sidebar-submenu {
        display: none !important;
    }
    
    .main-content {
        width: calc(100% - 72px);
        max-width: calc(100% - 72px);
        padding: 1.25rem;
    }
    
    .logo-text h1 {
        font-size: 0.95rem;
    }
    .logo-text span {
        font-size: 0.55rem;
    }
    .logo-icon {
        font-size: 1.3rem;
    }
}

/* ============================================================
   RESPONSIVE: MOBILE (768px and below)
   ============================================================ */
@media (max-width: 768px) {
    .main-wrapper.default-layout {
        display: block;
        overflow: visible;
    }
    
    .sidebar {
        position: fixed;
        top: var(--header-height);
        left: -100%;
        width: 280px;
        min-width: 280px;
        max-width: 280px;
        flex: none;
        height: calc(100vh - var(--header-height));
        transition: left 0.3s ease;
        z-index: 999;
        border-right: none;
        box-shadow: var(--shadow-lg);
        overflow-y: auto;
        position: fixed;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .sidebar.open .sidebar-label,
    .sidebar.open .sidebar-arrow,
    .sidebar.open .sidebar-brand span,
    .sidebar.open .sidebar-footer .sidebar-version {
        display: inline !important;
    }
    
    .sidebar.open .sidebar-link {
        justify-content: flex-start;
        padding: 10px 14px;
        margin: 0 8px;
    }
    
    .sidebar.open .sidebar-icon {
        font-size: 1rem;
    }
    
    .sidebar.open .sidebar-header {
        justify-content: space-between;
        padding: 0 16px 8px;
    }
    
    .sidebar.open .sidebar-footer {
        justify-content: space-between;
    }
    
    .sidebar.open .sidebar-footer .sidebar-help {
        display: inline;
    }
    
    .sidebar.open .sidebar-close {
        display: flex;
    }
    
    .sidebar .sidebar-close {
        display: none;
    }
    
    .sidebar-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        color: #fff;
        font-size: 1.25rem;
        padding: 0.5rem;
        cursor: pointer;
        margin-left: 0.5rem;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    .main-content {
        width: 100% !important;
        max-width: 100% !important;
        padding: 1rem;
        min-height: calc(100vh - var(--header-height) - var(--footer-height));
        max-height: none;
        overflow-y: visible;
    }
    
    .main-wrapper.public-layout .main-content {
        padding: 1rem;
        max-height: none;
    }
    
    .header-inner {
        padding: 0.4rem 1rem;
        min-height: 56px;
    }
    
    .logo-text h1 {
        font-size: 0.8rem;
    }
    .logo-text span {
        font-size: 0.5rem;
    }
    .logo-icon {
        font-size: 1.1rem;
    }
    
    .nav-toggle {
        display: flex;
    }
    
    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--primary);
        padding: 0.5rem 1rem;
        border-top: 1px solid var(--gray-700);
        box-shadow: var(--shadow-lg);
        width: 100%;
        max-height: calc(100vh - var(--header-height));
        overflow-y: auto;
    }
    
    .nav-links.open {
        display: flex;
    }
    
    .nav-links a {
        width: 100%;
        padding: 0.6rem 0.75rem;
        font-size: 0.875rem;
        justify-content: flex-start;
    }
    
    .user-badge {
        width: 100%;
        justify-content: flex-start;
        margin-left: 0;
    }
    
    .btn-login, .btn-logout {
        width: 100%;
        justify-content: flex-start;
    }
    
    .footer-inner {
        flex-direction: column;
        text-align: center;
        padding: 0 1rem;
    }
    
    .footer-links {
        justify-content: center;
    }
    .footer-copyright {
        font-size: 0.75rem;
    }
    .footer-links {
        font-size: 0.75rem;
    }
}

/* ============================================================
   RESPONSIVE: SMALL MOBILE
   ============================================================ */
@media (max-width: 480px) {
    .header-inner {
        padding: 0.3rem 0.75rem;
        min-height: 48px;
    }
    
    .logo-text h1 {
        font-size: 0.65rem;
    }
    .logo-text span {
        font-size: 0.4rem;
    }
    .logo-icon {
        font-size: 0.9rem;
    }
    
    .main-content {
        padding: 0.75rem;
    }
    .main-content .container {
        padding: 0 0.75rem;
    }
    
    .sidebar {
        width: 260px;
        min-width: 260px;
        max-width: 260px;
    }
    
    .footer-inner {
        padding: 0 0.75rem;
    }
    .footer-copyright {
        font-size: 0.65rem;
    }
    .footer-links {
        font-size: 0.65rem;
    }
    .footer-divider {
        margin: 0 0.25rem;
    }
}