/* ==========================================================================
   Homemade Dashboard — Full-page cooking/learning dashboard
   Replicates the Stitch "Mobile Landing - Live Avatars Row" design
   ========================================================================== */

/* ---------- Design Tokens ---------- */
:root {
    --hd-primary: #aa19e6;
    --hd-primary-10: rgba(170, 25, 230, 0.1);
    --hd-primary-20: rgba(170, 25, 230, 0.2);
    --hd-bg-dark: #1c1121;
    --hd-card-dark: #1e293b;
    --hd-border-dark: #334155;
    --hd-text: #f1f5f9;
    --hd-text-muted: #94a3b8;
    --hd-sidebar-bg: #0f172a;
    --hd-header-bg: rgba(15, 23, 42, 0.8);
    --hd-radius: 1rem;
    --hd-radius-sm: 0.5rem;
    --hd-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --hd-font: 'Inter', sans-serif;
}

/* ---------- Reset for Dashboard Container ---------- */
.hd-wrap {
    font-family: var(--hd-font);
    color: var(--hd-text);
    background: var(--hd-bg-dark);
    display: flex;
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.hd-wrap *,
.hd-wrap *::before,
.hd-wrap *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ---------- Sidebar ---------- */
.hd-sidebar {
    width: 260px;
    border-right: 1px solid var(--hd-border-dark);
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    background: var(--hd-sidebar-bg);
    z-index: 40;
    flex-shrink: 0;
    transition: transform var(--hd-transition);
}

.hd-sidebar-logo {
    padding: 1.5rem;
}

.hd-sidebar-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--hd-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hd-sidebar-logo h1 .material-symbols-outlined {
    font-size: 1.875rem;
}

/* Nav links */
.hd-sidebar-nav {
    flex: 1;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow-y: auto;
}

.hd-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    color: var(--hd-text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background var(--hd-transition), color var(--hd-transition);
}

.hd-nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--hd-text);
}

.hd-nav-link.active {
    background: var(--hd-primary-10);
    color: var(--hd-primary);
    font-weight: 700;
}

.hd-nav-link.active .material-symbols-outlined {
    font-variation-settings: 'FILL' 1;
}

/* Collections */
.hd-nav-section-title {
    padding: 2rem 1rem 0.75rem;
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: var(--hd-text-muted);
}

/* User profile at bottom */
.hd-sidebar-user {
    padding: 1rem;
    border-top: 1px solid var(--hd-border-dark);
}

.hd-sidebar-user-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.5rem;
    border-radius: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--hd-text);
    transition: background var(--hd-transition);
}

.hd-sidebar-user-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.hd-user-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: 1px solid var(--hd-border-dark);
    overflow: hidden;
    flex-shrink: 0;
}

.hd-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hd-sidebar-user-info {
    text-align: left;
}

.hd-sidebar-user-info .name {
    font-size: 0.875rem;
    font-weight: 700;
}

.hd-sidebar-user-info .role {
    font-size: 0.625rem;
    color: var(--hd-text-muted);
}

/* ---------- Mobile Hamburger ---------- */
.hd-menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 60;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    background: var(--hd-sidebar-bg);
    border: 1px solid var(--hd-border-dark);
    color: var(--hd-text);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.hd-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 35;
}

/* ---------- Main Content ---------- */
.hd-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
    overflow-y: auto;
}

/* ---------- Header ---------- */
.hd-header {
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    background: var(--hd-header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid var(--hd-border-dark);
    gap: 1.5rem;
}

.hd-search {
    flex: 1;
    max-width: 32rem;
    position: relative;
}

.hd-search .material-symbols-outlined {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--hd-text-muted);
    font-size: 1.25rem;
    transition: color var(--hd-transition);
}

.hd-search input {
    width: 100%;
    background: var(--hd-card-dark);
    border: none;
    border-radius: 9999px;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    color: var(--hd-text);
    font-size: 0.875rem;
    font-family: var(--hd-font);
    outline: none;
    transition: box-shadow var(--hd-transition);
}

.hd-search input::placeholder {
    color: var(--hd-text-muted);
}

.hd-search input:focus {
    box-shadow: 0 0 0 2px var(--hd-primary-20);
}

.hd-search input:focus~.material-symbols-outlined {
    color: var(--hd-primary);
}

.hd-header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Stats */
.hd-stats {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.hd-stat {
    text-align: right;
}

.hd-stat:last-child {
    text-align: left;
}

.hd-stat-label {
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--hd-text-muted);
}

.hd-stat-value {
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1;
}

.hd-stat-divider {
    width: 1px;
    height: 2rem;
    background: var(--hd-border-dark);
}

/* Notification button */
.hd-notif-btn {
    position: relative;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--hd-card-dark);
    border: none;
    color: #cbd5e1;
    cursor: pointer;
    transition: background var(--hd-transition);
}

