/* layout.css */

/* ═══════════════════════════════════
   Desktop: Rail Sidebar
═══════════════════════════════════ */
.app-container {
    display: flex;
    width: 100%;
    height: 100%;
    position: relative;
}

/* Rail (بسته) */
.sidebar {
    width: 64px;
    background: var(--bg-card);
    border-left: 2px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 16px 8px;
    z-index: 100;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

/* باز شده */
.sidebar:hover,
.sidebar.expanded,
.sidebar.pinned {
    width: 280px;
}

/* Brand */
.brand {
    font-size: 18px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-start;
    padding: 0 4px;
    white-space: nowrap;
    overflow: hidden;
}

.brand-text {
    opacity: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.sidebar:hover .brand-text,
.sidebar.expanded .brand-text,
.sidebar.pinned .brand-text {
    opacity: 1;
}

/* Theme toggle در brand */
.brand-controls {
    margin-right: auto;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.sidebar:hover .brand-controls,
.sidebar.expanded .brand-controls,
.sidebar.pinned .brand-controls {
    opacity: 1;
}

/* استایل دکمه پین */
.pin-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.pin-btn:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.sidebar.pinned .pin-btn {
    color: var(--primary);
    transform: rotate(45deg); /* آیکون کج می‌شود تا حس پین شدن بدهد */
}

.pin-btn svg {
    width: 16px;
    height: 16px;
}

/* Nav Links */
.sidebar nav {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    margin-bottom: 10px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 4px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    border: var(--border-px) solid transparent;
    transition: var(--transition);
    white-space: nowrap;
    overflow: hidden;
    position: relative;
}

.nav-link svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.nav-link-text {
    opacity: 0;
    transition: opacity 0.15s;
    overflow: hidden;
}

.sidebar:hover .nav-link-text,
.sidebar.expanded .nav-link-text,
.sidebar.pinned .nav-link-text {
    opacity: 1;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.nav-link.active {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: var(--primary);
}

/* Sidebar Section Labels */
.sidebar-section-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: bold;
    padding: 0 12px;
    margin: 12px 0 6px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
    overflow: hidden;
}

.sidebar:hover .sidebar-section-label,
.sidebar.expanded .sidebar-section-label,
.sidebar.pinned .sidebar-section-label {
    opacity: 1;
}

/* بخش کلاس‌های من - اسکرول‌پذیر */
.sidebar-courses-section {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
    overflow: hidden;
}

.sidebar-courses-list {
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.sidebar-courses-list::-webkit-scrollbar {
    width: 4px;
}

.sidebar-courses-list::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-courses-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

/* اسکرول‌بار فقط وقتی sidebar باز است نمایش داده شود */
.sidebar:not(:hover):not(.expanded):not(.pinned) .sidebar-courses-list {
    overflow-y: hidden;
}

/* دکمه ایجاد کلاس */
.btn-create-course {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: 16px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    transition: var(--transition);
    width: 100%;
}

.btn-create-course:hover {
    background: var(--primary-dark, #2563eb);
}

.btn-create-course svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.btn-create-course .btn-text {
    opacity: 0;
    transition: opacity 0.15s;
}

.sidebar:hover .btn-create-course .btn-text,
.sidebar.expanded .btn-create-course .btn-text,
.sidebar.pinned .btn-create-course .btn-text {
    opacity: 1;
}

/* Sidebar Footer */
.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.sidebar-user {
    font-size: 12px;
    color: var(--text-muted);
    padding: 6px 12px;
    white-space: nowrap;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.2s;
}

.sidebar:hover .sidebar-user,
.sidebar.expanded .sidebar-user,
.sidebar.pinned .sidebar-user {
    opacity: 1;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.top-header {
    padding: 20px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-direction: row !important;
}

.controls {
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: center;
}

.content-area {
    position: relative;
    padding: 0px 32px 32px;
    overflow-y: auto;
    flex: 1;
}

/* دکمه بازگشت موبایل - پیش‌فرض مخفی */
.mobile-back-btn {
    display: none;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
}


/* ═══════════════════════════════════
   Mobile: Bottom Navbar
═══════════════════════════════════ */
.bottom-navbar {
    display: none; /* فقط موبایل */
}

#mobile-panel {
    width: 100% !important;
            flex: 1;
            overflow-y: auto !important; 
            height: 100vh;
            -webkit-overflow-scrolling: touch; /* برای روانی اسکرول در موبایل */

}

.hidden {
    display: none !important;
}



/* Sidebar Footer Actions (Settings & Logout) */
.footer-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    /* در حالت پیش‌فرض (سایدبار بسته) مخفی است */
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    transition: max-width 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}

/* وقتی سایدبار باز می‌شود دکمه‌ها نمایش داده می‌شوند */
.sidebar:hover .footer-actions,
.sidebar.expanded .footer-actions,
.sidebar.pinned .footer-actions {
    opacity: 1;
    max-width: 90px; /* فضای کافی برای دکمه‌ها باز می‌شود */
}
/* Sidebar Profile Details (Name & Arrow) */
.profile-details {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    margin-right: 8px;
    /* در حالت بسته مخفی است و عرضش صفر می‌شود */
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    transition: max-width 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}

/* در حالت باز نمایش داده می‌شود */
.sidebar:hover .profile-details,
.sidebar.expanded .profile-details,
.sidebar.pinned .profile-details {
    opacity: 1;
    max-width: 150px;
}
