/* floating-icons.css - Creative Radial Glass Design */

/* =========================
   FLOATING MENU WRAPPER
========================= */
.floating-menu-wrapper {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 99999;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    width: auto;
    height: auto;
    -webkit-touch-callout: none;
}

/* =========================
   TOGGLE BUTTON - Glass Orb
========================= */
.floating-menu-toggle {
    width: 64px;
    height: 64px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: radial-gradient(circle at 30% 25%, rgba(255,255,255,0.4), rgba(255,255,255,0.05));
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow:
        0 8px 40px rgba(0, 0, 0, 0.2),
        inset 0 2px 0 rgba(255, 255, 255, 0.5),
        inset 0 -2px 0 rgba(255, 255, 255, 0.1),
        0 0 60px rgba(153, 184, 102, 0.15);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.floating-menu-toggle::before {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: radial-gradient(circle at 70% 30%, rgba(255,255,255,0.2), transparent 70%);
    pointer-events: none;
}

.floating-menu-toggle::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    padding: 3px;
    background: conic-gradient(from 0deg, rgba(153,184,102,0.3), rgba(255,255,255,0.1), rgba(153,184,102,0.3));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    animation: spinGlow 6s linear infinite;
}

@keyframes spinGlow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.floating-menu-toggle:active {
    transform: scale(0.9) rotate(15deg);
}

.floating-menu-toggle span {
    width: 22px;
    height: 2.5px;
    border-radius: 20px;
    background: #99b866;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    display: block;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.floating-menu-toggle span:nth-child(2) {
    width: 16px;
}

/* =========================
   MODAL OVERLAY - Dark Bloom
========================= */
.floating-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(0,0,0,0.1), rgba(0,0,0,0.5));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    -webkit-tap-highlight-color: transparent;
}

.floating-menu-wrapper.modal-open .floating-modal-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* =========================
   MODAL CARD - Morphing Glass Ring
========================= */
.floating-modal-card {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: 50%;
    padding: 40px;
    width: 320px;
    height: 320px;
    max-width: 85vw;
    max-height: 85vw;
    box-shadow: 
        0 30px 80px rgba(0, 0, 0, 0.3),
        inset 0 2px 0 rgba(255, 255, 255, 0.4),
        inset 0 -2px 0 rgba(255, 255, 255, 0.05),
        0 0 100px rgba(153, 184, 102, 0.08);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    transform: scale(0.3) rotate(-30deg);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.5s ease;
    opacity: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-transform: scale(0.3) rotate(-30deg);
    animation: pulseRing 3s ease-in-out infinite;
}

@keyframes pulseRing {
    0%, 100% { 
        box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3), 0 0 100px rgba(153, 184, 102, 0.08);
    }
    50% { 
        box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3), 0 0 150px rgba(153, 184, 102, 0.15);
    }
}

.floating-modal-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.12) 0%, transparent 50%);
    pointer-events: none;
    border-radius: 50%;
}

.floating-modal-card::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    padding: 2px;
    background: conic-gradient(from 120deg, transparent, rgba(153,184,102,0.2), transparent, rgba(255,255,255,0.1), transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    animation: spinRing 8s linear infinite;
}

@keyframes spinRing {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.floating-menu-wrapper.modal-open .floating-modal-card {
    transform: scale(1) rotate(0deg);
    opacity: 1;
    -webkit-transform: scale(1) rotate(0deg);
}

/* =========================
   MODAL CLOSE BUTTON - Floating Star
========================= */
.floating-modal-close {
    position: absolute;
    top: -10px;
    right: -10px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-weight: 300;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    -webkit-tap-highlight-color: transparent;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    z-index: 1;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    text-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.floating-modal-close:active {
    transform: scale(0.8) rotate(90deg);
    background: rgba(255, 255, 255, 0.3);
}

/* =========================
   MODAL ITEMS - Radial Orbit Layout
========================= */
.floating-modal-items {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    width: 100%;
    height: 100%;
    align-content: center;
    justify-items: center;
    position: relative;
    z-index: 1;
    padding: 10px;
}

/* =========================
   MENU ITEM - Floating Orb Cards
========================= */
.floating-menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 12px 8px;
    border-radius: 50%;
    aspect-ratio: 1;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: #fff;
    font-weight: 600;
    font-size: 11px;
    font-family: 'IBM Plex Sans Arabic', 'IBM Plex Sans', sans-serif;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    appearance: none;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    position: relative;
    overflow: hidden;
    text-align: center;
    letter-spacing: 0.3px;
    text-shadow: 0 1px 8px rgba(0,0,0,0.2);
}

.floating-menu-item::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 60% 30%, rgba(255,255,255,0.08), transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.floating-menu-item:hover::before {
    opacity: 1;
}

.floating-menu-item:active {
    transform: scale(0.85) rotate(10deg);
    background: rgba(153, 184, 102, 0.15);
}

.floating-menu-item:nth-child(1) {
    animation-delay: 0.05s;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
}

.floating-menu-item:nth-child(2) {
    animation-delay: 0.10s;
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.floating-menu-item:nth-child(3) {
    animation-delay: 0.15s;
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.11);
}

.floating-menu-item:nth-child(4) {
    animation-delay: 0.20s;
    background: rgba(153, 184, 102, 0.08);
    border-color: rgba(153, 184, 102, 0.15);
}

.floating-menu-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
    -webkit-user-drag: none;
    user-drag: none;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.1));
    transition: transform 0.3s ease;
}

