/**
 * Developer: Mohammed Al-Baqer
 * Website: https://wsl-iq.github.io/teaafi/
 * Copyright (c) 2026 Mohammed Al-Baqer
 * Folder : css
 * File   : quick-actions.css
 * Type   : CSS
 */

/* 
 * QUICK ACTIONS — FLOATING BUTTON (TOP LEFT)
 * Visible only on home page.
 * Fades out when scrolling down.
 */

.quick-actions-container {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 9998;
    pointer-events: none;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.35s ease,
                transform 0.35s ease;
}

/* Hidden by default (non-home pages) */
.quick-actions-container.qa-hidden {
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
}

.quick-actions-container.qa-hidden * {
    pointer-events: none;
}

/* Fade out on scroll down */
.quick-actions-container.qa-scrolled {
    opacity: 0;
    transform: translateY(-20px);
}

.quick-actions-container * {
    pointer-events: auto;
}

.quick-actions-container.qa-hidden *,
.quick-actions-container.qa-scrolled * {
    pointer-events: none;
}

/*  MAIN FAB (Floating Action Button) */

.quick-actions-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.4);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.3s ease,
                box-shadow 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    overflow: hidden;
    animation: quickActionsFloat 3s ease-in-out infinite;
}

@keyframes quickActionsFloat {
    0%, 100% {
        transform: translateY(0);
        box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.4);
    }
    50% {
        transform: translateY(-4px);
        box-shadow: 0 10px 24px rgba(var(--primary-rgb), 0.5);
    }
}

.quick-actions-fab:hover {
    animation-play-state: paused;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(var(--primary-rgb), 0.5);
}

.quick-actions-fab:active {
    transform: scale(0.92);
}

/* HAMBURGER ICON (Three Lines) */

.quick-actions-fab .fab-icon {
    position: relative;
    width: 22px;
    height: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s ease;
}

.quick-actions-fab .fab-line {
    display: block;
    width: 100%;
    height: 2.5px;
    background: white;
    border-radius: 2px;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

/* Open State — Lines become X */
.quick-actions-container.open .quick-actions-fab {
    background: linear-gradient(135deg, #EF5350, #E53935);
    box-shadow: 0 6px 20px rgba(239, 83, 80, 0.5);
    animation: none;
    transform: rotate(180deg);
}

.quick-actions-container.open .quick-actions-fab .fab-line:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
}

.quick-actions-container.open .quick-actions-fab .fab-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.quick-actions-container.open .quick-actions-fab .fab-line:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
}

/*  ACTIONS MENU */

.quick-actions-menu {
    position: absolute;
    top: 70px;
    left: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.quick-actions-container.open .quick-actions-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* ACTION ITEM */

.quick-action-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border-radius: 28px;
    padding: 8px 20px 8px 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--border-light);
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    opacity: 0;
    transform: translateX(-20px);
}

.quick-actions-container.open .quick-action-item {
    opacity: 1;
    transform: translateX(0);
}

.quick-actions-container.open .quick-action-item:nth-child(1) { transition-delay: 0.05s; }
.quick-actions-container.open .quick-action-item:nth-child(2) { transition-delay: 0.10s; }
.quick-actions-container.open .quick-action-item:nth-child(3) { transition-delay: 0.15s; }
.quick-actions-container.open .quick-action-item:nth-child(4) { transition-delay: 0.20s; }
.quick-actions-container.open .quick-action-item:nth-child(5) { transition-delay: 0.25s; }

.quick-action-item:hover {
    transform: translateX(4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    background: var(--primary-light);
    border-color: var(--primary);
}

.quick-action-item:active {
    transform: scale(0.96);
}

.quick-action-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
}

.quick-action-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    padding-right: 4px;
    padding-left: 4px;
}

/* OVERLAY */

.quick-actions-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 9997;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.quick-actions-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* EMERGENCY MODAL */

.emergency-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: emergencyFadeIn 0.3s ease;
}

