/* ===== الخطوط ===== */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700&display=swap');

/* ===== متغيرات CSS ===== */
:root {
    --primary-color: #4caf50;
    --primary-dark: #388e3c;
    --primary-light: #c8e6c9;
    --secondary-color: #2196f3;
    --secondary-dark: #1976d2;
    --danger-color: #f44336;
    --warning-color: #ff9800;
    --success-color: #4caf50;
    --info-color: #2196f3;
    --text-color: #333;
    --text-light: #666;
    --text-lighter: #999;
    --bg-color: #f5f5f5;
    --bg-light: #fff;
    --bg-dark: #e0e0e0;
    --border-color: #ddd;
    --shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* ===== إعادة تعيين CSS ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    direction: rtl;
}

/* ===== حاوية اللعبة ===== */
#game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    min-height: 100vh;
}

/* ===== الشاشات ===== */
.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-color: var(--bg-light);
    border-radius: 10px;
    box-shadow: var(--shadow);
    min-height: 80vh;
}

.screen.active {
    display: flex;
}

/* ===== شاشة البداية ===== */
#start-screen {
    text-align: center;
}

.logo {
    margin-bottom: 40px;
}

.logo h1 {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.logo p {
    font-size: 1.2rem;
    color: var(--text-light);
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 300px;
}

/* ===== الأزرار ===== */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Tajawal', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn i {
    font-size: 1.1rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: var(--secondary-dark);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #d32f2f;
}

/* ===== شاشة اللعب ===== */
#game-screen {
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 10px 10px 0 0;
}

.player-info {
    display: flex;
    gap: 20px;
}

.player-info div {
    display: flex;
    align-items: center;
    gap: 5px;
}

.game-controls {
    display: flex;
    gap: 10px;
}

.game-content {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

/* ===== علامات التبويب ===== */
.tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.tab-btn {
    padding: 10px 20px;
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 5px 5px 0 0;
    cursor: pointer;
    font-family: 'Tajawal', sans-serif;
    font-size: 1rem;
    transition: var(--transition);
}

.tab-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.tab-pane {
    display: none;
    padding: 20px;
    background-color: var(--bg-light);
    border-radius: 0 0 10px 10px;
    flex: 1;
}

.tab-pane.active {
    display: block;
}

/* ===== المتجر ===== */
.store-stats {
    display: flex;
    justify-content: space-around;
    margin: 20px 0;
    padding: 15px;
    background-color: var(--bg-dark);
    border-radius: 5px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 1.1rem;
}

.daily-summary {
    padding: 15px;
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    margin-top: 20px;
}

/* ===== المخزون ===== */
.inventory-status {
    margin: 20px 0;
}

.status-bar {
    height: 20px;
    background-color: var(--bg-dark);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 5px;
}

.status-fill {
    height: 100%;
    background-color: var(--primary-color);
    transition: var(--transition);
}

.status-text {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-light);
}

.inventory-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.inventory-item {
    padding: 15px;
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    transition: var(--transition);
}

.inventory-item:hover {
    box-shadow: var(--shadow);
}

.inventory-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.inventory-item-name {
    font-weight: 500;
    font-size: 1.1rem;
}

.inventory-item-quantity {
    background-color: var(--primary-light);
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.9rem;
}

.inventory-item-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 15px;
}

.inventory-item-detail {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-light);
}

.inventory-item-actions {
    display: flex;
    justify-content: space-between;
}

/* ===== السوق ===== */
.market-info {
    margin-bottom: 20px;
}

.market-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 15px;
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.9rem;
    transition: var(--transition);
}

.filter-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.products-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.product-item {
    padding: 15px;
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    transition: var(--transition);
}

.product-item:hover {
    box-shadow: var(--shadow);
}

.product-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.product-item-name {
    font-weight: 500;
    font-size: 1.1rem;
}

.product-item-category {
    background-color: var(--secondary-color);
    color: white;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
}

.product-item-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 15px;
}

.product-item-detail {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-light);
}

/* ===== التطويرات ===== */
.upgrades-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.upgrade-item {
    padding: 15px;
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    transition: var(--transition);
}

.upgrade-item:hover {
    box-shadow: var(--shadow);
}

.upgrade-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.upgrade-item-name {
    font-weight: 500;
    font-size: 1.1rem;
}

.upgrade-item-level {
    background-color: var(--primary-light);
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.9rem;
}

.upgrade-item-description {
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: var(--text-light);
}

.upgrade-item-cost {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-weight: 500;
}

/* ===== الإعدادات ===== */
.settings-content {
    width: 100%;
    max-width: 500px;
    margin: 30px 0;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

.setting-item:last-child {
    border-bottom: none;
}

/* ===== مفتاح التبديل ===== */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* ===== حول اللعبة ===== */
.about-content {
    max-width: 600px;
    margin: 30px 0;
    text-align: center;
}

.channel-link {
    margin-top: 30px;
    padding: 15px;
    background-color: #ff0000;
    border-radius: 5px;
    color: white;
}

.youtube-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: white;
    text-decoration: none;
    font-size: 1.2rem;
    margin-top: 10px;
}

.youtube-link i {
    font-size: 1.5rem;
}