.floating-menu-item:active .floating-menu-icon {
    transform: scale(1.1);
}

.floating-menu-item span {
    font-size: 10px;
    opacity: 0.9;
    line-height: 1.2;
    max-width: 60px;
    word-break: break-word;
}

/* =========================
   MOBILE ADJUSTMENTS
========================= */
@media (max-width: 480px) {
    .floating-menu-wrapper {
        bottom: 14px;
        left: 14px;
    }

    .floating-menu-toggle {
        width: 56px;
        height: 56px;
    }

    .floating-menu-toggle span {
        width: 18px;
        height: 2.5px;
    }
    
    .floating-menu-toggle span:nth-child(2) {
        width: 12px;
    }

    .floating-modal-card {
        width: 260px;
        height: 260px;
        padding: 30px;
    }

    .floating-modal-items {
        gap: 10px;
        padding: 5px;
    }

    .floating-menu-item {
        padding: 8px 4px;
        gap: 4px;
    }

    .floating-menu-icon {
        width: 28px;
        height: 28px;
    }

    .floating-menu-item span {
        font-size: 9px;
        max-width: 50px;
    }

    .floating-modal-close {
        width: 32px;
        height: 32px;
        font-size: 15px;
        top: -8px;
        right: -8px;
    }
}

@media (max-width: 380px) {
    .floating-modal-card {
        width: 220px;
        height: 220px;
        padding: 24px;
    }
    
    .floating-menu-icon {
        width: 24px;
        height: 24px;
    }
    
    .floating-menu-item span {
        font-size: 8px;
        max-width: 40px;
    }
}

/* =========================
   ANIMATION FOR MODAL ITEMS (stagger)
========================= */
.floating-menu-wrapper.modal-open .floating-menu-item {
    animation: orbitIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.floating-menu-wrapper.modal-open .floating-menu-item:nth-child(1) { animation-delay: 0.10s; }
.floating-menu-wrapper.modal-open .floating-menu-item:nth-child(2) { animation-delay: 0.15s; }
.floating-menu-wrapper.modal-open .floating-menu-item:nth-child(3) { animation-delay: 0.20s; }
.floating-menu-wrapper.modal-open .floating-menu-item:nth-child(4) { animation-delay: 0.25s; }

@keyframes orbitIn {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.5) rotate(-20deg);
        -webkit-transform: translateY(40px) scale(0.5) rotate(-20deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
        -webkit-transform: translateY(0) scale(1) rotate(0deg);
    }
}

/* =========================
   SAFARI & FALLBACK SUPPORT
========================= */
@supports (-webkit-backdrop-filter: none) {
    .floating-modal-card {
        background: rgba(255, 255, 255, 0.08);
    }
    .floating-modal-overlay {
        background: rgba(0, 0, 0, 0.25);
    }
    .floating-menu-toggle {
        background: radial-gradient(circle at 30% 25%, rgba(255,255,255,0.4), rgba(255,255,255,0.05));
    }
}

@supports not (backdrop-filter: blur(1px)) {
    .floating-modal-card {
        background: rgba(30, 30, 40, 0.85);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    .floating-modal-overlay {
        background: rgba(0, 0, 0, 0.5);
    }
    .floating-menu-toggle {
        background: rgba(255, 255, 255, 0.25);
    }
    .floating-menu-item {
        background: rgba(255, 255, 255, 0.06);
    }
}

/* RTL Support for Arabic */
html[dir="rtl"] .floating-modal-close {
    right: auto;
    left: -10px;
}

html[dir="rtl"] .floating-menu-item {
    flex-direction: column;
}

@media (max-width: 480px) {
    html[dir="rtl"] .floating-modal-close {
        right: auto;
        left: -8px;
    }
}