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

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 100vh;
}

/* ========== نویگیشن بار ========== */
.navbar {
    background: white;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    width: 100%;
    grid-row: 1;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: bold;
}

.brand-icon {
    font-size: 2rem;
}

.brand-name {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 5px;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    color: #555;
    text-decoration: none;
    font-weight: 500;
    border-radius: 30px;
    transition: all 0.3s;
}

.nav-item a:hover {
    background: #f0f3ff;
    color: #667eea;
}

.nav-item.active a {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

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

.nav-theme {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f3ff;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
}

.nav-theme:hover {
    background: #e4e9ff;
    transform: rotate(20deg);
}

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

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background: #667eea;
    border-radius: 3px;
    transition: all 0.3s;
}

/* ========== محتوای اصلی ========== */
.main-content {
    grid-row: 2;
    padding: 40px 20px;
    width: 100%;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 900px;
    margin: 0 auto;
}

h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

p {
    color: #666;
    margin-bottom: 20px;
}

textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    resize: vertical;
    margin-bottom: 20px;
    transition: border-color 0.3s;
    font-family: inherit;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* ========== پنل تنظیمات ========== */
.settings-panel {
    background: #f8f9ff;
    border-radius: 12px;
    margin: 20px 0;
    overflow: hidden;
    border: 1px solid #e0e7ff;
}

.settings-header {
    background: #e4e9ff;
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: #4455aa;
    transition: background 0.3s;
}

.settings-header:hover {
    background: #d8dfff;
}

.toggle-icon {
    font-size: 0.8rem;
    transition: transform 0.3s;
}

.settings-content {
    padding: 20px;
    display: none;
}

.settings-content.show {
    display: block;
}

.setting-item {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 5px 0;
}

.setting-icon {
    width: 32px;
    height: 32px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.setting-item label {
    min-width: 120px;
    color: #4455aa;
    font-weight: 500;
}

.setting-item input[type="range"] {
    flex: 1;
    min-width: 200px;
    height: 6px;
    border-radius: 3px;
    background: #d0d9ff;
}

.setting-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.setting-item input[type="number"] {
    width: 80px;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 0.9rem;
}

.unit {
    color: #888;
    font-size: 0.9rem;
}

#speedValue {
    font-weight: bold;
    color: #667eea;
    min-width: 40px;
    display: inline-block;
    text-align: center;
}

.setting-item.checkbox label {
    min-width: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

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

/* ========== گرید آمار ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.stat-card {
    background: #f8f9ff;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    border: 1px solid #e0e7ff;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transform: scaleX(0);
    transition: transform 0.3s;
}

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
    line-height: 1.2;
}

.stat-label {
    color: #555;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 5px;
}

.detail-badge {
    font-size: 0.7rem;
    background: #e0e7ff;
    color: #4455aa;
    padding: 4px 8px;
    border-radius: 20px;
    margin-top: 8px;
    display: inline-block;
}

/* ========== فوتر ========== */
.footer {
    background: white;
    padding: 20px 0;
    grid-row: 3;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.1);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
    color: #666;
}

.footer-links {
    margin-top: 10px;
    display: flex;
    gap: 20px;
    justify-content: center;
}

.footer-links a {
    color: #667eea;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: #764ba2;
}

/* ========== مودال ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideIn 0.3s;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 15px;
    left: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    transition: color 0.3s;
}

.modal-close:hover {
    color: #ff4444;
}

/* ========== ریسپانسیو ========== */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }
    
    .nav-menu {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 20px;
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
        border-radius: 0 0 20px 20px;
    }
    
    .nav-menu.show {
        display: flex;
    }
    
    .nav-item a {
        padding: 15px 20px;
    }
    
    .setting-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .setting-item label {
        min-width: auto;
    }
    
    .setting-item input[type="range"] {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .nav-brand .brand-name {
        display: none;
    }
    
    .container {
        padding: 20px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
}

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

.stat-card {
    animation: fadeInUp 0.5s ease backwards;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }
.stat-card:nth-child(5) { animation-delay: 0.5s; }
.stat-card:nth-child(6) { animation-delay: 0.6s; }
.stat-card:nth-child(7) { animation-delay: 0.7s; }
.stat-card:nth-child(8) { animation-delay: 0.8s; }
.stat-card:nth-child(9) { animation-delay: 0.9s; }