/* 
  Doaiah Beach - Mobile-Optimized CSS
  Colors: Red #D1232A | Dark #2E3033 | White #FFFFFF
*/

:root {
    --primary-red: #D1232A;
    --primary-red-glow: rgba(209, 35, 42, 0.4);
    --dark-bg: #111114;
    --card-bg: rgba(255, 255, 255, 0.06);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-white: #FFFFFF;
    --text-muted: #8a8a8f;
    --facebook: #1877F2;
    --instagram: #E4405F;
    --tiktok: #ff0050;
    --whatsapp: #25D366;
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

html {
    font-family: 'Cairo', sans-serif;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: var(--dark-bg);
    color: var(--text-white);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
    position: relative;
}

/* Lightweight ambient glow — no animation, no blur */
.background-animation {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(ellipse 60% 50% at 85% 10%, rgba(209, 35, 42, 0.12), transparent),
        radial-gradient(ellipse 50% 40% at 10% 90%, rgba(209, 35, 42, 0.06), transparent);
}

/* ── Container ── */
.container {
    width: 100%;
    max-width: 460px;
    padding: 1.5rem 1.25rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.75rem;
    z-index: 1;
}

/* ── Header ── */
.profile-header {
    text-align: center;
    position: relative;
    width: 100%;
    padding-top: 0.5rem;
}

/* Share button */
.share-icon-btn {
    position: absolute;
    top: 0;
    right: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.3s, background 0.3s;
    z-index: 10;
}

.share-icon-btn:active {
    background: rgba(255, 255, 255, 0.12);
    color: var(--primary-red);
    transform: scale(0.92);
}

.share-icon-btn i { font-size: 1.05rem; }

/* Profile image */
.profile-img-container {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: #fff;
    padding: 4px;
    margin: 0 auto 0.9rem;
    box-shadow:
        0 0 0 2px rgba(209, 35, 42, 0.3),
        0 8px 30px rgba(209, 35, 42, 0.2);
    /* Entrance animation */
    opacity: 0;
    animation: scaleIn 0.6s var(--ease-spring) 0.1s forwards;
}

.profile-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
    background-color: #fff;
}

.brand-name {
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: 0.3px;
    opacity: 0;
    animation: fadeSlideUp 0.5s var(--ease-out-expo) 0.25s forwards;
}

.brand-tagline {
    font-size: 0.95rem;
    color: var(--primary-red);
    font-weight: 700;
    margin-top: 0.15rem;
    opacity: 0;
    animation: fadeSlideUp 0.5s var(--ease-out-expo) 0.35s forwards;
}

/* ── Links ── */
.links-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.link-group {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    width: 100%;
}

.section-label {
    font-size: 0.8rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.35);
    text-transform: uppercase;
    letter-spacing: 2px;
    border-right: 3px solid var(--primary-red);
    padding-right: 10px;
    line-height: 1;
    margin-bottom: 0.15rem;
}

.link-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 0.95rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    color: var(--text-white);
    text-decoration: none;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    /* GPU-only transitions */
    transition: transform 0.25s var(--ease-out-expo), box-shadow 0.3s ease;
    transform: translate3d(0, 0, 0);
    /* Staggered entrance — set by JS */
    opacity: 0;
    transform: translateY(18px);
}

.link-btn:active {
    transform: scale(0.97) !important;
}

/* Ripple effect on tap */
.link-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--ripple-x, 50%) var(--ripple-y, 50%),
        rgba(255, 255, 255, 0.15) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
}

.link-btn.ripple-active::after {
    opacity: 1;
}

.link-btn i { font-size: 1.3rem; transition: color 0.3s; }

/* Icon highlight colors on hover/active */
.link-btn.facebook:active i { color: var(--facebook); }
.link-btn.instagram:active i { color: var(--instagram); }
.link-btn.tiktok:active i { color: var(--tiktok); }
.link-btn.messenger:active i { color: var(--facebook); }
.link-btn.phone:active i,
.link-btn.whatsapp:active i { color: var(--whatsapp); }
.link-btn.location-btn:active i { color: var(--primary-red); }

/* Hero Menu Button */
.menu-btn {
    background: linear-gradient(135deg, var(--primary-red) 0%, #9e131a 100%);
    border: none;
    box-shadow: 0 4px 20px rgba(209, 35, 42, 0.35);
    position: relative;
}

.menu-btn::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 16px;
    background: transparent;
    box-shadow: 0 0 0 0 rgba(209, 35, 42, 0.5);
    animation: menuPulse 2.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes menuPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(209, 35, 42, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(209, 35, 42, 0); }
}

.menu-btn:active {
    box-shadow: 0 2px 10px rgba(209, 35, 42, 0.5);
}

/* ── Modal Overlay ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    /* Solid dark bg — no expensive blur */
    background: rgba(0, 0, 0, 0.92);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    display: flex;
    pointer-events: all;
}

