/* Uyghur Typing Practice - Main Stylesheet */

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Beautiful Color Palette */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #ec4899;
    --accent: #f59e0b;
    --success: #10b981;
    --error: #f43f5e;
    
    /* Background */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-gradient-soft: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    
    /* Text colors */
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    /* Border & Shadow */
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 40px -10px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.3);
    
    /* Particle colors */
    --particle-color: rgba(99, 102, 241, 0.15);
    --particle-color-2: rgba(236, 72, 153, 0.1);
    
    /* Typography */
    --font-uyghur: 'AlpEkran', 'Scheherazade New', 'Noto Naskh Arabic', serif;
    --font-system: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    /* Spacing */
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* Border radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: all 0.15s ease;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark theme */
[data-theme="dark"] {
    --primary: #818cf8;
    --primary-dark: #6366f1;
    --primary-light: #a5b4fc;
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-gradient-soft: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border: #334155;
    --border-light: #1e293b;
    --shadow-glow: 0 0 40px rgba(129, 140, 248, 0.25);
    --particle-color: rgba(129, 140, 248, 0.2);
    --particle-color-2: rgba(236, 72, 153, 0.15);
}

/* Base styles */
html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-system);
    background: var(--bg-gradient-soft);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    direction: rtl;
    position: relative;
    overflow-x: hidden;
    transition: var(--transition);
}

/* Background Animation Particles */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: var(--particle-color);
    animation: float 20s infinite ease-in-out;
}

.particle:nth-child(1) {
    width: 300px;
    height: 300px;
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.particle:nth-child(2) {
    width: 200px;
    height: 200px;
    top: 50%;
    right: -50px;
    animation-delay: -5s;
    background: var(--particle-color-2);
}

.particle:nth-child(3) {
    width: 150px;
    height: 150px;
    bottom: 10%;
    left: 20%;
    animation-delay: -10s;
}

.particle:nth-child(4) {
    width: 250px;
    height: 250px;
    top: 30%;
    left: 60%;
    animation-delay: -15s;
    background: var(--particle-color-2);
}

.particle:nth-child(5) {
    width: 180px;
    height: 180px;
    bottom: -50px;
    right: 10%;
    animation-delay: -7s;
}

.particle:nth-child(6) {
    width: 120px;
    height: 120px;
    top: 20%;
    left: 10%;
    animation-delay: -12s;
    background: var(--particle-color-2);
}

.particle:nth-child(7) {
    width: 220px;
    height: 220px;
    top: 70%;
    left: 40%;
    animation-delay: -3s;
}

.particle:nth-child(8) {
    width: 160px;
    height: 160px;
    top: 10%;
    right: 30%;
    animation-delay: -18s;
    background: var(--particle-color-2);
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 0.5;
    }
    25% {
        transform: translate(30px, -30px) rotate(90deg);
        opacity: 0.8;
    }
    50% {
        transform: translate(-20px, 20px) rotate(180deg);
        opacity: 0.6;
    }
    75% {
        transform: translate(40px, 10px) rotate(270deg);
        opacity: 0.7;
    }
}

/* App container */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border-bottom: 1px solid var(--border-light);
    padding: var(--spacing-lg) var(--spacing-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
}

.header-content {
    text-align: center;
    flex: 1;
}

.main-title {
    font-family: var(--font-uyghur);
    font-size: 2.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--spacing-sm);
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Theme Toggle Button */
.theme-toggle {
    width: 50px;
    height: 50px;
    border: none;
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

.theme-toggle svg {
    width: 24px;
    height: 24px;
    position: absolute;
    transition: var(--transition);
    color: var(--text-secondary);
}

.theme-toggle .sun-icon {
    opacity: 1;
    transform: rotate(0deg);
}

.theme-toggle .moon-icon {
    opacity: 0;
    transform: rotate(-90deg);
}

[data-theme="dark"] .theme-toggle .sun-icon {
    opacity: 0;
    transform: rotate(90deg);
}

[data-theme="dark"] .theme-toggle .moon-icon {
    opacity: 1;
    transform: rotate(0deg);
}

/* Main content */
.main-content {
    flex: 1;
    padding: var(--spacing-xl);
    max-width: 950px;
    margin: 0 auto;
    width: 100%;
}

/* Section label */
.section-label {
    font-family: var(--font-uyghur);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

/* Input Section */
.input-section {
    background: var(--bg-primary);
    padding: var(--spacing-xl);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    margin-bottom: var(--spacing-xl);
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.input-section:hover {
    box-shadow: var(--shadow-xl), var(--shadow-glow);
}

.input-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    opacity: 0;
    transition: var(--transition);
}

.input-section:hover::before {
    opacity: 1;
}

.input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.input-controls {
    display: flex;
    gap: var(--spacing-sm);
}

.clear-btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    border: none;
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
    color: white;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-family: var(--font-uyghur);
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.clear-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.4);
}

.clear-btn:active {
    transform: translateY(0);
}

.size-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.size-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.size-btn:active {
    transform: translateY(0) scale(1);
}

/* Color Picker */
.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.color-picker-label {
    font-family: var(--font-uyghur);
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.color-picker {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border);
    border-radius: var(--radius-full);
    cursor: pointer;
    padding: 0;
    background: transparent;
    transition: var(--transition);
    overflow: hidden;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: var(--radius-full);
}

