﻿/* ==================== CSS Variables ==================== */
:root {
    --primary: #667eea;
    --primary-dark: #5568d3;
    --primary-light: #7c8ff0;
    --secondary: #764ba2;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --dark: #1f2937;
    --gray: #6b7280;
    --light-gray: #f9fafb;
    --border: #e5e7eb;
    --white: #ffffff;
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --topbar-height: 70px;
    --transition-speed: 0.3s;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--light-gray);
    color: var(--dark);
    line-height: 1.6;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* ==================== Sidebar ==================== */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    transition: all var(--transition-speed) ease;
    z-index: 1000;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
}

    .sidebar::-webkit-scrollbar {
        width: 6px;
    }

    .sidebar::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.1);
    }

    .sidebar::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 10px;
    }

        .sidebar::-webkit-scrollbar-thumb:hover {
            background: rgba(255, 255, 255, 0.5);
        }

    /* Collapsed Sidebar */
    .sidebar.collapsed {
        width: var(--sidebar-collapsed-width);
    }

        .sidebar.collapsed .logo-text,
        .sidebar.collapsed .nav-text,
        .sidebar.collapsed .nav-section-title,
        .sidebar.collapsed .quick-access-title,
        .sidebar.collapsed .quick-btn span,
        .sidebar.collapsed .nav-badge {
            opacity: 0;
            display: none;
        }

        .sidebar.collapsed .sidebar-header {
            padding: 1rem 0.5rem;
            flex-direction: column;
            gap: 0.5rem;
        }

        .sidebar.collapsed .quick-access {
            padding: 0.5rem;
        }

        .sidebar.collapsed .quick-access-buttons {
            flex-direction: column;
            gap: 0.5rem;
        }

        .sidebar.collapsed .quick-btn {
            padding: 0.75rem;
            justify-content: center;
        }

        .sidebar.collapsed .nav-item {
            justify-content: center;
            padding: 0.75rem;
        }

        .sidebar.collapsed .nav-section-header {
            justify-content: center;
        }

        .sidebar.collapsed .section-toggle,
        .sidebar.collapsed .section-icon {
            display: none;
        }

/* Sidebar Header */
.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

.logo-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
}

.logo-text {
    flex: 1;
    min-width: 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: 2px;
}

.logo-subtitle {
    font-size: 0.7rem;
    opacity: 0.9;
    margin: 0;
    font-weight: 400;
}

/* Quick Access Section */
.quick-access {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

.quick-access-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
    margin-bottom: 0.75rem;
}

.quick-access-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.quick-btn {
    flex: 1;
    min-width: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.75rem;
    text-align: center;
}

    .quick-btn:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
        color: white;
    }

    .quick-btn i {
        font-size: 1.25rem;
    }

/* Sidebar Navigation */
.sidebar-nav {
    padding: 1rem 0;
}

.nav-section {
    margin-bottom: 0.5rem;
}

.nav-section-title {
    padding: 0.75rem 1.5rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-icon {
    font-size: 0.875rem;
}

/* Collapsible Sections */
.nav-section.collapsible .nav-section-header {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
}

    .nav-section.collapsible .nav-section-header:hover {
        background: rgba(255, 255, 255, 0.1);
    }

.nav-section.collapsible .nav-section-title {
    padding: 0;
    margin: 0;
}

.section-toggle {
    font-size: 0.75rem;
    transition: transform var(--transition-speed) ease;
}

.nav-section.collapsible.active .section-toggle {
    transform: rotate(180deg);
}

.nav-section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-speed) ease;
}

.nav-section.collapsible.active .nav-section-content {
    max-height: 1000px;
}

.nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0.5rem 1.5rem;
}

/* Nav Items */
.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
}

    .nav-item:hover {
        background: rgba(255, 255, 255, 0.15);
        color: white;
    }

    .nav-item.active {
        background: rgba(255, 255, 255, 0.2);
        color: white;
        font-weight: 600;
    }

        .nav-item.active::before {
            content: '';
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            width: 4px;
            background: white;
            border-radius: 0 4px 4px 0;
        }