@keyframes emergencyFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.emergency-card {
    background: var(--surface);
    border-radius: 24px;
    padding: 32px 24px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: emergencyScaleIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: 2px solid var(--primary);
}

@keyframes emergencyScaleIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.emergency-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 36px;
    animation: emergencyPulse 2s ease-in-out infinite;
    box-shadow: 0 8px 24px rgba(var(--primary-rgb), 0.35);
}

@keyframes emergencyPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.emergency-card h2 {
    font-size: 22px;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-weight: 800;
}

.emergency-card p {
    font-size: 15px;
    line-height: 1.9;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.emergency-dua {
    background: var(--primary-light);
    border-right: 4px solid var(--primary);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-family: var(--font-quran);
    font-size: 15px;
    line-height: 2.2;
    color: var(--text-primary);
    text-align: right;
}

.emergency-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.emergency-actions .btn {
    width: 100%;
}

.emergency-countdown {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 12px;
    min-height: 18px;
}

/* QUICK NOTE MODAL */

.quick-note-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: emergencyFadeIn 0.3s ease;
}

.quick-note-card {
    background: var(--surface);
    border-radius: 20px;
    padding: 24px;
    max-width: 460px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: emergencyScaleIn 0.3s ease;
}

.quick-note-card h3 {
    margin: 0 0 16px;
    color: var(--text-primary);
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.quick-note-card textarea {
    width: 100%;
    min-height: 120px;
    padding: 14px;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: var(--input-bg);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 14px;
    line-height: 1.7;
    resize: vertical;
    margin-bottom: 16px;
    transition: border-color 0.2s;
}

.quick-note-card textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.1);
}

.quick-note-mood {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.quick-note-mood-icon {
    font-size: 28px;
    cursor: pointer;
    padding: 8px;
    border-radius: 12px;
    transition: all 0.2s ease;
    opacity: 0.5;
}

.quick-note-mood-icon:hover {
    opacity: 0.9;
    transform: scale(1.1);
}

.quick-note-mood-icon.selected {
    opacity: 1;
    background: var(--primary-light);
    transform: scale(1.15);
}

/* DARK MODE */

.theme-dark .quick-action-item {
    background: var(--surface);
    border-color: var(--border);
}

.theme-dark .quick-action-item:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

.theme-dark .emergency-card,
.theme-dark .quick-note-card {
    background: var(--surface);
    border-color: var(--border);
}

.theme-dark .quick-actions-overlay {
    background: rgba(0, 0, 0, 0.6);
}

/* RESPONSIVE */

@media (min-width: 1024px) {
    .quick-actions-container {
        top: 24px;
        left: 24px;
    }
}

@media (max-width: 400px) {
    .quick-actions-container {
        top: 14px;
        left: 14px;
    }

    .quick-actions-fab {
        width: 52px;
        height: 52px;
    }

    .quick-actions-fab .fab-icon {
        width: 20px;
        height: 16px;
    }

    .quick-action-icon {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .quick-action-label {
        font-size: 13px;
    }

    .quick-action-item {
        padding: 6px 16px 6px 6px;
    }
}

/* REDUCED MOTION */

@media (prefers-reduced-motion: reduce) {
    .quick-actions-fab,
    .quick-action-item,
    .emergency-icon,
    .emergency-card {
        animation: none !important;
    }

    .quick-actions-fab {
        transition: background 0.2s ease, box-shadow 0.2s ease;
    }

    .quick-actions-container {
        transition: opacity 0.2s ease;
    }
}

/* ============================================
   NO RECOVERY WARNING MODAL
   ============================================ */

.no-recovery-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: noRecoveryFadeIn 0.3s ease;
}

@keyframes noRecoveryFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.no-recovery-card {
    background: var(--surface);
    border-radius: 24px;
    padding: 32px 24px 24px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    border: 2px solid #FF9800;
    position: relative;
    overflow: hidden;
    animation: noRecoverySlideIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes noRecoverySlideIn {
    0% {
        transform: scale(0.7) translateY(30px);
        opacity: 0;
    }
    60% {
        transform: scale(1.05) translateY(-5px);
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Animated warning icon */
.no-recovery-icon {
    width: 88px;
    height: 88px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF9800, #F57C00);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 42px;
    box-shadow: 0 8px 24px rgba(255, 152, 0, 0.4);
    animation: noRecoveryPulse 2s ease-in-out infinite;
    position: relative;
}

.no-recovery-icon::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 3px solid rgba(255, 152, 0, 0.3);
    animation: noRecoveryRing 2s ease-out infinite;
}

.no-recovery-icon::after {
    content: '';
    position: absolute;
    inset: -16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 152, 0, 0.15);
    animation: noRecoveryRing 2s ease-out infinite 0.5s;
}

@keyframes noRecoveryPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 8px 24px rgba(255, 152, 0, 0.4);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 12px 36px rgba(255, 152, 0, 0.6);
    }
}

