/* ===== My Quran PWA - Complete Style Sheet ===== */

/* ===== Custom Font Settings & CSS Variables ===== */
:root {
    /* Font Sizes */
    --font-size-small: 0.875rem;
    --font-size-medium: 1rem;
    --font-size-large: 1.125rem;
    --font-size-xlarge: 1.25rem;
    
    /* Colors */
    --font-color: #1f2937;
    --heading-color: #000000;
    --primary-color: #10b981;
    --primary-dark: #059669;
    --primary-light: #d1fae5;
    --secondary-color: #f59e0b;
    --danger-color: #ef4444;
    --success-color: #22c55e;
    --warning-color: #f97316;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
    
    /* Z-index */
    --z-dropdown: 50;
    --z-modal: 100;
    --z-popover: 150;
    --z-tooltip: 200;
}

/* ===== Dark Theme Variables ===== */
.dark {
    --font-color: #e5e7eb;
    --heading-color: #f3f4f6;
    --primary-light: #064e3b;
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-tertiary: #374151;
    --border-color: #4b5563;
}

/* ===== Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--font-color);
    line-height: 1.6;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* ===== Font Size Classes ===== */
.font-small { font-size: var(--font-size-small); }
.font-medium { font-size: var(--font-size-medium); }
.font-large { font-size: var(--font-size-large); }
.font-xlarge { font-size: var(--font-size-xlarge); }

.font-small p, 
.font-small span, 
.font-small div:not(.arabic-text):not(.urdu-text) { 
    font-size: var(--font-size-small); 
}

.font-medium p, 
.font-medium span, 
.font-medium div:not(.arabic-text):not(.urdu-text) { 
    font-size: var(--font-size-medium); 
}

.font-large p, 
.font-large span, 
.font-large div:not(.arabic-text):not(.urdu-text) { 
    font-size: var(--font-size-large); 
}

.font-xlarge p, 
.font-xlarge span, 
.font-xlarge div:not(.arabic-text):not(.urdu-text) { 
    font-size: var(--font-size-xlarge); 
}

/* ===== Arabic Text Styles ===== */
.arabic-text {
    font-family: 'Amiri', 'Traditional Arabic', 'Scheherazade', 'Times New Roman', serif;
    line-height: 2.2;
    font-weight: 400;
    word-spacing: 0.1em;
    letter-spacing: 0.01em;
}

/* ===== Urdu Text Styles - Multiple Fallbacks ===== */
.urdu-text, 
.font-urdu,
[class*="urdu"] {
    font-family: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', 'Urdu Typesetting', 'Alvi Nastaleeq', 'Times New Roman', serif;
    line-height: 2.2;
    font-size: 1.1em;
    word-spacing: 0.05em;
}

/* ===== Flag Emoji Styling ===== */
.flag-emoji {
    font-size: 2rem;
    line-height: 1;
    display: inline-block;
}

.flag-circle {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    border: 2px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-md);
}

