/**
 * Tarush Class - Core SaaS Design System
 * Responsive, Mobile-First, Modern Education Platform
 */

:root {
    --brand-primary: #4f46e5;
    --brand-primary-hover: #4338ca;
    --brand-secondary: #0ea5e9;
    --brand-accent: #8b5cf6;
    --brand-success: #10b981;
    --brand-warning: #f59e0b;
    --brand-danger: #ef4444;
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --bottom-nav-height: 64px;
    --font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-bs-theme="dark"] {
    --brand-primary: #6366f1;
    --brand-primary-hover: #4f46e5;
    --bs-body-bg: #0f172a;
    --bs-body-color: #f8fafc;
    --bs-border-color: #1e293b;
    --bs-card-bg: #1e293b;
    --bs-tertiary-bg: #0f172a;
}

/* Base & Typography */
body {
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6, .navbar-brand {
    font-family: var(--font-heading);
}

.text-gradient {
    background: linear-gradient(135deg, #4f46e5 0%, #0ea5e9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-icon-box {
    width: 38px;
    height: 38px;
    font-size: 1.25rem;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

/* Micro Font Sizes */
.fs-7 { font-size: 0.875rem !important; }
.fs-8 { font-size: 0.775rem !important; }
.fs-9 { font-size: 0.700rem !important; }

/* Dashboard Layout */
.dashboard-wrapper {
    display: flex;
    min-height: calc(100vh - var(--topbar-height));
}

.sidebar-desktop {
    width: var(--sidebar-width);
    flex-shrink: 0;
    min-height: calc(100vh - var(--topbar-height));
    position: sticky;
    top: var(--topbar-height);
    height: calc(100vh - var(--topbar-height));
    overflow-y: auto;
}

.main-content {
    flex-grow: 1;
    padding: 1.5rem;
    max-width: 100%;
    overflow-x: hidden;
}

@media (max-width: 991.98px) {
    .main-content {
        padding: 1rem;
        padding-bottom: calc(var(--bottom-nav-height) + 1.5rem);
    }
}

/* Sidebar Nav Items */
.sidebar-content .nav-link {
    color: var(--bs-secondary-color);
    font-weight: 500;
    transition: all 0.2s ease-in-out;
    margin: 2px 12px;
}

.sidebar-content .nav-link:hover {
    color: var(--brand-primary);
    background-color: rgba(79, 70, 229, 0.08);
}

.sidebar-content .nav-link.active {
    color: #ffffff;
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-accent) 100%);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.sidebar-content .nav-link.active i {
    color: #ffffff !important;
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
    height: var(--bottom-nav-height);
    z-index: 1030;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--bs-secondary-color);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 8px;
    transition: color 0.15s ease;
}

.bottom-nav-item i {
    font-size: 1.35rem;
    line-height: 1;
    margin-bottom: 2px;
}

.bottom-nav-item.active {
    color: var(--brand-primary);
    font-weight: 700;
}

.bottom-nav-item.pulse-highlight i {
    color: var(--brand-danger);
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.18); }
    100% { transform: scale(1); }
}

/* UI Cards & Shadows */
.stat-card {
    border: 1px solid var(--bs-border-color);
    border-radius: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.07), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

/* Avatar Helpers */
.avatar-circle-sm {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
}

.avatar-circle-md {
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
}

.avatar-circle-lg {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
}

/* Join Class Hero Button */
.btn-join-class {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    font-weight: 700;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
    transition: all 0.2s ease;
    border: none;
}

.btn-join-class:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    transform: scale(1.03);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.45);
}

/* Responsive Table & Mobile Data Cards System */
.table-responsive {
    border-radius: 0.75rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive::-webkit-scrollbar {
    height: 6px;
}
.table-responsive::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.18);
    border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