/* ── Flipbook Modal ── */
.modal-content {
    position: relative;
    width: 100vw;
    width: 100dvw;
    height: 100vh;
    height: 100dvh;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: visible;
}

.close-modal-btn {
    position: absolute;
    top: max(env(safe-area-inset-top, 8px), 8px);
    right: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.15rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: background 0.2s, transform 0.3s;
}

.close-modal-btn:active {
    background: var(--primary-red);
    transform: scale(0.9);
}

/* Flipbook Wrapper */
.flipbook-wrapper {
    width: 100%;
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 2000px;
    overflow: visible;
}

.dynamic-border-container {
    padding: 0;
    border: none;
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: visible;
    transform-origin: center center;
    transition: width 0.5s var(--ease-out-expo),
                height 0.5s var(--ease-out-expo),
                transform 0.5s var(--ease-out-expo);
}

/* Zoom controls — desktop only */
.zoom-controls-bar {
    position: relative;
    margin-top: 20px;
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 26px;
    border-radius: 50px;
    display: flex;
    gap: 30px;
    z-index: 10010;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.zoom-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.15rem;
    cursor: pointer;
    transition: transform 0.2s, color 0.2s;
    padding: 4px;
}

.zoom-btn:active {
    transform: scale(1.2);
    color: var(--primary-red);
}

/* ── FLIP PERFORMANCE ── */
/* During active flip: kill ALL CSS transitions on the container
   so the browser only composites the canvas flip, not CSS too */
.dynamic-border-container.is-flipping {
    transition: none !important;
    will-change: transform;
}

/* After flip ends, is-flipping is removed and transitions resume */
.dynamic-border-container:not(.is-flipping) {
    will-change: auto;
}

/* Zoom overlay */
.zoom-touch-overlay {
    position: absolute;
    inset: 0;
    z-index: 9999;
    cursor: default;
    display: block;
    pointer-events: none;
    touch-action: none;
}

/* خط وهمي في المنتصف - موبايل فقط */
@media (max-width: 768px) {
    .zoom-touch-overlay::before {
        content: '';
        position: absolute;
        left: 50%;
        top: 0;
        bottom: 0;
        width: 1px;
        background: rgba(255, 255, 255, 0.1);
        transform: translateX(-50%);
        pointer-events: none;
        opacity: 0.3;
        transition: opacity 0.3s;
    }

    .is-zoomed .zoom-touch-overlay::before {
        opacity: 0;
    }
}

.is-zoomed .zoom-touch-overlay {
    cursor: grab;
    pointer-events: all;
}

.is-zoomed .zoom-touch-overlay:active {
    cursor: grabbing;
}

/* السماح بالتفاعل مع الفليب بوك على الموبايل */
.flipbook {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    background-color: transparent;
    touch-action: pan-x;
}

.placeholder-text {
    padding: 3rem 1rem;
    color: var(--text-muted);
    font-size: 1rem;
}

/* Flipbook pages */
    background-color: #fff;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    position: relative;
    border-radius: 12px;
    /* Isolate each page so the browser doesn't repaint siblings during flip */
    contain: layout style paint;
}

.page[data-density="hard"] {
    background-color: #fdfdfd;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.25);
}

.logo-cover-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #ffffff 0%, #f5f5f5 100%);
    padding: 20px;
}

.cover-logo {
    width: 65%;
    max-width: 280px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.08));
    animation: gentleFloat 3.5s ease-in-out infinite;
}

@keyframes gentleFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.cover-footer {
    position: absolute;
    bottom: 35px;
    font-size: 0.85rem;
    color: var(--primary-red);
    font-weight: 700;
    letter-spacing: 2px;
}

/* Page fold shadows — lightweight */
.page.--left {
    box-shadow: inset -12px 0 15px -12px rgba(0, 0, 0, 0.2);
}

.page.--right {
    box-shadow: inset 12px 0 15px -12px rgba(0, 0, 0, 0.2);
}

.page-content {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* ── Footer ── */
footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 0.5rem;
    opacity: 0;
    animation: fadeSlideUp 0.5s var(--ease-out-expo) 1s forwards;
}

/* ── Location Popup ── */
.location-selection .location-popup {
    background: rgba(20, 20, 23, 0.97);
    width: 88%;
    max-width: 380px;
    padding: 1.75rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
    transform: scale(0.85) translate3d(0, 0, 0);
    transition: transform 0.4s var(--ease-spring);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.location-selection.active .location-popup {
    transform: scale(1) translate3d(0, 0, 0);
}

.location-popup h3 {
    margin-bottom: 1.25rem;
    font-size: 1.4rem;
    color: var(--text-white);
}

.location-options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 1.25rem;
}

.location-option-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0.9rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: var(--text-white);
    text-decoration: none;
    font-weight: 700;
    transition: background 0.3s, border-color 0.3s, transform 0.2s;
}

.location-option-btn:active {
    background: var(--primary-red);
    border-color: var(--primary-red);
    transform: scale(0.97);
}

