/* ===================================
   Prayer Times App - Enhanced Styles
   ================================== */

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
    background: #059669;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #047857;
}

/* Base Styles */
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Cairo', sans-serif;
}

/* Utilities */
.dir-ltr {
    direction: ltr;
    display: inline-block;
}

/* Animations */
@keyframes pulse-slow {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(0.98);
    }
}

@keyframes slide-up {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slide-down {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes bounce-subtle {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

.animate-pulse-slow {
    animation: pulse-slow 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-slide-up {
    animation: slide-up 0.4s ease-out;
}

.animate-slide-down {
    animation: slide-down 0.4s ease-out;
}

.animate-fade-in {
    animation: fade-in 0.3s ease-in;
}

/* Mobile Select Styling Fix */
select {
    background-image: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Table Optimization */
table {
    table-layout: fixed;
    width: 100%;
}

.overflow-x-auto {
    -webkit-overflow-scrolling: touch;
}

/* Text Selection Color */
::selection {
    background-color: #10b981;
    color: white;
}

/* Focus Styles for Accessibility */
button:focus,
a:focus,
select:focus {
    outline: 2px solid #10b981;
    outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
select:focus:not(:focus-visible) {
    outline: none;
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Enhanced Hover Effects */
.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Card Styles */
.card {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Responsive Typography */
@media (max-width: 640px) {
    body {
        font-size: 14px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
}

/* Print Styles */
@media print {
    header,
    footer,
    #install-banner,
    #notification-banner,
    .no-print {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    table {
        page-break-inside: avoid;
    }
    
    tr {
        page-break-inside: avoid;
    }
    
    /* Ensure colors are visible in print */
    * {
        color: black !important;
        background: white !important;
    }
    
    table thead {
        background: #f3f4f6 !important;
        color: black !important;
    }
    
    .bg-emerald-50 {
        background: #f0fdf4 !important;
    }
}

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #ef4444;
    color: white;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    z-index: 9999;
    animation: slide-down 0.3s ease;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: #059669;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    font-weight: 600;
    z-index: 9999;
    animation: slide-up 0.3s ease;
}

.toast.error {
    background: #ef4444;
}

.toast.info {
    background: #3b82f6;
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    /* Add dark mode styles if needed */
}

/* Smooth Transitions */
* {
    transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform;
    transition-duration: 150ms;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Improved Button Styles */
button,
.btn {
    cursor: pointer;
    user-select: none;
    position: relative;
    overflow: hidden;
}

button:active,
.btn:active {
    transform: scale(0.98);
}

button::before,
.btn::before {
    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;
}

button:active::before,
.btn:active::before {
    width: 300px;
    height: 300px;
}

/* Improved Table Responsiveness */
@media (max-width: 768px) {
    table {
        font-size: 0.75rem;
    }
    
    th, td {
        padding: 0.5rem !important;
    }
}

/* Enhanced Loading State */
.loading-shimmer {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Accessibility Improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    button,
    a {
        border: 2px solid currentColor;
    }
    
    .text-emerald-600 {
        color: #047857 !important;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* PWA Install Prompt */
.pwa-prompt {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Enhanced Shadow Effects */
.shadow-soft {
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
}

.shadow-hard {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* Gradient Backgrounds */
.bg-gradient-emerald {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
}

.bg-gradient-teal {
    background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
}

/* Custom Checkbox/Radio Styles (if needed) */
input[type="checkbox"],
input[type="radio"] {
    accent-color: #059669;
}

/* Loading Spinner */
.spinner {
    border: 4px solid rgba(5, 150, 105, 0.2);
    border-top-color: #059669;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

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

/* Improved Link Styles */
a {
    text-decoration: none;
    position: relative;
}

a:hover {
    text-decoration: underline;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-error {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Improved Form Inputs */
input[type="text"],
input[type="email"],
input[type="tel"],
textarea {
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 0.75rem;
    font-family: 'Cairo', sans-serif;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

/* Tooltip Styles */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 1rem;
    background: #1f2937;
    color: white;
    font-size: 0.75rem;
    border-radius: 0.375rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

[data-tooltip]:hover::after {
    opacity: 1;
}

/* Modal Backdrop */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 50;
    animation: fade-in 0.2s ease;
}

/* Performance Optimization */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

/* GPU Acceleration */
.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
}