@media (max-width: 767.98px) {
    /* Container optimizations on mobile */
    .table-responsive:has(.table-mobile-cards) {
        overflow-x: visible;
        background: transparent !important;
    }
    .card:has(.table-mobile-cards) {
        background: transparent !important;
        box-shadow: none !important;
        border: none !important;
    }
    .card:has(.table-mobile-cards) > .table-responsive {
        overflow-x: visible;
    }
    .card:has(.table-mobile-cards) > .card-header {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        background: transparent !important;
    }

    /* Transform Table to Native Mobile Cards */
    table.table-mobile-cards,
    table.table-mobile-cards tbody,
    table.table-mobile-cards tfoot {
        display: block;
        width: 100%;
        border: none;
    }

    table.table-mobile-cards thead {
        display: none !important;
    }

    table.table-mobile-cards tbody tr {
        display: block;
        background: var(--bs-body-bg, #ffffff);
        border: 1px solid var(--bs-border-color, #e2e8f0);
        border-radius: 1rem;
        padding: 1.1rem;
        margin-bottom: 1rem;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
        position: relative;
        transition: transform 0.15s ease, box-shadow 0.15s ease;
    }

    table.table-mobile-cards tbody tr:active {
        transform: scale(0.995);
    }

    [data-bs-theme="dark"] table.table-mobile-cards tbody tr {
        background: var(--bs-card-bg, #1e293b);
        border-color: var(--bs-border-color, #334155);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    }

    /* Live class card glow on mobile */
    table.table-mobile-cards tbody tr.table-danger {
        border: 2px solid #ef4444 !important;
        background: rgba(239, 68, 68, 0.03) !important;
        box-shadow: 0 4px 20px rgba(239, 68, 68, 0.15) !important;
    }
    [data-bs-theme="dark"] table.table-mobile-cards tbody tr.table-danger {
        background: rgba(239, 68, 68, 0.08) !important;
    }

    /* Each TD becomes a clean flex key-value row */
    table.table-mobile-cards tbody td {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        padding: 0.55rem 0 !important;
        border: none !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
        text-align: right !important;
        font-size: 0.85rem;
    }

    [data-bs-theme="dark"] table.table-mobile-cards tbody td {
        border-bottom-color: rgba(255, 255, 255, 0.07) !important;
    }

    /* Left-side Label using data-label attribute */
    table.table-mobile-cards tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.725rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: var(--bs-secondary-color, #64748b);
        text-align: left;
        margin-right: 0.75rem;
        flex-shrink: 0;
    }

    /* Primary Title / Header in Card */
    table.table-mobile-cards tbody td.mobile-card-header {
        display: block !important;
        text-align: left !important;
        padding: 0 0 0.75rem 0 !important;
        margin-bottom: 0.35rem;
        border-bottom: 2px solid var(--bs-border-color) !important;
    }
    table.table-mobile-cards tbody td.mobile-card-header::before {
        display: none !important;
    }
    table.table-mobile-cards tbody td.mobile-card-header .fw-bold {
        font-size: 1rem !important;
        line-height: 1.35;
    }

    /* Action Buttons in Card */
    table.table-mobile-cards tbody td.mobile-card-actions {
        display: block !important;
        border-top: 1px dashed var(--bs-border-color) !important;
        border-bottom: none !important;
        padding: 0.85rem 0 0 0 !important;
        margin-top: 0.5rem;
        text-align: stretch !important;
    }
    table.table-mobile-cards tbody td.mobile-card-actions::before {
        display: none !important;
    }
    table.table-mobile-cards tbody td.mobile-card-actions .btn {
        width: 100%;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-weight: 600;
        font-size: 0.875rem;
        border-radius: 0.6rem;
    }
    table.table-mobile-cards tbody td.mobile-card-actions .d-inline-flex {
        display: flex !important;
        width: 100%;
        gap: 0.5rem;
        justify-content: stretch;
    }
    table.table-mobile-cards tbody td.mobile-card-actions .d-inline-flex .btn {
        flex: 1;
    }
    table.table-mobile-cards tbody td.mobile-card-actions .d-inline-flex form {
        flex: 1;
        display: flex;
        margin: 0;
    }
    table.table-mobile-cards tbody td.mobile-card-actions .d-inline-flex form .btn {
        width: 100%;
    }
    table.table-mobile-cards tbody td.mobile-card-actions .btn-icon-only {
        flex: 0 0 44px !important;
        width: 44px !important;
        padding: 0 !important;
    }
    table.table-mobile-cards tbody td.mobile-card-actions form:has(.btn-icon-only) {
        flex: 0 0 44px !important;
        max-width: 44px !important;
    }

    /* Empty state handling */
    table.table-mobile-cards tbody td[colspan] {
        display: block !important;
        text-align: center !important;
        padding: 3rem 1rem !important;
        border: none !important;
        background: transparent !important;
    }
    table.table-mobile-cards tbody td[colspan]::before {
        display: none !important;
    }
    table.table-mobile-cards tbody tr:has(td[colspan]) {
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
        padding: 0 !important;
    }
}


/* Landing Page Specific */
.landing-hero {
    padding: 5rem 0 4rem;
    background: radial-gradient(circle at top right, rgba(79, 70, 229, 0.08) 0%, transparent 60%);
}

.feature-box {
    padding: 2rem;
    border-radius: 1rem;
    transition: all 0.2s ease;
    border: 1px solid var(--bs-border-color);
}

.feature-box:hover {
    border-color: var(--brand-primary);
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(79, 70, 229, 0.08);
}
