:root {
    --primary: #4CAF50;
    --primary-dark: #388E3C;
    --bg-color: #f8f9fa;
    --surface: #ffffff;
    --text-main: #212529;
    --text-muted: #6c757d;
    --danger: #dc3545;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: system-ui, -apple-system, sans-serif; }

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }
.view, .page-section { display: none; }
.view.active, .page-section.active { display: block; }

/* صفحه ورود */
.login-card {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    text-align: center;
    gap: 1rem;
    background: var(--surface);
}
.app-logo { font-size: 4rem; color: var(--primary); }

/* ساختار اصلی */
#main-app { display: flex; flex-direction: column; height: 100vh; }
.app-header {
    background: var(--primary);
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.icon-btn { background: none; border: none; color: white; font-size: 1.2rem; cursor: pointer; }

.app-content { flex: 1; overflow-y: auto; padding: 1rem; padding-bottom: 5rem; }

/* کارت‌ها و فرم‌ها */
.card {
    background: var(--surface);
    padding: 1.2rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.grid-menu { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.grid-menu .card { text-align: center; cursor: pointer; }
.grid-menu i { font-size: 2rem; color: var(--primary); margin-bottom: 0.5rem; }

input[type="text"], textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 1rem;
}
textarea { height: 100px; resize: none; }
input[type="range"] { width: 100%; margin: 1rem 0; }

.btn {
    padding: 0.8rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
}
.btn.primary { background: var(--primary); color: white; }
.btn.secondary { background: #e9ecef; color: var(--text-main); }
.btn.danger { background: var(--danger); color: white; }
.full-width { width: 100%; }
.margin-top { margin-top: 1rem; }

/* نوار ناوبری پایین */
.bottom-nav {
    position: fixed;
    bottom: 0;
    width: 100%;
    background: var(--surface);
    display: flex;
    justify-content: space-around;
    padding: 0.6rem 0;
    border-top: 1px solid #dee2e6;
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.75rem;
}
.nav-item.active { color: var(--primary); }
.nav-item i { font-size: 1.2rem; margin-bottom: 2px; }

/* ================= جلسات ACT (نسخه جدید) ================= */
.act-progress {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    margin-bottom: 1.2rem;
    overflow: hidden;
}
.act-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4CAF50, #8b5cf6);
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.session-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.2rem;
    background: var(--surface);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-right: 5px solid #ccc;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.session-item.unlocked {
    border-right-color: var(--primary);
    background: linear-gradient(90deg, rgba(76,175,80,0.08), var(--surface));
}
.session-item.unlocked:hover,
.session-item.unlocked:active {
    transform: translateX(-6px) scale(1.02);
    box-shadow: 0 8px 24px rgba(76,175,80,0.25);
}

.session-item.locked {
    opacity: 0.55;
    cursor: not-allowed;
    filter: grayscale(0.6);
}

.session-item i {
    font-size: 1.1rem;
    color: var(--primary);
    transition: transform 0.3s;
}
.session-item.locked i {
    color: var(--text-muted);
}
.session-item.unlocked:hover i {
    transform: scale(1.25) rotate(-10deg);
}

/* درخشش متحرک */
.session-item.unlocked::before {
    content: '';
    position: absolute;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(270deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: right 0.6s;
    pointer-events: none;
}
.session-item.unlocked:hover::before {
    right: 100%;
}

/* انیمیشن ورود پله‌ای */
@keyframes sessionSlideIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}
.session-item {
    animation: sessionSlideIn 0.4s ease backwards;
}

/* ================= مودال جلسه ================= */
#act-modal .modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1000;
}
#act-modal.show .modal-backdrop { opacity: 1; }

#act-modal .modal-content {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0.85);
    width: min(92vw, 520px);
    max-height: 82vh;
    background: var(--surface);
    border-radius: 18px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.35);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    z-index: 1001;
}
#act-modal.show .modal-content {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.2rem;
    background: var(--primary);
    color: #fff;
}
.modal-header h3 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.modal-close {
    background: none; border: none;
    color: #fff; font-size: 1.8rem;
    cursor: pointer; line-height: 1;
    padding: 0 6px;
    transition: transform 0.25s;
}
.modal-close:hover { transform: rotate(90deg); }

.modal-body {
    padding: 1.2rem;
    overflow-y: auto;
    line-height: 1.9;
    font-size: 0.95rem;
    text-align: justify;
    color: var(--text-main);
}
.modal-body::-webkit-scrollbar { width: 5px; }
.modal-body::-webkit-scrollbar-thumb {
    background: rgba(76,175,80,0.4);
    border-radius: 3px;
}

.modal-footer {
    padding: 0.8rem 1.2rem;
    border-top: 1px solid #eee;
    text-align: left;
}
.btn-complete {
    padding: 0.7rem 1.4rem;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #4CAF50, #2e7d32);
    color: #fff;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.25s;
    box-shadow: 0 4px 12px rgba(76,175,80,0.4);
}
.btn-complete:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(76,175,80,0.6);
}
/* بنر نصب PWA */
.install-banner {
    background: #e8f5e9;
    border-bottom: 1px solid #a5d6a7;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.banner-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #2e7d32;
    font-size: 0.85rem;
    font-weight: 500;
}

.banner-info i {
    font-size: 1.2rem;
}

.btn.small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    white-space: nowrap;
}
/* ================= اسپلش اسکرین ================= */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1976d2, #4caf50); /* ترکیب آبی و سبز اپلیکیشن */
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999; /* قرار گرفتن روی تمام اجزای صفحه */
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.splash-content {
    text-align: center;
    animation: fadeIn 1s ease-in-out;
}

