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

:root {
    --primary-color: #f05a28;
    --primary-hover: #d04316;
    --secondary-color: #fef6f2;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --sidebar-width: 280px;
    --border-radius: 16px;
    --transition: all 0.3s ease;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
}

body {
    background-color: var(--bg-color);
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

/* Primary Button Override */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(240, 90, 40, 0.2);
    transition: var(--transition);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(240, 90, 40, 0.3);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

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

/* Sidebar Styling */
.sidebar-wrapper {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    padding: 1.5rem;
    z-index: 1000;
}

.sidebar-inner {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    height: 100%;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-brand {
    padding: 2rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.sidebar-brand h3 {
    margin: 0;
    color: var(--primary-color);
    font-weight: 800;
    letter-spacing: -0.5px;
}

.sidebar-brand span {
    color: var(--text-main);
}

.sidebar-menu {
    padding: 1.5rem 1rem;
    flex-grow: 1;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    margin-bottom: 0.5rem;
    transition: var(--transition);
}

.sidebar-menu a i {
    width: 24px;
    font-size: 1.1rem;
    margin-right: 12px;
    transition: var(--transition);
}

.sidebar-menu a:hover {
    background-color: var(--bg-color);
    color: var(--primary-color);
    transform: translateX(5px);
}

.sidebar-menu a.active {
    background-color: var(--secondary-color);
    color: var(--primary-color);
    font-weight: 600;
}

.sidebar-menu a.active i {
    transform: scale(1.1);
}

.sidebar-footer {
    padding: 1.5rem 1rem;
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    color: #ef4444;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    background-color: #fef2f2;
    transition: var(--transition);
}

.sidebar-footer a:hover {
    background-color: #fee2e2;
}

/* Main Content Layout */
.main-wrapper {
    margin-left: var(--sidebar-width);
    padding: 2rem 3rem;
    min-height: 100vh;
    padding-top: 100px;
}

/* Cards */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    background: var(--card-bg);
}

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

.card-header {
    background-color: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    padding: 1.5rem;
}

.card-body {
    padding: 1.5rem;
}

/* Inputs */
.form-control,
.form-select {
    border-radius: 10px;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    background-color: #f8fafc;
    transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
    background-color: #ffffff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(240, 90, 40, 0.1);
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table th {
    font-weight: 600;
    color: var(--text-muted);
    /* text-transform: uppercase; */
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    border-bottom: none;
    padding: 1rem;
}

.table td {
    padding: 1.25rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background-color: var(--bg-color);
}

/* Stats Card Specific */
.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card .icon-bg {
    position: absolute;
    right: -10px;
    bottom: -20px;
    font-size: 6rem;
    opacity: 0.05;
    transform: rotate(-15deg);
    transition: var(--transition);
}

.stat-card:hover .icon-bg {
    transform: rotate(0) scale(1.1);
}

/* Avatar Placeholder */
.avatar-placeholder {
    background: linear-gradient(135deg, var(--primary-color) 0%, #ff8a65 100%);
    color: white;
}

/* =============================================
   INSTRUCTOR TOPBAR AVATAR POPUP
   ============================================= */
.inst-topbar {
    position: fixed;
    top: 1.25rem;
    right: 1.5rem;
    z-index: 1100;
}

.inst-avatar-menu {
    position: relative;
}

.inst-avatar-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #ffffff;
    border-radius: 50px;
    padding: 6px 14px 6px 6px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s, transform 0.2s;
    user-select: none;
}

.inst-avatar-toggle:hover {
    box-shadow: 0 6px 20px rgba(240, 90, 40, 0.18);
    transform: translateY(-1px);
}

.inst-avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    flex-shrink: 0;
}

.inst-avatar-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, #ff8a65 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(240, 90, 40, 0.3);
}

.inst-avatar-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-main);
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inst-avatar-arrow {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

/* Dropdown Panel */
.inst-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 240px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.14), 0 4px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.06);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.inst-dropdown--open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.inst-dropdown-header {
    padding: 14px 16px 12px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #ff8a65 100%);
}

.inst-dropdown-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inst-dropdown-email {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.inst-dropdown-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.05);
    margin: 4px 0;
}

.inst-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.inst-dropdown-item i {
    width: 18px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: color 0.15s;
}

.inst-dropdown-item:hover {
    background: var(--secondary-color);
    color: var(--primary-color);
}

.inst-dropdown-item:hover i {
    color: var(--primary-color);
}

.inst-dropdown-item--active {
    background: var(--secondary-color);
    color: var(--primary-color);
    font-weight: 600;
}

.inst-dropdown-item--active i {
    color: var(--primary-color);
}

.inst-dropdown-item--danger {
    color: #ef4444;
}

.inst-dropdown-item--danger i {
    color: #ef4444;
}

.inst-dropdown-item--danger:hover {
    background: #fef2f2;
    color: #dc2626;
}

/* =============================================
   MOBILE RESPONSIVENESS
   ============================================= */
@media (max-width: 991.98px) {
    .sidebar-wrapper {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
    }

    .sidebar-wrapper.sidebar-open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .main-wrapper {
        margin-left: 0;
        padding: 5rem 1rem 2rem 1rem;
        /* Extra top padding for mobile topbar */
    }

    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 1.25rem;
        left: 1rem;
        z-index: 1100;
        background: #ffffff;
        border: 1px solid rgba(0, 0, 0, 0.06);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        border-radius: 10px;
        width: 44px;
        height: 44px;
        cursor: pointer;
        color: var(--text-main);
        font-size: 1.25rem;
        transition: transform 0.2s;
    }

    .mobile-menu-toggle:active {
        transform: scale(0.95);
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(15, 23, 42, 0.4);
        backdrop-filter: blur(2px);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }

    .inst-topbar {
        right: 1rem;
    }

    /* Stats cards mobile fix */
    .stat-card {
        margin-bottom: 1rem;
    }
}

@media (min-width: 992px) {
    .mobile-menu-toggle {
        display: none !important;
    }

    .sidebar-overlay {
        display: none !important;
    }
}