* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Varela Round', sans-serif;
    background: linear-gradient(to bottom, white 0%, #fafaf9 30%, white 100%);
    min-height: 100vh;
    color: #1c1917;
    display: flex;
    flex-direction: column;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    flex: 1;
}

/* Hero Section */
.hero {
    padding-top: 120px;
    padding-bottom: 48px;
    text-align: center;
}

.hero-content {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
}

/* Main Title */
.main-title {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 52px;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.025em;
    margin-bottom: 12px;
}

.gradient-text {
    font-weight: 700;
    background: linear-gradient(90deg, #16a34a 0%, #ca8a04 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Subtitle */
.subtitle {
    font-family: 'Varela Round', sans-serif;
    font-size: 20px;
    font-weight: 400;
    color: #78716c;
    margin-bottom: 48px;
}

/* Search Bar */
.search-form {
    max-width: 48rem;
    margin: 0 auto;
    position: relative;
}

.search-wrapper {
    position: relative;
}

.search-glow {
    position: absolute;
    inset: -2px;
    background: linear-gradient(to right, rgba(22, 163, 74, 0.2), rgba(202, 138, 4, 0.2));
    border-radius: 1.5rem;
    filter: blur(12px);
    opacity: 0;
    transition: opacity 0.5s;
}

.search-wrapper:hover .search-glow {
    opacity: 1;
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border: 1px solid #f5f5f4;
    overflow: hidden;
}

.search-icon {
    position: absolute;
    left: 1.25rem;
    width: 20px;
    height: 20px;
    color: #a8a29e;
}

.search-input {
    width: 100%;
    padding: 1.25rem 1.25rem 1.25rem 3.5rem;
    font-size: 1.125rem;
    border: none;
    outline: none;
    background: transparent;
    font-family: 'Noto Sans Arabic', 'Varela Round', sans-serif;
}

.search-input::placeholder {
    color: #a8a29e;
}

.search-button {
    position: absolute;
    right: 0.5rem;
    background: linear-gradient(to right, #16a34a, #ca8a04);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-family: 'Varela Round', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.search-button:hover:not(:disabled) {
    background: linear-gradient(to right, #15803d, #b45309);
    transform: translateY(-1px);
}

.search-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.language-hint {
    margin-top: 1rem;
    font-size: 18px;
    color: #a8a29e;
    font-family: 'Varela Round', sans-serif;
}

/* Results Section */
.results-section {
    max-width: 56rem;
    margin: 0 auto;
    padding: 0 1rem 5rem 1rem;
}

/* Loading Animation */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 0;
    animation: fadeIn 0.3s ease;
}

.loading-spinner {
    position: relative;
    width: 4rem;
    height: 4rem;
    margin-bottom: 1.5rem;
}

.loading-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid #f5f5f4;
}

.loading-spin {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid transparent;
    border-top-color: #16a34a;
    border-right-color: #ca8a04;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: #78716c;
    font-family: 'Varela Round', sans-serif;
}

/* Error Message */
.error-message {
    text-align: center;
    padding: 3rem 0;
    color: #dc2626;
    font-family: 'Varela Round', sans-serif;
    animation: fadeIn 0.3s ease;
}

/* Results Card */
.results-card {
    background: white;
    border-radius: 1.5rem;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
    border: 1px solid #f5f5f4;
    transition: all 0.5s;
    animation: slideUp 0.4s ease;
}

.results-card:hover {
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.08);
}

/* Word Header */
.word-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
    .word-header {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
    }
}

.word-left {
    flex: 1;
}

.arabic-word-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.arabic-word {
    font-family: 'Noto Sans Arabic', sans-serif;
    font-size: 2.25rem;
    color: #292524;
    text-align: right;
    direction: rtl;
}

