/* ============================================
   UNIFIED DASHBOARD PATTERN
   Used by: Admin, Tutor, Student Dashboards
   Color Scheme: Premium Deep Purple/Indigo
   ============================================ */

/* ========== CSS VARIABLES (Brand Colors) ========== */
:root {
    --dashboard-primary: #6366f1;
    --dashboard-primary-dark: #4f46e5;
    --dashboard-primary-strong: #4c1d95;
    --dashboard-accent: #a78bfa;
    --dashboard-accent-bright: #c4b5fd;
    --dashboard-sidebar-bg: linear-gradient(165deg, #1e1b4b 0%, #312e81 40%, #4c1d95 100%);
    --dashboard-sidebar-alt: linear-gradient(165deg, #1e1b4b 0%, #3730a3 40%, #5b21b6 100%);
    --dashboard-border: rgba(139, 92, 246, 0.3);
    --dashboard-text-light: rgba(255, 255, 255, 0.95);
    --dashboard-text-lighter: rgba(255, 255, 255, 0.75);
    --dashboard-hover-bg: rgba(139, 92, 246, 0.15);
    --dashboard-active-bg: rgba(139, 92, 246, 0.25);
    --dashboard-main-bg: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 50%, #f8fafc 100%);
    --dashboard-glow: 0 0 20px rgba(139, 92, 246, 0.3);
}

/* ========== DESKTOP & TABLET LAYOUT (1024px+) ========== */
.shell {
    display: flex;
    flex-direction: row;
    width: 100%;
    margin: 0;
    margin-top: 56px;
    padding: 0;
    min-height: calc(100vh - 56px);
}

.shell-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--dashboard-sidebar-bg);
    border-right: none;
    padding: 1.25rem 0;
    height: calc(100vh - 56px);
    overflow: hidden;
    position: sticky;
    top: 56px;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 30px rgba(30, 27, 75, 0.25),
                inset -1px 0 0 rgba(255, 255, 255, 0.05);
    position: relative;
}

/* Animated gradient overlay for shell-sidebar */
.shell-sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 30% 0%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 100%, rgba(59, 130, 246, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.sidebar-title {
    padding: 1rem 1.25rem 0.5rem;
    font-size: 0.65rem;
    font-weight: 700;
    color: rgba(167, 139, 250, 0.8);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin: 0.5rem 0;
    opacity: 1;
    background: transparent;
    border-bottom: none;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.3) 0%, transparent 100%);
}

.sidebar-menu {
    list-style: none;
    padding: 0.5rem 0.625rem;
    margin: 0;
    flex: 1;
    overflow-y: auto;
    max-height: calc(100vh - 120px);
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 92, 246, 0.3) transparent;
    position: relative;
    z-index: 1;
}

.sidebar-menu::-webkit-scrollbar {
    width: 5px;
}

.sidebar-menu::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.3);
    border-radius: 10px;
}

.sidebar-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.5);
}

.sidebar-menu li {
    margin: 0;
    padding: 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    font-size: 0.875rem;
    border-left: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border-radius: 0;
    margin: 3px 0;
}

.sidebar-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(59, 130, 246, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
    border-radius: inherit;
    z-index: -1;
}

.sidebar-link:hover::before {
    opacity: 1;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    border-left-color: transparent;
    padding-left: 0.9rem;
    transform: translateX(4px);
}

.sidebar-link.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.35) 0%, rgba(79, 70, 229, 0.25) 100%);
    color: white;
    border-left-color: transparent;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.sidebar-link.active::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: linear-gradient(180deg, #a78bfa 0%, #818cf8 100%);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px rgba(167, 139, 250, 0.5);
}

.sidebar-link i {
    font-size: 1rem;
    width: 22px;
    text-align: center;
    position: relative;
    z-index: 1;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    color: rgba(167, 139, 250, 0.85);
}

.sidebar-link:hover i {
    transform: scale(1.15);
    color: #a78bfa;
}

.sidebar-link.active i {
    color: #c4b5fd;
}

.shell-main {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    background: var(--dashboard-main-bg);
    position: relative;
    max-width: 100%;
}