.hd-notif-btn:hover {
    background: #334155;
}

.hd-notif-dot {
    position: absolute;
    top: 0.625rem;
    right: 0.625rem;
    width: 0.5rem;
    height: 0.5rem;
    background: var(--hd-primary);
    border-radius: 50%;
    border: 2px solid var(--hd-sidebar-bg);
}

/* New Story button */
.hd-new-story-btn {
    padding: 0.5rem 1.25rem;
    background: var(--hd-primary);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 700;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    font-family: var(--hd-font);
    box-shadow: 0 4px 16px rgba(170, 25, 230, 0.2);
    transition: transform var(--hd-transition);
}

.hd-new-story-btn:hover {
    transform: scale(1.05);
}

/* ---------- Main Content Area ---------- */
.hd-content {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Section headers */
.hd-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.hd-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.hd-section-link {
    color: var(--hd-primary);
    font-size: 0.875rem;
    font-weight: 700;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--hd-font);
}

.hd-section-link:hover {
    text-decoration: underline;
}

/* ---------- Continue Learning ---------- */
.hd-top-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.hd-course-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.hd-course-card {
    background: var(--hd-card-dark);
    border-radius: var(--hd-radius);
    padding: 1rem;
    border: 1px solid var(--hd-border-dark);
    display: flex;
    gap: 1rem;
    cursor: pointer;
    transition: box-shadow var(--hd-transition);
}

.hd-course-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.hd-course-thumb {
    width: 5rem;
    height: 5rem;
    border-radius: 0.75rem;
    overflow: hidden;
    flex-shrink: 0;
}

.hd-course-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.hd-course-card:hover .hd-course-thumb img {
    transform: scale(1.1);
}

.hd-course-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hd-course-name {
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.3;
}

.hd-course-instructor {
    font-size: 0.75rem;
    color: var(--hd-text-muted);
    margin-top: 0.25rem;
}

.hd-progress-label {
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--hd-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.375rem;
}

.hd-progress-track {
    width: 100%;
    height: 0.375rem;
    background: #334155;
    border-radius: 9999px;
    overflow: hidden;
}

.hd-progress-fill {
    height: 100%;
    background: var(--hd-primary);
    border-radius: 9999px;
    transition: width 0.6s ease;
}

/* ---------- Live Sessions ---------- */
.hd-live-card {
    background: var(--hd-card-dark);
    border-radius: var(--hd-radius);
    padding: 1.5rem;
    border: 1px solid var(--hd-border-dark);
}

.hd-live-row {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding: 0.5rem 0;
}

/* No scrollbar */
.hd-live-row::-webkit-scrollbar {
    display: none;
}

.hd-live-row {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.hd-live-item {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.hd-live-item:hover .hd-live-avatar-ring {
    transform: scale(1.05);
}

.hd-live-avatar-wrap {
    position: relative;
}

.hd-live-avatar-ring {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    border: 2px solid var(--hd-primary);
    padding: 2px;
    transition: transform var(--hd-transition);
}

.hd-live-avatar-ring img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.hd-live-badge {
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    background: #dc2626;
    color: #fff;
    font-size: 0.5rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 2px;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.hd-live-name {
    font-size: 0.688rem;
    font-weight: 600;
}

/* ---------- Featured Courses ---------- */
.hd-bottom-grid {
    display: grid;
    grid-template-columns: 8fr 4fr;
    gap: 2rem;
}

.hd-featured-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.hd-badge {
    background: var(--hd-primary-10);
    color: var(--hd-primary);
    font-size: 0.625rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-weight: 700;
}

.hd-featured-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.hd-featured-card {
    background: var(--hd-card-dark);
    border-radius: var(--hd-radius);
    overflow: hidden;
    border: 1px solid var(--hd-border-dark);
    cursor: pointer;
    transition: box-shadow var(--hd-transition);
}

.hd-featured-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.hd-featured-img {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #1e293b;
}

.hd-featured-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s ease;
}

.hd-featured-card:hover .hd-featured-img img {
    transform: scale(1.1);
}

.hd-featured-level {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: rgba(15, 23, 42, 0.95);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    z-index: 2;
}

.hd-featured-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    transition: background var(--hd-transition);
}

.hd-featured-card:hover .hd-featured-overlay {
    background: rgba(0, 0, 0, 0.4);
}

.hd-featured-play {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.9);
    opacity: 0;
    transition: opacity var(--hd-transition);
    z-index: 2;
}

.hd-featured-card:hover .hd-featured-play {
    opacity: 1;
}

.hd-featured-play .material-symbols-outlined {
    color: var(--hd-primary);
    font-size: 1.125rem;
}

.hd-featured-body {
    padding: 1rem;
}

.hd-featured-title {
    font-weight: 700;
    font-size: 0.875rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    transition: color var(--hd-transition);
}

.hd-featured-card:hover .hd-featured-title {
    color: var(--hd-primary);
}

