/* --- متغیرهای رنگی و تم --- */
:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --accent-color: #4cc9f0;
    --success-color: #4895ef;
    --warning-color: #f72585;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #2b2d42;
    --text-light: #8d99ae;
    --border-radius: 16px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    --nav-height: 70px;
    --border-color: rgba(0, 0, 0, 0.15);
}

/* حالت شب */
:root.dark-mode {
    --primary-color: #4cc9f0;
    --secondary-color: #4895ef;
    --accent-color: #4361ee;
    --bg-color: #1a1b26;
    --card-bg: #24283b;
    --text-color: #a9b1d6;
    --text-light: #565f89;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --border-color: rgba(255, 255, 255, 0.15);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    outline: none;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body {
    font-family: 'Tahoma', 'Segoe UI', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- نوار ناوبری --- */
.navbar {
    background: var(--card-bg);
    height: var(--nav-height);
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.live-clock {
    font-family: inherit;
    font-weight: bold;
    color: var(--primary-color);
    background: rgba(0, 0, 0, 0.03);
    padding: 5px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

:root.dark-mode .live-clock {
    background: rgba(255, 255, 255, 0.05);
}

.nav-links {
    display: flex;
    gap: 5px;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-light);
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 10px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.nav-btn.active,
.nav-btn:hover {
    color: var(--primary-color);
    background: rgba(67, 97, 238, 0.1);
}

.user-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f0f2f5;
    padding: 6px 15px;
    border-radius: 50px;
}

:root.dark-mode .user-stats {
    background: #16161e;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    font-weight: bold;
}

/* --- محتوای اصلی --- */
.main-container {
    flex: 1;
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.page-section {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.page-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- هیرو سکشن --- */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    text-align: center;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.hero-title {
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.stat-card {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 12px;
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    min-width: 100px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-card.warning strong {
    color: #ff6b6b;
}

.stat-card span {
    font-size: 0.8rem;
    opacity: 0.9;
}

.stat-card strong {
    font-size: 1.1rem;
}

.btn-start {
    background: var(--accent-color);
    color: #000;
    border: none;
    padding: 10px 25px;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: bold;
    margin-top: 1.5rem;
    transition: transform 0.2s;
}

.btn-start:hover {
    transform: scale(1.05);
}

/* --- کارت‌ها و گرید --- */
.widgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.full-width {
    grid-column: 1 / -1;
}

.card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 2px solid var(--border-color);
}

:root.dark-mode .card {
    border-color: var(--border-color);
}

.card h3 {
    margin-bottom: 1.2rem;
    color: var(--primary-color);
    font-size: 1.1rem;
    border-bottom: 2px solid rgba(0, 0, 0, 0.05);
    padding-bottom: 10px;
}

/* --- نمودار --- */
.chart-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    height: 250px;
    padding: 10px 0;
    overflow-x: auto;
    gap: 5px;
    -webkit-overflow-scrolling: touch;
}

.bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    min-width: 40px;
    position: relative;
}

.bar {
    width: 100%;
    max-width: 40px;
    background: linear-gradient(to top, var(--primary-color), var(--accent-color));
    border-radius: 6px 6px 0 0;
    transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    min-height: 5px;
}

.bar:hover::after {
    content: attr(data-value);
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 10;
}

.bar-label {
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-light);
    text-align: center;
    width: 100%;
}

/* --- برنامه‌ریزی و جدول --- */
.planning-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 10px;
}

.planning-buttons {
    display: flex;
    gap: 10px;
}

.btn-add {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.3s;
}

.btn-add:hover {
    background: var(--secondary-color);
}

.btn-delete-all {
    background: #ff4757;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.3s;
    white-space: nowrap;
}

.btn-delete-all:hover {
    background: #ff6b81;
}

.task-table-container {
    overflow-x: auto;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 2px solid var(--border-color);
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}

th,
td {
    padding: 15px;
    text-align: right;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    vertical-align: middle;
}

:root.dark-mode th,
:root.dark-mode td {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

th {
    background: rgba(0, 0, 0, 0.02);
    color: var(--text-light);
    font-weight: 600;
}

:root.dark-mode th {
    background: rgba(0, 0, 0, 0.2);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

:root.dark-mode tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.priority-dot {
    height: 10px;
    width: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-left: 5px;
}

.prio-high {
    background: #e74c3c;
}

.prio-medium {
    background: #f1c40f;
}

.prio-low {
    background: #2ecc71;
}

.action-icons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* --- مودال‌ها --- */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: slideDown 0.3s ease;
    position: relative;
    border: 1px solid var(--border-color);
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-color);
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    background: var(--bg-color);
    color: var(--text-color);
}

.form-group input:focus {
    border-color: var(--primary-color);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.btn-cancel {
    background: #e0e0e0;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    color: #333;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
}

/* --- استایل‌های جدید سیستم احراز هویت --- */
.auth-modal-content {
    text-align: center;
}

.auth-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    cursor: pointer;
    color: #888;
}

.auth-tab.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    font-weight: bold;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.form-input {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.forgot-pass {
    color: var(--primary-color);
    font-size: 0.8rem;
    cursor: pointer;
    margin-top: 10px;
    display: block;
    text-align: left;
}

/* --- استایل پروفایل --- */
.profile-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.profile-avatar {
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* --- استایل چت بات (اصلاح شده) --- */
.ai-chat-box {
    background: var(--bg-color);
    border-radius: 10px;
    padding: 15px;
    height: 300px;
    overflow-y: auto;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
}

.ai-message {
    background: rgba(67, 97, 238, 0.1);
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 10px;
    text-align: right;
    font-size: 1.1rem;
    color: #000;
    font-weight: 500;
}

.user-message {
    background: var(--primary-color);
    color: white;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 10px;
    text-align: left;
    font-size: 1.1rem;
    font-weight: 500;
}

.ai-input-group {
    display: flex;
    gap: 10px;
}

/* --- علایق --- */
.interest-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 20px;
    margin-bottom: 15px;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-color);
}

:root.dark-mode .interest-btn {
    border-color: #414868;
}

.interest-btn:hover {
    border-color: var(--primary-color);
    background: rgba(67, 97, 238, 0.05);
    transform: translateY(-2px);
}

.interest-btn i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.badges-grid span {
    display: inline-block;
    background: #eef2ff;
    color: var(--primary-color);
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.9rem;
    margin: 5px;
    border: 1px solid rgba(67, 97, 238, 0.2);
}

:root.dark-mode .badges-grid span {
    background: #24283b;
    color: var(--primary-color);
}

/* --- رشد --- */
.level-badge {
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: bold;
    display: inline-block;
    margin-bottom: 10px;
}

.progress-container {
    background: #e0e0e0;
    border-radius: 10px;
    height: 10px;
    width: 100%;
    margin-top: 10px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.progress-bar {
    background: var(--primary-color);
    height: 100%;
    text-align: center;
    color: white;
    font-size: 12px;
    line-height: 10px;
    transition: width 0.5s ease;
}

/* --- مودال پاداش --- */
.reward-card {
    text-align: center;
    background: var(--card-bg);
    border: 2px solid var(--accent-color);
}

.reward-icon-wrapper {
    font-size: 4rem;
    color: var(--accent-color);
    margin-bottom: 1rem;
    animation: bounce 1s infinite;
}

.points-reward {
    font-size: 2rem;
    font-weight: bold;
    margin: 1rem 0;
    color: var(--primary-color);
}

@keyframes bounce {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* --- افکت کاغذ رنگی --- */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background-color: #f00;
    animation: fall linear forwards;
    z-index: 9999;
    pointer-events: none;
}

@keyframes fall {
    to {
        transform: translateY(100vh) rotate(720deg);
    }
}

/* --- فوتر --- */
footer {
    background: #2b2d42;
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* --- ریسپانسیو موبایل --- */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        height: auto;
        padding: 1rem;
        gap: 10px;
        position: relative;
    }

    .live-clock {
        position: absolute;
        top: 10px;
        left: 15px;
        font-size: 0.8rem;
        padding: 3px 8px;
    }

    .nav-links {
        width: 100%;
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 10px;
        margin-top: 10px;
    }

    .nav-btn {
        font-size: 1rem;
        padding: 10px 15px;
        flex: 1 1 40%;
        text-align: center;
        background: rgba(0, 0, 0, 0.03);
    }

    :root.dark-mode .nav-btn {
        background: rgba(255, 255, 255, 0.05);
    }

    .user-stats {
        width: 100%;
        justify-content: center;
        margin-top: 5px;
    }

    .hero-title {
        font-size: 1.4rem;
    }

    .hero-stats {
        flex-direction: column;
        gap: 10px;
    }

    .stat-card {
        width: 100%;
        justify-content: space-between;
    }

    .chart-container {
        height: 220px;
    }

    .bar-group {
        min-width: 35px;
    }

    .bar-label {
        font-size: 0.6rem;
        margin-top: 4px;
    }

    .planning-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .planning-buttons {
        flex-direction: column;
    }

    .btn-add,
    .btn-delete-all {
        justify-content: center;
        width: 100%;
    }

    .task-table-container {
        margin: 0 -1.5rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}