/* ===== Glass Card Effect ===== */
.glass-card {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.dark .glass-card {
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes slideIn {
    from { 
        transform: translateX(-100%); 
    }
    to { 
        transform: translateX(0); 
    }
}

@keyframes slideInRight {
    from { 
        transform: translateX(100%); 
    }
    to { 
        transform: translateX(0); 
    }
}

@keyframes scaleIn {
    from { 
        transform: scale(0.95); 
        opacity: 0; 
    }
    to { 
        transform: scale(1); 
        opacity: 1; 
    }
}

@keyframes pulse {
    0%, 100% { 
        opacity: 1; 
    }
    50% { 
        opacity: 0.5; 
    }
}

@keyframes spin {
    0% { 
        transform: rotate(0deg); 
    }
    100% { 
        transform: rotate(360deg); 
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.animate-fade-in {
    animation: fadeIn var(--transition-normal) ease-out;
}

.animate-slide-in {
    animation: slideIn var(--transition-normal) ease-out;
}

.animate-slide-in-right {
    animation: slideInRight var(--transition-normal) ease-out;
}

.animate-scale-in {
    animation: scaleIn var(--transition-normal) ease-out;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* ===== Bismillah Animation ===== */
.bismillah-container {
    transition: all var(--transition-normal) ease;
}

.bismillah-hidden {
    opacity: 0;
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    visibility: hidden;
}

/* ===== Custom Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: var(--radius-full);
    transition: background var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

.dark ::-webkit-scrollbar-track {
    background: #1f2937;
}

.dark ::-webkit-scrollbar-thumb {
    background: #34d399;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #10b981;
}

/* Hide scrollbar for mobile but keep functionality */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* ===== Navigation Links ===== */
.nav-link {
    position: relative;
    padding-bottom: 4px;
    transition: color var(--transition-fast);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
    border-radius: var(--radius-full);
    transform: scaleX(0);
    transition: transform var(--transition-fast);
}

.nav-link:hover::after,
.nav-link.active::after {
    transform: scaleX(1);
}

.nav-link.active {
    color: var(--primary-color);
    font-weight: 600;
}

/* ===== Country Cards ===== */
.country-btn {
    transition: all var(--transition-normal);
    border: 2px solid transparent;
}

.country-btn:hover {
    transform: translateY(-4px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
}

.country-btn.active {
    border-color: var(--primary-color);
    background: rgba(16, 185, 129, 0.1);
}

/* ===== Loading Spinner ===== */
.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

.dark .loading-spinner {
    border-color: #374151;
    border-top-color: var(--primary-color);
}

/* ===== Cards Styling ===== */
.dua-card, 
.ayat-card, 
.surah-card,
.download-card {
    transition: all var(--transition-normal);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.dark .dua-card,
.dark .ayat-card,
.dark .surah-card,
.dark .download-card {
    background: rgba(31, 41, 55, 0.7);
    border: 1px solid rgba(75, 85, 99, 0.3);
}

.dua-card:hover, 
.ayat-card:hover, 
.surah-card:hover,
.download-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: rgba(16, 185, 129, 0.3);
}

/* ===== Translation Tabs ===== */
.translation-tab {
    transition: all var(--transition-fast);
    cursor: pointer;
}

.translation-tab.active {
    background: var(--primary-color);
    color: white;
}

.translation-tab:not(.active):hover {
    background: rgba(16, 185, 129, 0.1);
}

/* ===== Category Pills ===== */
.category-pill {
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-full);
    background: #f3f4f6;
    color: #4b5563;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    white-space: nowrap;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.dark .category-pill {
    background: #374151;
    color: #e5e7eb;
}

.category-pill:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.category-pill.active {
    background: var(--primary-color);
    color: white;
}

/* ===== Carousel Styles ===== */
.carousel-container {
    position: relative;
    overflow: hidden;
}

.carousel-inner {
    display: flex;
    transition: transform var(--transition-normal);
}

.carousel-item {
    flex: 0 0 100%;
    transition: opacity var(--transition-fast);
}

.carousel-indicator {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: #d1d5db;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.dark .carousel-indicator {
    background: #6b7280;
}

.carousel-indicator.active {
    background: var(--primary-color);
    width: 24px;
}

.carousel-button {
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-color);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-fast);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.dark .carousel-button {
    background: rgba(31, 41, 55, 0.9);
    color: var(--primary-color);
}

.carousel-button:hover {
    background: white;
    transform: scale(1.1);
}

.dark .carousel-button:hover {
    background: #1f2937;
}

/* ===== Offline Indicator ===== */
.offline-indicator {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: var(--danger-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 500;
    display: none;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-lg);
    z-index: var(--z-tooltip);
    animation: slideInRight var(--transition-normal);
}

.offline .offline-indicator {
    display: flex;
}

/* ===== Install/Update Buttons ===== */
.install-button,
.update-button {
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.install-button::after,
.update-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.install-button:active::after,
.update-button:active::after {
    width: 200px;
    height: 200px;
}

/* ===== Modal Styles ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    animation: fadeIn var(--transition-normal);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: scaleIn var(--transition-normal);
    box-shadow: var(--shadow-xl);
}

.dark .modal-content {
    background: #1f2937;
}

/* ===== Form Elements ===== */
input, 
select, 
textarea {
    transition: all var(--transition-fast);
}

input:focus, 
select:focus, 
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* ===== Tooltips ===== */
.tooltip {
    position: relative;
}

.tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: var(--z-tooltip);
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow-md);
}

/* ===== Progress Bar ===== */
.progress-bar {
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: var(--radius-full);
    overflow: hidden;
}

.dark .progress-bar {
    background: #4b5563;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width var(--transition-normal);
    border-radius: var(--radius-full);
}

/* ===== Toast Notifications ===== */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    color: #1f2937;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideInRight var(--transition-normal);
    z-index: var(--z-tooltip);
    max-width: 400px;
    border-left: 4px solid var(--primary-color);
}

.dark .toast {
    background: #1f2937;
    color: #e5e7eb;
    border-left-color: var(--primary-color);
}

.toast.success {
    border-left-color: var(--success-color);
}

.toast.error {
    border-left-color: var(--danger-color);
}

.toast.warning {
    border-left-color: var(--warning-color);
}

/* ===== Responsive Design ===== */
@media (max-width: 640px) {
    :root {
        --font-size-small: 0.75rem;
        --font-size-medium: 0.875rem;
        --font-size-large: 1rem;
        --font-size-xlarge: 1.125rem;
        --spacing-xl: 1.5rem;
    }
    
    .arabic-text {
        font-size: 1.25rem;
        line-height: 2;
    }
    
    .urdu-text {
        font-size: 1rem;
        line-height: 2;
    }
    
    .flag-circle {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
    
    .carousel-button {
        width: 40px;
        height: 40px;
    }
    
    .category-pill {
        padding: 0.375rem 1rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .modal-content {
        padding: var(--spacing-lg);
        width: 95%;
    }
    
    .toast {
        left: 20px;
        right: 20px;
        max-width: none;
    }
}

/* ===== Print Styles ===== */
@media print {
    header, 
    footer, 
    .no-print,
    .carousel-button,
    .modal,
    .offline-indicator,
    .install-button,
    .update-button {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .glass-card,
    .dua-card,
    .ayat-card,
    .surah-card,
    .download-card {
        background: white !important;
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }
    
    .arabic-text {
        color: black !important;
    }
}

/* ===== Dark Mode Adjustments ===== */
.dark .glass-card {
    background: rgba(17, 24, 39, 0.7);
}

.dark .arabic-text {
    color: #e5e7eb;
}

.dark .urdu-text {
    color: #e5e7eb;
}

.dark .text-gray-600 {
    color: #9ca3af !important;
}

.dark .text-gray-700 {
    color: #d1d5db !important;
}

.dark .bg-white {
    background-color: #1f2937 !important;
}

.dark .border-gray-200 {
    border-color: #4b5563 !important;
}

/* ===== Utility Classes ===== */
.text-primary { color: var(--primary-color); }
.bg-primary { background-color: var(--primary-color); }
.border-primary { border-color: var(--primary-color); }

.shimmer {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

.dark .shimmer {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
    background-size: 1000px 100%;
}

/* ===== Focus Styles for Accessibility ===== */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ===== Selection Color ===== */
::selection {
    background: var(--primary-color);
    color: white;
}

::-moz-selection {
    background: var(--primary-color);
    color: white;
}