.speak-button {
    padding: 0.75rem;
    border-radius: 50%;
    background: linear-gradient(to right, #dcfce7, #fef9c3);
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.speak-button:hover {
    background: linear-gradient(to right, #bbf7d0, #fef08a);
}

.speak-button i {
    color: #16a34a;
    font-size: 1.25rem;
}

.pronunciation {
    font-size: 1.125rem;
    color: #78716c;
    font-style: italic;
    font-family: 'Varela Round', sans-serif;
}

.word-right {
    text-align: right;
}

.part-of-speech {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #a8a29e;
    font-family: 'Varela Round', sans-serif;
}

.english-meaning {
    font-size: 1.5rem;
    font-weight: 600;
    color: #292524;
    margin-top: 0.25rem;
    font-family: 'Varela Round', sans-serif;
}

/* Divider */
.divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(to right, transparent, #e7e5e4, transparent);
    margin: 1.5rem 0;
}

/* Definition */
.definition-section {
    margin-bottom: 2rem;
}

.section-title {
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #a8a29e;
    margin-bottom: 0.75rem;
    font-family: 'Varela Round', sans-serif;
}

.definition-text {
    color: #44403c;
    line-height: 1.6;
    font-size: 1.125rem;
    font-family: 'Varela Round', sans-serif;
}

/* Regional Note */
.regional-note {
    margin-bottom: 2rem;
    padding: 1rem;
    background: linear-gradient(to right, rgba(220, 252, 231, 0.5), rgba(254, 249, 195, 0.5));
    border-radius: 1rem;
    border: 1px solid rgba(134, 239, 172, 0.3);
}

.regional-text {
    font-size: 0.875rem;
    color: #44403c;
    font-family: 'Varela Round', sans-serif;
}

.regional-label {
    font-weight: 500;
    color: #15803d;
}

/* MSA Note */
.msa-note {
    margin-bottom: 2rem;
    padding: 1rem;
    background: linear-gradient(to right, rgba(219, 234, 254, 0.5), rgba(224, 242, 254, 0.5));
    border-radius: 1rem;
    border: 1px solid rgba(96, 165, 250, 0.3);
}

.msa-text {
    font-size: 0.875rem;
    color: #1e40af;
    font-family: 'Varela Round', sans-serif;
}

.msa-label {
    font-weight: 500;
    color: #1d4ed8;
}

/* Examples */
.examples-section {
    margin-top: 2rem;
}

.example-item {
    padding-left: 1.25rem;
    border-left: 2px solid;
    margin-bottom: 1.5rem;
}

.example-item:nth-child(1) {
    border-left-color: #16a34a;
}

.example-item:nth-child(2) {
    border-left-color: #ca8a04;
}

.example-arabic-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.example-arabic {
    font-family: 'Noto Sans Arabic', sans-serif;
    font-size: 1.25rem;
    color: #292524;
    text-align: right;
    direction: rtl;
    flex: 1;
}

.example-speak-button {
    padding: 0.5rem;
    border-radius: 50%;
    border: none;
    background: none;
    cursor: pointer;
    transition: background-color 0.3s;
}

.example-speak-button:hover {
    background-color: #f5f5f4;
}

.example-speak-button i {
    color: #a8a29e;
    font-size: 1rem;
}

.example-transliteration {
    color: #78716c;
    font-style: italic;
    margin-bottom: 0.5rem;
    font-family: 'Varela Round', sans-serif;
}

.example-english {
    color: #57534e;
    font-family: 'Varela Round', sans-serif;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 4rem 0;
    animation: fadeIn 0.3s ease;
}

.no-results-icon {
    width: 5rem;
    height: 5rem;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    background: #f5f5f4;
    display: flex;
    align-items: center;
    justify-content: center;
}

.no-results-icon i {
    font-size: 2rem;
    color: #a8a29e;
}

.no-results-text {
    color: #57534e;
    font-size: 1.125rem;
    font-family: 'Varela Round', sans-serif;
}

/* Cache Indicator */
.cache-indicator {
    display: inline-block;
    background: #f5f5f4;
    color: #78716c;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* Footer */
.footer {
    position: relative;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem 0;
    margin-top: auto;
    background: linear-gradient(to top, white, transparent);
    text-align: center;
}

.footer-text {
    font-size: 14px;
    color: #a8a29e;
    font-family: 'Varela Round', sans-serif;
}

.footer-link {
    color: #a8a29e;
    text-decoration: none;
}

.footer-link:hover {
    color: #78716c;
}

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

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

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .hero {
        padding-top: 60px;
        padding-bottom: 32px;
    }
    
    .main-title {
        font-size: 36px;
    }
    
    .subtitle {
        font-size: 18px;
    }
    
    .language-hint {
        font-size: 16px;
    }
    
    .results-card {
        padding: 1.5rem;
    }
    
    .arabic-word {
        font-size: 1.75rem;
    }
    
    .english-meaning {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .main-title {
        font-size: 28px;
    }
    
    .search-input {
        font-size: 1rem;
        padding: 1rem 1rem 1rem 3rem;
    }
    
    .search-button {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}

/* ==============================================
   THEME TOGGLE - Dark/Light Mode
   ============================================== */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #f2b22c;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.theme-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.theme-toggle svg {
    width: 24px;
    height: 24px;
    stroke: white;
    stroke-width: 2;
    fill: none;
}

.theme-toggle .moon-icon {
    display: none;
}

.theme-toggle .sun-icon {
    display: block;
}

body.dark-mode .theme-toggle .sun-icon {
    display: none;
}

body.dark-mode .theme-toggle .moon-icon {
    display: block;
}

body.dark-mode {
    background: #1a1a1a;
    color: #e0e0e0;
}

body.dark-mode .results-card {
    background: #2d2d2d;
    border-color: #404040;
}

body.dark-mode .search-container {
    background: #2d2d2d;
    border-color: #404040;
}

body.dark-mode .search-input {
    color: #e0e0e0;
    background: transparent;
}

body.dark-mode .search-input::placeholder {
    color: #888;
}

body.dark-mode .definition-text,
body.dark-mode .pronunciation,
body.dark-mode .example-english,
body.dark-mode .example-transliteration,
body.dark-mode .regional-text,
body.dark-mode .msa-text {
    color: #c0c0c0;
}

body.dark-mode .english-meaning,
body.dark-mode .arabic-word {
    color: #ffffff;
}

body.dark-mode .footer {
    background: linear-gradient(to top, #1a1a1a, transparent);
}

body.dark-mode .footer-text,
body.dark-mode .footer-link {
    color: #888;
}

body.dark-mode .regional-note {
    background: linear-gradient(to right, rgba(34, 197, 94, 0.15), rgba(234, 179, 8, 0.15));
    border-color: rgba(34, 197, 94, 0.2);
}

body.dark-mode .msa-note {
    background: linear-gradient(to right, rgba(59, 130, 246, 0.15), rgba(96, 165, 250, 0.15));
    border-color: rgba(59, 130, 246, 0.2);
}

body.dark-mode .divider {
    background: linear-gradient(to right, transparent, #404040, transparent);
}

body.dark-mode .part-of-speech,
body.dark-mode .section-title {
    color: #888;
}

body.dark-mode .cache-indicator {
    background: #404040;
    color: #aaa;
}

body.dark-mode .no-results-icon {
    background: #2d2d2d;
}

body.dark-mode .no-results-icon i {
    color: #666;
}

body.dark-mode .no-results-text {
    color: #aaa;
}