@keyframes noRecoveryRing {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

.no-recovery-card h2 {
    font-size: 22px;
    color: var(--text-primary);
    margin: 0 0 12px;
    font-weight: 800;
}

.no-recovery-card p {
    font-size: 15px;
    line-height: 1.9;
    color: var(--text-secondary);
    margin: 0 0 20px;
}

.no-recovery-card p strong {
    color: #FF9800;
    font-weight: 700;
}

/* Divider */
.no-recovery-divider {
    height: 1px;
    background: var(--border-light);
    margin: 20px 0;
}

/* Action hint */
.no-recovery-hint {
    background: #FFF3E0;
    border-right: 4px solid #FF9800;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: right;
}

.no-recovery-hint i {
    color: #F57C00;
    margin-left: 6px;
    font-size: 16px;
}

.no-recovery-hint span {
    font-size: 13px;
    color: #E65100;
    line-height: 1.7;
    font-weight: 500;
}

/* Buttons */
.no-recovery-actions {
    display: flex;
    gap: 10px;
}

.no-recovery-actions .btn {
    flex: 1;
}

.no-recovery-actions .btn-primary {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    border: none;
    color: white;
    font-weight: 700;
}

.no-recovery-actions .btn-primary:hover {
    background: linear-gradient(135deg, #F57C00, #E65100);
}

/* Countdown progress bar */
.no-recovery-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--surface-variant);
    overflow: hidden;
}

.no-recovery-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #FF9800, #F57C00);
    width: 100%;
    transition: width 0.1s linear;
    border-radius: 0 0 0 24px;
}

/* Close button (top-right) */
.no-recovery-close {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface-variant);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    z-index: 2;
}

.no-recovery-close:hover {
    background: #F44336;
    color: white;
    border-color: #F44336;
    transform: rotate(90deg);
}

/* Countdown text */
.no-recovery-countdown {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 12px;
    text-align: center;
    min-height: 16px;
}

/* ============================================
   DARK MODE
   ============================================ */

.theme-dark .no-recovery-card {
    background: var(--surface);
    border-color: #FF9800;
}

.theme-dark .no-recovery-hint {
    background: rgba(255, 152, 0, 0.15);
}

.theme-dark .no-recovery-hint span {
    color: #FFB74D;
}

.theme-dark .no-recovery-progress {
    background: var(--surface-variant);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 400px) {
    .no-recovery-card {
        padding: 24px 16px 20px;
        border-radius: 20px;
    }

    .no-recovery-icon {
        width: 72px;
        height: 72px;
        font-size: 34px;
        margin-bottom: 16px;
    }

    .no-recovery-card h2 {
        font-size: 18px;
    }

    .no-recovery-card p {
        font-size: 14px;
    }

    .no-recovery-actions {
        flex-direction: column;
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .no-recovery-icon,
    .no-recovery-icon::before,
    .no-recovery-icon::after,
    .no-recovery-card {
        animation: none !important;
    }
}