.color-picker:hover {
    border-color: var(--primary);
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.input-container {
    margin-bottom: var(--spacing-md);
}

.typing-input {
    width: 100%;
    min-height: 150px;
    padding: var(--spacing-lg);
    font-family: var(--font-uyghur);
    font-size: 1.5rem;
    line-height: 2;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    color: var(--text-primary);
    direction: rtl;
    text-align: right;
    resize: vertical;
    transition: var(--transition);
}

.typing-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
    background: var(--bg-primary);
}

.typing-input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

/* Keyboard Section */
.keyboard-section {
    background: var(--bg-primary);
    padding: var(--spacing-xl);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    transition: var(--transition);
}

.keyboard-section:hover {
    box-shadow: var(--shadow-xl);
}

.virtual-keyboard {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    direction: ltr;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.key {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    height: 52px;
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-uyghur);
    transition: var(--transition);
    cursor: pointer;
    user-select: none;
    position: relative;
    padding: 4px;
}

.key::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-md);
    opacity: 0;
    transition: var(--transition);
}

.key:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.key:hover::after {
    opacity: 1;
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.05) 0%, transparent 100%);
}

.key:active,
.key.active {
    transform: translateY(0);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: var(--primary-dark);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
}

.key:active .main,
.key:active .shift,
.key.active .main,
.key.active .shift {
    color: white;
}

.key .shift {
    font-size: 0.65rem;
    color: var(--error);
    line-height: 1;
    margin-bottom: 2px;
    font-weight: 600;
    opacity: 0.9;
}

.key .main {
    font-size: 1.125rem;
    color: var(--text-primary);
    line-height: 1;
    font-weight: 500;
}

.key.space {
    min-width: 220px;
}

.key.space .main {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Special keys */
.key.special {
    min-width: 75px;
    background: linear-gradient(180deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
}

.key.special .main {
    font-size: 0.7rem;
    font-family: var(--font-system);
    font-weight: 600;
    color: var(--text-secondary);
}

.key.backspace,
.key.enter {
    min-width: 85px;
}

.key.backspace:hover,
.key.enter:hover {
    border-color: var(--secondary);
}

.key.backspace:active,
.key.enter:active,
.key.backspace.active,
.key.enter.active {
    background: linear-gradient(135deg, var(--secondary) 0%, #db2777 100%);
    border-color: var(--secondary);
}

.key.shift-left,
.key.shift-right {
    min-width: 95px;
}

.key.caps {
    min-width: 70px;
}

/* ئ key - special green highlight */
.key.special-key {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-color: #059669;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.key.special-key:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-3px);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.5);
}

.key.special-key .main,
.key.special-key .shift {
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Desktop/Mobile visibility */
.desktop-only {
    display: flex;
}

.mobile-only {
    display: none;
}

/* Footer */
.footer {
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border-top: 1px solid var(--border-light);
    padding: var(--spacing-lg) var(--spacing-xl);
    text-align: center;
    position: relative;
}

.footer::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
    opacity: 0.5;
}

.footer p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: var(--spacing-xs) 0;
}

.footer p:first-child {
    font-weight: 500;
    color: var(--text-secondary);
}

.footer .seo-keywords {
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.6;
}

/* Responsive Design - Tablet */
@media (max-width: 768px) {
    .main-title {
        font-size: 1.75rem;
    }
    
    .typing-input {
        font-size: 1.25rem;
        min-height: 120px;
        padding: var(--spacing-md);
    }
    
    .main-content {
        padding: var(--spacing-md);
    }
    
    .input-section,
    .keyboard-section {
        padding: var(--spacing-md);
    }
    
    .input-header {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }
    
    .key {
        min-width: 38px;
        height: 46px;
    }
    
    .key .main {
        font-size: 1rem;
    }
    
    .key .shift {
        font-size: 0.55rem;
    }
    
    .key.space {
        min-width: 160px;
    }
    
    .key.special {
        min-width: 60px;
    }
    
    .key.backspace,
    .key.enter {
        min-width: 70px;
    }
    
    .key.shift-left,
    .key.shift-right {
        min-width: 75px;
    }
    
    .theme-toggle {
        width: 44px;
        height: 44px;
    }
    
    .theme-toggle svg {
        width: 20px;
        height: 20px;
    }
}

/* Responsive Design - Mobile */
@media (max-width: 480px) {
    .header {
        padding: var(--spacing-md);
        flex-direction: column;
        gap: var(--spacing-md);
    }
    
    .main-title {
        font-size: 1.5rem;
    }
    
    .typing-input {
        font-size: 1.125rem;
        min-height: 100px;
    }
    
    .key {
        min-width: 32px;
        height: 44px;
        border-radius: var(--radius-sm);
    }
    
    .key .main {
        font-size: 0.95rem;
    }
    
    .key.space {
        min-width: 100%;
        max-width: 300px;
    }
    
    .keyboard-row {
        gap: 4px;
    }
    
    /* Hide desktop-only elements on mobile */
    .desktop-only {
        display: none !important;
    }
    
    /* Show mobile-only elements */
    .mobile-only {
        display: flex !important;
    }
    
    .input-controls {
        width: 100%;
        justify-content: center;
    }
    
    .particle {
        display: none;
    }
    
    .particle:nth-child(1),
    .particle:nth-child(2),
    .particle:nth-child(3) {
        display: block;
        width: 100px !important;
        height: 100px !important;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
    
    .particle {
        display: none;
    }
}

/* Focus styles for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Selection color */
::selection {
    background: rgba(99, 102, 241, 0.3);
    color: var(--text-primary);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary-light) 0%, var(--primary) 100%);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
}