.nav-item-sm {
    font-size: 0.875rem;
    padding: 0.5rem 1.5rem 0.5rem 2.5rem;
}

.nav-icon {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-badge {
    padding: 0.125rem 0.5rem;
    font-size: 0.7rem;
    border-radius: 10px;
    font-weight: 600;
}

.badge-info {
    background: rgba(59, 130, 246, 0.3);
    color: white;
}

/* Sidebar Footer */
.sidebar-footer {
    position: sticky;
    bottom: 0;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-collapse-btn {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .sidebar-collapse-btn:hover {
        background: rgba(255, 255, 255, 0.2);
    }

/* ==================== Main Content ==================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition-speed) ease;
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* ==================== Topbar ==================== */
.topbar {
    height: var(--topbar-height);
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    background: var(--light-gray);
    border: none;
    border-radius: 8px;
    color: var(--dark);
    cursor: pointer;
    transition: all 0.2s ease;
}

    .menu-toggle:hover {
        background: var(--border);
    }

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray);
    margin: 0.25rem 0 0 0;
}

.breadcrumb-item {
    color: var(--gray);
    text-decoration: none;
    transition: color 0.2s ease;
}

    .breadcrumb-item:hover {
        color: var(--primary);
    }

    .breadcrumb-item.active {
        color: var(--dark);
        font-weight: 500;
    }

.breadcrumb-separator {
    color: var(--border);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Search Box */
.search-box {
    position: relative;
    width: 300px;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
    font-size: 0.875rem;
}

.search-input {
    width: 100%;
    padding: 0.625rem 1rem 0.625rem 2.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

    .search-input:focus {
        outline: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    }

/* Notifications */
.notification-container {
    position: relative;
}

.notification-btn {
    width: 40px;
    height: 40px;
    background: var(--light-gray);
    border: none;
    border-radius: 8px;
    color: var(--dark);
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

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

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    padding: 0.125rem 0.4rem;
    border-radius: 10px;
    font-weight: 600;
}

.notification-panel {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 380px;
    max-height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    z-index: 1000;
}

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

    .notification-header h6 {
        margin: 0;
        font-weight: 600;
    }

.mark-all-read {
    font-size: 0.875rem;
    color: var(--primary);
    text-decoration: none;
}

.notification-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--light-gray);
    transition: background 0.2s ease;
    cursor: pointer;
}

    .notification-item:hover {
        background: var(--light-gray);
    }

    .notification-item.unread {
        background: rgba(102, 126, 234, 0.05);
    }

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .notification-icon.bg-warning {
        background: rgba(245, 158, 11, 0.1);
        color: var(--warning);
    }

    .notification-icon.bg-info {
        background: rgba(59, 130, 246, 0.1);
        color: var(--info);
    }

    .notification-icon.bg-success {
        background: rgba(16, 185, 129, 0.1);
        color: var(--success);
    }

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.notification-text {
    font-size: 0.875rem;
    color: var(--gray);
    margin-bottom: 0.25rem;
}

.notification-time {
    font-size: 0.75rem;
    color: var(--gray);
}

.notification-footer {
    padding: 0.75rem 1.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

    .notification-footer a {
        font-size: 0.875rem;
        color: var(--primary);
        text-decoration: none;
        font-weight: 500;
    }

/* User Menu */
.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--light-gray);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

    .user-menu-btn:hover {
        background: var(--border);
    }

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.user-avatar-placeholder {
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--dark);
}

.user-role {
    font-size: 0.75rem;
    color: var(--gray);
}

.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 200px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    z-index: 1000;
}

    .user-dropdown.show {
        display: block;
    }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: var(--dark);
    text-decoration: none;
    transition: all 0.2s ease;
}

    .dropdown-item:hover {
        background: var(--light-gray);
    }

    .dropdown-item i {
        width: 20px;
        color: var(--gray);
    }

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 0.5rem 0;
}

/* ==================== Content Area ==================== */
.content {
    flex: 1;
    padding: 2rem;
}