.hd-featured-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--hd-text-muted);
    font-size: 0.75rem;
}

.hd-featured-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.hd-featured-meta .material-symbols-outlined {
    font-size: 0.875rem;
}

/* ---------- Recent Stories ---------- */
.hd-stories-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.hd-story-card {
    aspect-ratio: 3 / 4;
    border-radius: var(--hd-radius);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    padding: 2px;
    border: 2px solid var(--hd-border-dark);
}

.hd-story-card.seen {
    border-color: var(--hd-border-dark);
}

.hd-story-card.unseen {
    border-color: rgba(170, 25, 230, 0.5);
}

.hd-story-inner {
    width: 100%;
    height: 100%;
    border-radius: 0.75rem;
    overflow: hidden;
    position: relative;
}

.hd-story-inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.hd-story-card:hover .hd-story-inner img {
    transform: scale(1.1);
}

.hd-story-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent, transparent);
}

.hd-story-label {
    position: absolute;
    bottom: 0.5rem;
    left: 0.5rem;
    right: 0.5rem;
    font-size: 0.625rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hd-story-more {
    border-color: var(--hd-border-dark);
    opacity: 0.6;
    transition: opacity var(--hd-transition);
}

.hd-story-more:hover {
    opacity: 1;
}

.hd-story-more .hd-story-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--hd-card-dark);
}

.hd-story-more .hd-story-inner .material-symbols-outlined {
    color: var(--hd-text-muted);
    font-size: 1.5rem;
}

.hd-story-more .hd-story-label {
    text-align: center;
    color: var(--hd-text-muted);
}

/* ---------- Explore Categories ---------- */
.hd-cats-folders-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.hd-cats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.hd-cat-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--hd-card-dark);
    border-radius: var(--hd-radius);
    border: 1px solid var(--hd-border-dark);
    color: var(--hd-text);
    cursor: pointer;
    font-family: var(--hd-font);
    transition: border-color var(--hd-transition);
}

.hd-cat-btn:hover {
    border-color: rgba(170, 25, 230, 0.3);
}

.hd-cat-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.hd-cat-icon.purple {
    background: var(--hd-primary-10);
    color: var(--hd-primary);
}

.hd-cat-icon.orange {
    background: rgba(251, 146, 60, 0.15);
    color: #f97316;
}

.hd-cat-icon.green {
    background: rgba(52, 211, 153, 0.15);
    color: #10b981;
}

.hd-cat-name {
    font-weight: 700;
    font-size: 0.875rem;
}

/* ---------- Folders ---------- */
.hd-folder-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.hd-folder-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--hd-card-dark);
    padding: 1rem;
    border-radius: var(--hd-radius);
    border: 1px solid var(--hd-border-dark);
    cursor: pointer;
    transition: box-shadow var(--hd-transition);
}

.hd-folder-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.hd-folder-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--hd-transition);
}

.hd-folder-item:hover .hd-folder-icon {
    transform: scale(1.1);
}

.hd-folder-icon.purple {
    background: var(--hd-primary-10);
    color: var(--hd-primary);
}

.hd-folder-icon.orange {
    background: rgba(251, 146, 60, 0.15);
    color: #f97316;
}

.hd-folder-info {
    flex: 1;
}

.hd-folder-name {
    font-weight: 700;
    font-size: 0.875rem;
}

.hd-folder-meta {
    font-size: 0.625rem;
    color: var(--hd-text-muted);
    font-weight: 500;
}

.hd-folder-arrow {
    color: #475569;
    transition: color var(--hd-transition);
}

.hd-folder-item:hover .hd-folder-arrow {
    color: var(--hd-primary);
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

/* Large desktops */
@media (max-width: 1280px) {
    .hd-stats {
        display: none;
    }

    .hd-featured-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tablets */
@media (max-width: 1024px) {
    .hd-top-grid {
        grid-template-columns: 1fr;
    }

    .hd-bottom-grid {
        grid-template-columns: 1fr;
    }

    .hd-cats-folders-grid {
        grid-template-columns: 1fr;
    }

    .hd-cats-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .hd-stories-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Mobile */
@media (max-width: 768px) {
    .hd-menu-toggle {
        display: flex;
    }

    .hd-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
    }

    .hd-sidebar.open {
        transform: translateX(0);
    }

    .hd-overlay.active {
        display: block;
    }

    .hd-header {
        padding: 0 1rem 0 3.5rem;
    }

    .hd-new-story-btn span.btn-text {
        display: none;
    }

    .hd-content {
        padding: 1rem;
    }

    .hd-course-cards {
        grid-template-columns: 1fr;
    }

    .hd-featured-grid {
        grid-template-columns: 1fr;
    }

    .hd-stories-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .hd-cats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .hd-stories-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hd-cats-grid {
        grid-template-columns: 1fr;
    }
}