/* ========== MOBILE LAYOUT (768px and below) ========== */
@media (max-width: 768px) {
    .shell {
        flex-direction: column;
    }
    
    .shell-main {
        padding: 0.25rem;
    }

    /* Make containers responsive on tablet/mobile */
    .container,
    [style*="max-width"] {
        max-width: 100% !important;
        padding: 0 !important;
    }

    .shell-sidebar {
        width: 280px;
        height: 100vh;
        padding: 0;
        position: fixed;
        left: 0;
        top: 56px;
        display: flex;
        flex-direction: column;
        background: var(--dashboard-sidebar-bg);
        border-right: none;
        border-bottom: none;
        box-shadow: 8px 0 40px rgba(30, 27, 75, 0.4),
                    inset -1px 0 0 rgba(255, 255, 255, 0.05);
        transform: translateX(-100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 998;
        overflow-y: auto;
    }

    .shell-sidebar.active,
    .shell-sidebar.open {
        transform: translateX(0);
    }

    .sidebar-title {
        display: flex;
        padding: 1rem 1.25rem 0.5rem;
        font-size: 0.65rem;
        font-weight: 700;
        color: rgba(167, 139, 250, 0.8);
        text-transform: uppercase;
        letter-spacing: 1.2px;
        margin: 0.5rem 0;
        opacity: 1;
        background: transparent;
        border-bottom: none;
        border-radius: 0;
    }

    .sidebar-menu {
        display: flex;
        flex-direction: column;
        max-height: none;
        overflow-y: auto;
        flex: 1;
        padding: 0.5rem 0.625rem;
    }

    .sidebar-menu li {
        margin: 0;
        padding: 0;
    }

    .sidebar-link {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 0.75rem;
        padding: 0.75rem 0.9rem;
        font-size: 0.875rem;
        border-left: none;
        border-bottom: none;
        font-weight: 500;
        border-radius: 0;
        margin: 3px 0;
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
        overflow: hidden;
        white-space: nowrap;
    }

    .sidebar-link::before {
        opacity: 0;
    }

    .sidebar-link:hover::before {
        opacity: 1;
    }

    .sidebar-link:hover {
        background: rgba(255, 255, 255, 0.08);
        color: white;
        border-left-color: transparent;
        padding-left: 0.9rem;
        transform: translateX(4px);
        box-shadow: none;
    }

    .sidebar-link.active {
        background: linear-gradient(135deg, rgba(139, 92, 246, 0.35) 0%, rgba(79, 70, 229, 0.25) 100%);
        color: #fff;
        border-left-color: transparent;
        font-weight: 600;
        box-shadow: 0 4px 15px rgba(139, 92, 246, 0.2),
                    inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }

    .sidebar-link i {
        font-size: 1rem;
        width: 22px;
        text-align: center;
        flex-shrink: 0;
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        color: rgba(167, 139, 250, 0.85);
    }

    .sidebar-link:hover i {
        transform: scale(1.15);
        color: #a78bfa;
    }
    
    .sidebar-link.active i {
        color: #c4b5fd;
    }

    .shell-main {
        width: 100%;
        padding: 0.5rem 0.25rem;
        flex: 1;
        background: var(--dashboard-main-bg);
    }

    /* Mobile overlay backdrop */
    .shell-sidebar.open::before {
        content: '';
        position: fixed;
        left: 280px;
        top: 56px;
        right: 0;
        bottom: 0;
        background: rgba(15, 23, 42, 0.6);
        backdrop-filter: blur(4px);
        z-index: 997;
        animation: sidebarFadeIn 0.35s ease;
    }

    @keyframes sidebarFadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
}

/* ========== SMALL MOBILE (576px and below) ========== */
@media (max-width: 576px) {
    .shell-main {
        padding: 0.125rem;
    }
    
    /* Override inline padding styles */
    [style*="padding"]:not(.sidebar-link):not(.btn):not(.badge) {
        padding: 0.25rem !important;
    }
    
    .shell-sidebar {
        width: 260px;
    }

    .sidebar-link {
        padding: 0.65rem 0.85rem;
        font-size: 0.82rem;
        gap: 0.65rem;
    }

    .sidebar-link i {
        font-size: 0.95rem;
        width: 20px;
    }

    /* Make containers full width on mobile */
    .container,
    [style*="max-width"] {
        max-width: 100% !important;
        width: 100% !important;
    }
}

/* ========== EXTRA SMALL MOBILE (360px and below) ========== */
@media (max-width: 360px) {
    .shell-sidebar {
        width: 240px;
    }

    .sidebar-link {
        padding: 0.55rem 0.75rem;
        font-size: 0.78rem;
        gap: 0.5rem;
        border-radius: 0;
    }

    .sidebar-link i {
        font-size: 0.9rem;
        width: 18px;
    }

    .shell-main {
        padding: 0.125rem !important;
    }
    
    /* Override inline padding styles on mobile */
    [style*="padding"]:not(.sidebar-link):not(.btn):not(.badge) {
        padding: 0.125rem !important;
    }
}

/* ========== UTILITY CLASSES ========== */
.dashboard-section {
    width: 100%;
}

/* ========== COURSE CARDS (Tutor & Admin Dashboards) ========== */
.course-card {
    background: white;
    border-radius: 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.course-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(99, 102, 241, 0.18);
}

.course-thumb {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

.course-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.course-card:hover .course-thumb img {
    transform: scale(1.05);
}

.course-card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.75rem;
}

.course-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.course-meta-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.course-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: #64748b;
}

.course-meta i {
    color: #6366f1;
    font-size: 0.8rem;
}

.course-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.course-badge {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    border-radius: 0;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.course-badge-success {
    background: #dcfce7;
    color: #15803d;
}

.course-badge-warning {
    background: #fef3c7;
    color: #b45309;
}

.course-badge-muted {
    background: #f1f5f9;
    color: #64748b;
}

.course-badge-danger {
    background: #fee2e2;
    color: #dc2626;
}

.course-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
    flex-wrap: wrap;
}

.course-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    border-radius: 0;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    flex: 1;
    min-width: 80px;
}

.course-btn-primary {
    background: var(--gradient-primary, linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%));
    color: white;
}

.course-btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.course-btn-outline {
    background: white;
    color: #6366f1;
    border: 2px solid #6366f1;
}

.course-btn-outline:hover {
    background: #6366f1;
    color: white;
}

.course-btn-danger {
    background: #ef4444;
    color: white;
}

.course-btn-danger:hover {
    background: #dc2626;
}

@media (max-width: 768px) {
    .course-thumb {
        height: 150px;
    }
    
    .course-card-body {
        padding: 1rem;
    }
    
    .course-title {
        font-size: 1rem;
    }
    
    .course-actions {
        flex-direction: column;
    }
    
    .course-btn {
        width: 100%;
    }
}