/* Footer */
.footer {
    background: white;
    border-top: 1px solid var(--border);
    padding: 1.5rem 2rem;
    margin-top: auto;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.875rem;
    color: var(--gray);
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

    .footer-right a {
        color: var(--gray);
        text-decoration: none;
        transition: color 0.2s ease;
    }

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

.separator {
    color: var(--border);
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

        .sidebar.active {
            transform: translateX(0);
        }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .topbar {
        padding: 0 1rem;
    }

    .search-box {
        display: none;
    }

    .user-info {
        display: none;
    }

    .content {
        padding: 1rem;
    }

    .footer-content {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 1.25rem;
    }

    .breadcrumb {
        display: none;
    }

    .topbar-right {
        gap: 0.5rem;
    }

    .notification-panel,
    .user-dropdown {
        width: calc(100vw - 2rem);
        right: -1rem;
    }
}

/* ==================== Dashboard Specific Styles ==================== */
.dashboard-welcome {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
}

    .dashboard-welcome h3 {
        margin: 0 0 0.5rem 0;
        font-size: 1.75rem;
    }

    .dashboard-welcome p {
        margin: 0;
        opacity: 0.95;
    }

.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    border-left: 4px solid var(--primary);
}

    .stat-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    }

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.stat-card-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

    .stat-card-icon.bg-primary {
        background: rgba(102, 126, 234, 0.1);
        color: var(--primary);
    }

    .stat-card-icon.bg-success {
        background: rgba(16, 185, 129, 0.1);
        color: var(--success);
    }

    .stat-card-icon.bg-warning {
        background: rgba(245, 158, 11, 0.1);
        color: var(--warning);
    }

    .stat-card-icon.bg-info {
        background: rgba(59, 130, 246, 0.1);
        color: var(--info);
    }

.stat-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
}

.stat-card-label {
    color: var(--gray);
    font-size: 0.875rem;
    margin: 0.5rem 0 0 0;
}

.stat-card-change {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

    .stat-card-change.positive {
        color: var(--success);
    }

    .stat-card-change.negative {
        color: var(--danger);
    }

.stat-details {
    flex: 1;
}

.stat-content {
    flex: 1;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.action-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    text-align: center;
    text-decoration: none;
    color: var(--dark);
    transition: all 0.3s ease;
}

    .action-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
        color: var(--primary);
    }

.action-card-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    background: var(--light-gray);
    color: var(--primary);
}

.action-card-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.action-card-description {
    font-size: 0.875rem;
    color: var(--gray);
}

/* ==================== Alerts ==================== */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    display: flex;
    align-items: flex-start;
    margin-bottom: 1rem;
    animation: slideDown 5.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
}

.alert-icon {
    font-size: 1.25rem;
    margin-right: 0.75rem;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

/* ==================== Certificate Components ==================== */
.certificate-item {
    padding: 1.25rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 1rem;
    background: white;
    transition: all 0.2s ease;
}

    .certificate-item:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        border-color: var(--primary);
    }

    .certificate-item:last-child {
        margin-bottom: 0;
    }

.certificate-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.certificate-progress {
    margin-top: 1rem;
}

.progress {
    width: 100%;
    height: 0.625rem;
    background: var(--light-gray);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 10px;
    transition: width 0.3s ease;
    position: relative;
}

    .progress-bar.bg-success {
        background: linear-gradient(90deg, var(--success) 0%, #059669 100%);
    }

    .progress-bar.bg-warning {
        background: linear-gradient(90deg, var(--warning) 0%, #d97706 100%);
    }

    .progress-bar.bg-danger {
        background: linear-gradient(90deg, var(--danger) 0%, #dc2626 100%);
    }

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.progress-stats {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.875rem;
}

    .progress-stats > div {
        display: flex;
        gap: 0.25rem;
    }

    .progress-stats span {
        color: var(--gray);
    }

    .progress-stats strong {
        color: var(--dark);
    }

/* ==================== Additional Stat Card Styles ==================== */
.stat-card.primary {
    border-left: 4px solid var(--primary);
}

.stat-card.success {
    border-left: 4px solid var(--success);
}

.stat-card.warning {
    border-left: 4px solid var(--warning);
}

.stat-card.danger {
    border-left: 4px solid var(--danger);
}

.stat-card.info {
    border-left: 4px solid var(--info);
}