.close-popup-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.5);
    padding: 0.7rem 1.8rem;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-family: 'Cairo', sans-serif;
    font-size: 0.95rem;
    transition: background 0.2s, color 0.2s;
}

.close-popup-btn:active {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

/* ── Toast ── */
.toast-container {
    position: fixed;
    bottom: max(env(safe-area-inset-bottom, 20px), 20px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 100000;
}

.toast {
    background: rgba(30, 30, 34, 0.95);
    color: white;
    padding: 11px 22px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    animation: toastIn 0.35s var(--ease-spring) forwards;
    display: flex;
    align-items: center;
    gap: 8px;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(16px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.toast.fade-out {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastOut {
    to { opacity: 0; transform: translateY(12px) scale(0.95); }
}

/* ── Flip Hint ── */
.flip-hint {
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 100000;
    pointer-events: none;
    color: rgba(0, 0, 0, 0.6);
    font-size: 2.2rem;
    animation: hintSwipe 2.5s ease-in-out infinite;
    opacity: 0.7;
    transition: opacity 0.4s;
}

.flip-hint i {
    transform: rotate(-30deg);
}

.flip-hint.hidden {
    opacity: 0;
}

@keyframes hintSwipe {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-16px, -8px); }
}

/* ── Mobile Nav Arrows ── */
.mobile-nav-arrows {
    display: none;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 35px;
    margin-top: 20px;
    padding-bottom: max(env(safe-area-inset-bottom, 10px), 10px);
    width: 100%;
    z-index: 10005;
}

.nav-arrow-btn {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    /* Liquid Glass Effect */
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
    color: white;
    font-size: 1.6rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s var(--ease-out-expo), opacity 0.3s, background 0.3s;
    transform: translate3d(0, 0, 0);
}

.nav-arrow-btn.disabled {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.nav-arrow-btn:active:not(.disabled) {
    transform: scale(0.88);
    background: rgba(255, 255, 255, 0.15);
}

/* ── Page counter (new) ── */
.page-counter {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 50px;
    text-align: center;
    letter-spacing: 1px;
    font-variant-numeric: tabular-nums;
}

/* ── Keyframes ── */
@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* ── Mobile ── */
@media (max-width: 768px) {
    .zoom-controls-bar {
        display: none !important;
    }

    .mobile-nav-arrows {
        display: flex;
    }

    .modal-content {
        justify-content: center;
        padding-bottom: 10px;
    }

    /* ── Mobile flip perf: strip all expensive paint on pages ── */
    .page {
        box-shadow: none !important;
        border-radius: 8px;
    }

    .page[data-density="hard"] {
        box-shadow: none !important;
    }

    .page.--left,
    .page.--right {
        box-shadow: none !important;
    }

    /* Remove pseudo-element page shadows */
    .page::after {
        display: none;
    }

    /* Simpler cover logo — no animation on mobile */
    .cover-logo {
        animation: none;
    }
}

/* Desktop hover states */
@media (hover: hover) and (pointer: fine) {
    .share-icon-btn:hover {
        background: rgba(255, 255, 255, 0.12);
        color: var(--primary-red);
    }

    .link-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
        border-color: rgba(209, 35, 42, 0.3);
    }

    .link-btn.facebook:hover i { color: var(--facebook); }
    .link-btn.instagram:hover i { color: var(--instagram); }
    .link-btn.tiktok:hover i { color: var(--tiktok); }
    .link-btn.messenger:hover i { color: var(--facebook); }
    .link-btn.phone:hover i,
    .link-btn.whatsapp:hover i { color: var(--whatsapp); }
    .link-btn.location-btn:hover i { color: var(--primary-red); }

    .menu-btn:hover {
        box-shadow: 0 6px 25px rgba(209, 35, 42, 0.5);
        transform: translateY(-3px);
    }

    .close-modal-btn:hover {
        background: var(--primary-red);
        transform: rotate(90deg);
    }

    .zoom-btn:hover {
        transform: scale(1.15);
        color: var(--primary-red);
    }

    .location-option-btn:hover {
        background: var(--primary-red);
        border-color: var(--primary-red);
        transform: translateY(-2px);
    }
}

/* Small phones */
@media (max-width: 360px) {
    .container {
        padding: 1.25rem 1rem 1.5rem;
    }

    .brand-name {
        font-size: 1.5rem;
    }

    .link-btn {
        padding: 0.85rem;
        font-size: 1rem;
    }

    .profile-img-container {
        width: 95px;
        height: 95px;
    }

    .nav-arrow-btn {
        width: 50px;
        height: 50px;
        font-size: 1.4rem;
    }
}

/* Tall phones — notch safe areas */
@supports (padding: max(0px)) {
    .modal-content {
        padding-top: max(env(safe-area-inset-top), 0px);
        padding-bottom: max(env(safe-area-inset-bottom), 0px);
    }
}