/* ===== النوافذ المنبثقة ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--bg-light);
    padding: 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
}

.product-details {
    margin: 20px 0;
}

.detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.detail-label {
    font-weight: 500;
}

.quantity-control {
    display: flex;
    align-items: center;
}

.quantity-btn {
    width: 30px;
    height: 30px;
    background-color: var(--bg-dark);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

#buy-quantity, #sell-quantity, #sell-price {
    width: 60px;
    text-align: center;
    margin: 0 10px;
    padding: 5px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
}

.modal-actions {
    display: flex;
    justify-content: space-between;
}

/* ===== شاشة التحميل ===== */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    z-index: 2000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--bg-dark);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== الإشعارات ===== */
#notification-container {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1500;
}

.notification {
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: 5px;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification.success {
    background-color: var(--success-color);
}

.notification.error {
    background-color: var(--danger-color);
}

.notification.info {
    background-color: var(--info-color);
}

.notification.warning {
    background-color: var(--warning-color);
}

/* ===== نتائج اليوم ===== */
.results-content {
    width: 100%;
    max-width: 500px;
    margin: 30px 0;
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.result-item.total {
    font-weight: 700;
    font-size: 1.2rem;
    margin-top: 10px;
    border-bottom: none;
}

.result-events {
    margin-top: 20px;
    padding: 15px;
    background-color: var(--bg-dark);
    border-radius: 5px;
}

.event-item {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--border-color);
}

.event-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* ===== نهاية اللعبة ===== */
.game-over-content {
    width: 100%;
    max-width: 500px;
    margin: 30px 0;
}

.final-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background-color: var(--bg-dark);
    border-radius: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.game-over-message {
    text-align: center;
    margin-bottom: 30px;
}

/* ===== تصميم متجاوب ===== */
@media (max-width: 768px) {
    .game-header {
        flex-direction: column;
        gap: 15px;
    }

    .player-info {
        width: 100%;
        justify-content: space-between;
    }

    .tabs {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 15px;
    }

    .tab-btn {
        flex-shrink: 0;
    }

    .products-list, .inventory-list, .upgrades-list {
        grid-template-columns: 1fr;
    }

    .final-stats {
        grid-template-columns: 1fr;
    }
}


/* ===== أشرطة التمرير لمستوى الصوت ===== */
.volume-slider {
    width: 100%;
    height: 10px;
    -webkit-appearance: none;
    appearance: none;
    background: #ddd;
    outline: none;
    border-radius: 5px;
    margin: 10px 0;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
}

.volume-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.volume-value {
    display: inline-block;
    width: 50px;
    text-align: right;
    font-size: 0.9em;
}

/* ===== التحديات والأهداف ===== */
.challenges-section {
    margin-bottom: 30px;
}

.challenge-card {
    padding: 15px;
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    margin-top: 10px;
}

.challenge-title {
    font-weight: 500;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.challenge-description {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 15px;
}

.challenge-reward {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    color: var(--text-light);
}

.goals-progress {
    margin: 15px 0;
}

.progress-bar {
    height: 10px;
    background-color: var(--bg-dark);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 5px;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    transition: var(--transition);
}

.progress-text {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-light);
}

.goals-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.goal-item {
    padding: 15px;
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    transition: var(--transition);
}

.goal-item.completed {
    background-color: var(--primary-light);
    border-color: var(--primary-color);
}

.goal-title {
    font-weight: 500;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.goal-status {
    font-size: 0.8rem;
    padding: 3px 8px;
    border-radius: 10px;
    color: white;
}

.goal-status.pending {
    background-color: var(--warning-color);
}

.goal-status.completed {
    background-color: var(--success-color);
}

.goal-description {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 10px;
}

.goal-reward {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    color: var(--text-light);
}

/* ===== الإنجازات ===== */
.achievements-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.achievement-item {
    padding: 15px;
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.achievement-item.unlocked {
    background-color: var(--primary-light);
    border-color: var(--primary-color);
}

.achievement-item.locked {
    opacity: 0.7;
}

.achievement-icon {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 1.5rem;
    color: var(--text-lighter);
    opacity: 0.2;
}

.achievement-item.unlocked .achievement-icon {
    color: var(--primary-color);
    opacity: 0.5;
}

.achievement-title {
    font-weight: 500;
    margin-bottom: 10px;
    padding-right: 30px;
}

.achievement-description {
    font-size: 0.9rem;
    color: var(--text-light);
}

.achievement-status {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.achievement-status.unlocked {
    background-color: var(--success-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.achievement-status.locked {
    background-color: var(--text-lighter);
}

/* ===== الإحصائيات ===== */
.statistics-sections {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.statistics-section {
    padding: 15px;
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 5px;
}

.statistics-list {
    margin-top: 10px;
}

.statistic-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border-color);
}

.statistic-item:last-child {
    border-bottom: none;
}

.statistic-label {
    font-size: 0.9rem;
    color: var(--text-light);
}

.statistic-value {
    font-weight: 500;
}

/* ===== المواسم ===== */
.season-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 5px;
    background-color: var(--bg-dark);
    margin-bottom: 15px;
}

.season-icon {
    font-size: 1.2rem;
}

.season-name {
    font-weight: 500;
}

.seasonal-products {
    margin-top: 20px;
}

.seasonal-products h4 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

.seasonal-product-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.seasonal-product-item {
    padding: 10px;
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 0.9rem;
}

.seasonal-product-name {
    font-weight: 500;
    margin-bottom: 5px;
}

.seasonal-product-bonus {
    color: var(--success-color);
}

.seasonal-product-penalty {
    color: var(--danger-color);
}

