* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary: #1A1A2E;
    --primary-light: #16213E;
    --secondary: #667EEA;
    --secondary-light: #764BA2;
    --accent: #F093FB;
    --accent-2: #4FACFE;
    --bg: #FFFFFF;
    --bg-light: #F8F9FA;
    --bg-dark: #F1F3F5;
    --text: #1F2937;
    --text-light: #4B5563;
    --text-muted: #6B7280;
    --border: #E5E7EB;
    --border-light: #F3F4F6;
    --success: #10B981;
    --error: #EF4444;
    --warning: #F59E0B;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(102, 126, 234, 0.2), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(102, 126, 234, 0.25), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(102, 126, 234, 0.3);
    --radius: 16px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --gradient-primary: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
    --gradient-accent: linear-gradient(135deg, #F093FB 0%, #4FACFE 100%);
}

body {
    font-family: 'Vazirmatn', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    touch-action: pan-y;
    transition: background-color 0.3s ease, color 0.3s ease;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(102, 126, 234, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(118, 75, 162, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(79, 172, 254, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
    will-change: opacity;
}

@media (prefers-reduced-motion: no-preference) {
    body::before {
        animation: gradientShift 30s ease infinite;
    }
}

@keyframes gradientShift {
    0%, 100% { 
        opacity: 1;
    }
    50% { 
        opacity: 0.9;
    }
}

[data-theme="dark"] body::before {
    background: 
        radial-gradient(circle at 20% 30%, rgba(102, 126, 234, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(118, 75, 162, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(79, 172, 254, 0.1) 0%, transparent 50%);
}

.app-container {
    position: relative;
    z-index: 1;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 100vw;
    overflow-x: hidden;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(10px);
    background: var(--bg);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.header-right {
    justify-content: flex-end;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 12px;
}

.btn-link-header {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.btn-link-header:hover {
    background: var(--bg-secondary);
    color: var(--secondary);
}

.btn-primary-header {
    background: var(--gradient-primary);
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    padding: 10px 20px;
    border-radius: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-primary-header:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.logo {
    font-family: 'Poppins', 'Vazirmatn', sans-serif;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.3px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    position: relative;
}

.logo::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: 2px;
    opacity: 0.3;
}

.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.icon-btn:active {
    background: var(--bg-dark);
    transform: scale(0.95);
}

.icon-btn svg {
    width: 24px;
    height: 24px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

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

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary:disabled:active {
    transform: none;
}

.btn-large {
    padding: 16px 32px;
    font-size: 18px;
    width: 100%;
    justify-content: center;
}

.btn-price {
    background: white;
    color: var(--primary);
    border: 1px solid var(--border);
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-price:active {
    background: var(--bg-light);
    transform: scale(0.98);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.modal-content {
    position: relative;
    background: var(--bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1;
    animation: slideUp 0.3s ease;
    box-shadow: var(--shadow-xl);
}

.modal-small {
    max-width: 400px;
}

.modal-close {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-dark);
    border: none;
    color: var(--text);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.modal-close:active {
    background: var(--border);
    transform: scale(0.95);
}

.modal-content h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    font-family: inherit;
    background: var(--bg);
    color: var(--text);
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .app-header {
        padding: 10px 12px;
    }

    .logo {
        font-size: 20px;
    }

    .icon-btn {
        width: 40px;
        height: 40px;
    }

    .modal-content {
        padding: 20px;
        max-width: 95vw;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    .app-header {
        padding: 14px 20px;
    }
}

@media (min-width: 768px) {
    .icon-btn {
        width: 48px;
        height: 48px;
    }
    
    .icon-btn svg {
        width: 26px;
        height: 26px;
    }
}

@media (min-width: 1024px) {
    .app-container {
        max-width: 1200px;
        margin: 0 auto;
    }
}

@media (min-width: 1024px) and (max-width: 1366px) {
    .app-container {
        max-width: 100%;
    }
}

@media (orientation: landscape) and (max-height: 600px) {
    .app-header {
        padding: 8px 16px;
    }
    
    .logo {
        font-size: 20px;
    }
}

@supports (-webkit-touch-callout: none) {
    .app-container {
        min-height: -webkit-fill-available;
    }
}
