@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800;900&family=Montserrat:wght@300;400;500;600;700;800&family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&display=swap');

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Scroll Fade Animations */
.fade-in-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s cubic-bezier(0.2, 0.8, 0.2, 1), transform 1s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.fade-in-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}


/* Global Font Settings */
:root {
    --font-ar: 'Cairo', sans-serif;
    --font-en: 'Montserrat', sans-serif;
}

[lang="ar"] {
    font-family: var(--font-ar);
}

[lang="en"] {
    font-family: var(--font-en);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.05);
}
.dark ::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
}
::-webkit-scrollbar-thumb {
    background: #0d9488;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #115e59;
}

/* Glowing background blobs */
.glow-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    z-index: 0;
    pointer-events: none;
    animation: floatBlob 12s infinite alternate ease-in-out;
}
.dark .glow-blob {
    opacity: 0.25;
}

@keyframes floatBlob {
    0% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(30px, -40px) scale(1.1);
    }
    100% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

/* Interactive Before/After Comparison Slider */
.before-after-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 1.5rem;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.dark .before-after-container {
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.slider-image-before {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16/10;
    object-fit: cover;
}

.slider-image-after {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    clip-path: polygon(0 0, var(--position, 50%) 0, var(--position, 50%) 100%, 0 100%);
    pointer-events: none;
}

.slider-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: col-resize;
    z-index: 30;
    margin: 0;
    padding: 0;
}

.slider-bar-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--position, 50%);
    width: 3px;
    background: linear-gradient(180deg, #d97706 0%, #eab308 100%);
    z-index: 20;
    transform: translateX(-50%);
    pointer-events: none;
    box-shadow: 0 0 10px rgba(234, 179, 8, 0.5);
}

.slider-handle-button {
    position: absolute;
    top: 50%;
    left: var(--position, 50%);
    width: 44px;
    height: 44px;
    background: #eab308;
    color: #ffffff;
    border: 4px solid #ffffff;
    border-radius: 50%;
    z-index: 20;
    transform: translate(-50%, -50%);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3), 0 0 15px rgba(234, 179, 8, 0.4);
    transition: transform 0.1s ease-out, background-color 0.2s;
}
.dark .slider-handle-button {
    border-color: #1e293b;
}

/* Glassmorphism styling overrides */
.glass-panel {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
}
.dark .glass-panel {
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Hover scales and modern elements */
.hover-card-effect {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.hover-card-effect:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(13, 148, 136, 0.15), 0 8px 10px -6px rgba(13, 148, 136, 0.1);
}
.dark .hover-card-effect:hover {
    box-shadow: 0 20px 25px -5px rgba(13, 148, 136, 0.3), 0 8px 10px -6px rgba(13, 148, 136, 0.2);
}

/* Custom Gold Button Glow */
.gold-btn-glow {
    position: relative;
    overflow: hidden;
}
.gold-btn-glow::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transform: rotate(45deg);
    transition: 0.5s;
    opacity: 0;
}
.gold-btn-glow:hover::after {
    left: 120%;
    opacity: 1;
}

/* RTL Support details */
[dir="rtl"] .slider-image-after {
    /* If the slider clip-path is absolute left-to-right, it remains correct. We'll handle input from left regardless of RTL */
}

/* Lightbox Modal Animation */
.lightbox-overlay {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Smooth Transitions for Theme Toggling */
body, header, footer, .glass-panel, a, button, input, select, textarea, div, span, i {
    transition: background-color 0.4s ease, border-color 0.4s ease, color 0.4s ease, box-shadow 0.4s ease;
}

/* Explicit Dark Mode Overrides for 100% Reliability */
.dark body {
    background-color: #020617 !important; /* slate-950 */
    color: #f8fafc !important; /* slate-50 */
}
.dark header, .dark footer, .dark .glass-panel {
    background-color: rgba(15, 23, 42, 0.75) !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
}
.dark input, .dark select, .dark textarea {
    background-color: rgba(2, 6, 23, 0.7) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
}
.dark input::placeholder, .dark textarea::placeholder {
    color: #475569 !important; /* slate-600 */
}
.dark select option {
    background-color: #0f172a !important; /* slate-900 */
    color: #ffffff !important;
}
.dark h1, .dark h2, .dark h3, .dark h4 {
    color: #ffffff !important;
}
.dark p, .dark label, .dark .text-slate-600, .dark .text-slate-500, .dark .text-slate-700 {
    color: #cbd5e1 !important; /* slate-300 */
}
.dark .bg-slate-100\/50, .dark .bg-slate-100 {
    background-color: rgba(15, 23, 42, 0.3) !important;
}
.dark .border-slate-200 {
    border-color: rgba(255, 255, 255, 0.05) !important;
}
.dark .text-slate-900 {
    color: #ffffff !important;
}
.dark .text-slate-800 {
    color: #f1f5f9 !important; /* slate-100 */
}
.dark .text-slate-700 {
    color: #cbd5e1 !important;
}

/* ========================================= */
/* 3D Flip Card Utilities */
/* ========================================= */
.perspective-1000 {
    perspective: 1000px;
}
.transform-style-3d {
    transform-style: preserve-3d;
}
.backface-hidden {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}
.rotate-y-180 {
    transform: rotateY(180deg);
}
.group:hover .group-hover\:rotate-y-180 {
    transform: rotateY(180deg);
}
.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}
.group:hover .flip-card-inner {
    transform: rotateY(180deg);
}
.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    top: 0;
    left: 0;
}
.flip-card-back {
    transform: rotateY(180deg);
}