.splash-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    color: #ffffff;
    /* انیمیشن تپش برای آیکون ذهن */
    animation: pulse 2s infinite; 
}

.splash-title {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
}

.splash-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

/* گردونه لودینگ */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

/* انیمیشن‌ها */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* کلاسی که با جاوااسکریپت اضافه میشه تا صفحه محو بشه */
.fade-out {
    opacity: 0;
    visibility: hidden;
}
/* ================= دکمه شناور (FAB) ================= */
#fab-container {
    position: fixed;
    bottom: 90px;
    left: 20px;   /* یا right برای راست */
    z-index: 900;
    direction: rtl;
}

.fab-main {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #4CAF50, #2e7d32);
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.45);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}
.fab-main:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 30px rgba(76, 175, 80, 0.7);
}
.fab-main.open {
    transform: rotate(45deg);
    background: linear-gradient(135deg, #f44336, #c62828);
    box-shadow: 0 6px 20px rgba(244, 67, 54, 0.5);
}

/* منوی بازشو */
.fab-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}
.fab-menu.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
}

.fab-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #fff;
    border: none;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    transition: all 0.25s;
    animation: fabPop 0.3s ease backwards;
}
.fab-menu-item:nth-child(1) { animation-delay: 0.05s; }
.fab-menu-item:nth-child(2) { animation-delay: 0.1s; }

.fab-menu-item i {
    color: var(--primary);
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
}
.fab-menu-item:hover,
.fab-menu-item:active {
    transform: translateX(6px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.35);
}

@keyframes fabPop {
    from { opacity: 0; transform: scale(0.7); }
    to { opacity: 1; transform: scale(1); }
}

/* ================= مودال موسیقی ================= */
.music-modal, .about-modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
}
.music-modal.hidden, .about-modal.hidden { display: none; }

.music-backdrop, .about-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity 0.3s;
}
.music-modal.show .music-backdrop,
.about-modal.show .about-backdrop { opacity: 1; }

.music-content {
    position: relative;
    width: min(94vw, 480px);
    max-height: 88vh;
    background: linear-gradient(160deg, #1e1b4b, #2d2a5e);
    border-radius: 22px;
    box-shadow: 0 25px 70px rgba(0,0,0,0.5);
    color: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.music-modal.show .music-content {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.music-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.music-header h3 {
    margin: 0;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.music-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.25s;
}
.music-close:hover { transform: rotate(90deg); }

/* پلیر */
.music-player {
    padding: 20px;
    text-align: center;
}
.music-cover {
    width: 110px;
    height: 110px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #4CAF50);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
}
.music-cover i {
    font-size: 3rem;
    color: #fff;
}
.music-cover.spinning i {
    animation: spin 3s linear infinite;
}

#music-current-title {
    margin: 0 0 4px;
    font-size: 1rem;
    font-weight: 700;
}
#music-current-artist {
    margin: 0 0 16px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.6);
}

.music-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    margin-bottom: 14px;
}
.music-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.25s;
}
.music-btn:hover { background: rgba(255,255,255,0.25); transform: scale(1.1); }
.music-btn.main-btn {
    width: 56px;
    height: 56px;
    font-size: 1.3rem;
    background: linear-gradient(135deg, #4CAF50, #8b5cf6);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.music-progress-container {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.6);
}
#music-progress {
    flex: 1;
    -webkit-appearance: none;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    outline: none;
    margin: 0;
}
#music-progress::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(76,175,80,0.7);
}

/* لیست آهنگ‌ها */
.music-list-header {
    padding: 10px 18px;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.5);
    border-top: 1px solid rgba(255,255,255,0.1);
}
.music-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 10px 14px;
    max-height: 220px;
}
.music-list::-webkit-scrollbar { width: 5px; }
.music-list::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.5);
    border-radius: 3px;
}

.music-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 6px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}
.music-item:hover { background: rgba(255,255,255,0.08); }
.music-item.active {
    background: rgba(76,175,80,0.2);
    border-right: 3px solid #4CAF50;
}
.music-item i {
    color: #8b5cf6;
    font-size: 0.9rem;
    width: 20px;
    text-align: center;
}
.music-item-info {
    flex: 1;
    text-align: right;
}
.music-item-info strong {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
}
.music-item-info small {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.5);
}

/* ================= مودال درباره ما ================= */
.about-content {
    position: relative;
    width: min(92vw, 420px);
    max-height: 85vh;
    background: var(--surface);
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.about-modal.show .about-content {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.about-header {
    padding: 22px;
    background: linear-gradient(135deg, #4CAF50, #2e7d32);
    color: #fff;
    text-align: center;
}
.about-header i {
    font-size: 2.5rem;
    margin-bottom: 6px;
    display: block;
}
.about-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.about-body {
    padding: 18px;
    overflow-y: auto;
    flex: 1;
}
.about-body p {
    font-size: 0.88rem;
    line-height: 1.8;
    color: var(--text-muted);
    margin-bottom: 14px;
    text-align: justify;
}

.about-section {
    margin-bottom: 18px;
}
.about-section h4 {
    font-size: 0.95rem;
    margin-bottom: 10px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}
.about-section h4 i { color: var(--primary); }

.creators-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.creators-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: #f1f8e9;
    border-radius: 10px;
    margin-bottom: 8px;
    border-right: 3px solid var(--primary);
}
.creators-list li i {
    font-size: 1.4rem;
    color: var(--primary);
}
.creators-list li strong {
    display: block;
    font-size: 0.9rem;
    color: var(--text-main);
}
.creators-list li small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.about-close-btn {
    margin: 12px 18px 18px;
    width: calc(100% - 36px);
}
