/* ============================================================================
   Ayuda Inmediata - Public Frontend Styles
   Design: Minimalist, intuitive, modern, responsive
   Colors: #3AD4D8 (teal), #9785EA (purple)
   ============================================================================ */

/* --- Variables --- */
:root {
    --ai-teal: #3AD4D8;
    --ai-teal-light: #BDEEF0;
    --ai-purple: #9785EA;
    --ai-purple-dark: #5B49C2;
    --ai-purple-light: #F2EEFB;
    --ai-bg: #F6F8FB;
    --ai-white: #FFFFFF;
    --ai-text: #1A1A2E;
    --ai-text-muted: #8E8EA0;
    --ai-shadow: 0 18px 40px -30px rgba(120, 120, 180, 0.4);
    --ai-radius: 16px;
}

/* ============================================================================
   App Overlay (Full Screen)
   ============================================================================ */

.ai-app-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: linear-gradient(135deg, #F6F8FB 0%, #FFFFFF 100%);
    display: none;
    font-family: 'Unageo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--ai-text);
    -webkit-font-smoothing: antialiased;
}

.ai-app-overlay.active {
    display: block;
}

.ai-app-container {
    max-width: 480px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* ============================================================================
   Screens
   ============================================================================ */

.ai-screen {
    display: none;
    flex: 1;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
}

.ai-screen.active {
    display: flex;
}

/* ============================================================================
   Welcome Screen
   ============================================================================ */

.ai-welcome-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 40px 24px;
    text-align: center;
}

.ai-app-logo {
    width: 80px;
    height: 80px;
    display: grid;
    place-items: center;
    border-radius: 24px;
    background: linear-gradient(135deg, var(--ai-teal), var(--ai-purple));
    color: white;
    margin-bottom: 24px;
    box-shadow: 0 12px 32px -8px rgba(58, 212, 216, 0.3);
}

.ai-welcome-title {
    margin: 0 0 8px;
    font-family: 'Aristotelica Display Trial', 'Georgia', serif;
    font-size: 28px;
    font-weight: 600;
    color: var(--ai-text);
    letter-spacing: -0.02em;
}

.ai-welcome-text {
    margin: 0 0 32px;
    font-size: 16px;
    color: var(--ai-text-muted);
    line-height: 1.6;
}

/* --- Options Grid --- */
.ai-options-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 400px;
}

.ai-option-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--ai-white);
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: var(--ai-radius);
    box-shadow: var(--ai-shadow);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.ai-option-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 24px 48px -30px rgba(120, 120, 180, 0.5);
    border-color: var(--ai-teal);
}

.ai-option-card:active {
    transform: translateY(0);
}

.ai-option-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    color: white;
    flex-shrink: 0;
}

.ai-option-icon svg {
    width: 24px;
    height: 24px;
}

.ai-option-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--ai-text);
    display: block;
    margin-bottom: 2px;
}

.ai-option-desc {
    font-size: 13px;
    color: var(--ai-text-muted);
    display: block;
}

/* ============================================================================
   Breathing Exercise Screen
   ============================================================================ */

.ai-breathing-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.ai-breathing-header h3 {
    margin: 0;
    font-family: 'Aristotelica Display Trial', 'Georgia', serif;
    font-size: 18px;
    font-weight: 600;
}

.ai-back-btn,
.ai-refresh-btn {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    border: none;
    background: var(--ai-bg);
    color: var(--ai-text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.ai-back-btn:hover,
.ai-refresh-btn:hover {
    background: var(--ai-teal-light);
    color: var(--ai-teal);
}

.ai-back-btn svg,
.ai-refresh-btn svg {
    width: 18px;
    height: 18px;
}

/* --- Lotus Container --- */
.ai-lotus-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.ai-lotus {
    transition: transform 0.3s ease;
    max-width: 280px;
    width: 100%;
    height: auto;
}

/* Phase indicator text */
.ai-phase-indicator {
    margin-top: 24px;
    font-family: 'Aristotelica Display Trial', 'Georgia', serif;
    font-size: 22px;
    font-weight: 600;
    color: var(--ai-purple-dark);
    transition: opacity 0.3s ease;
    text-align: center;
}

.ai-timer {
    font-size: 48px;
    font-weight: 200;
    color: var(--ai-teal);
    margin-top: 8px;
    font-variant-numeric: tabular-nums;
    transition: all 0.3s ease;
}

/* --- Progress Section --- */
.ai-progress-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 16px 20px 32px;
}

.ai-cycle-info {
    font-size: 13px;
    color: var(--ai-text-muted);
}

.ai-progress-dots {
    display: flex;
    gap: 8px;
}

.ai-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #E5E7EB;
    transition: all 0.3s ease;
}

.ai-dot.active {
    background: var(--ai-teal);
    box-shadow: 0 0 8px rgba(58, 212, 216, 0.4);
}

.ai-dot.completed {
    background: var(--ai-purple);
}

.ai-stop-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: var(--ai-white);
    color: var(--ai-text-muted);
    font-size: 14px;
    font-weight: 500;
    font-family: 'Unageo', sans-serif;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ai-stop-btn:hover {
    background: #FEE2E2;
    border-color: #FECACA;
    color: #DC2626;
}

.ai-stop-btn svg {
    width: 14px;
    height: 14px;
}

/* ============================================================================
   Phrases Screen
   ============================================================================ */

.ai-phrases-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    overflow: hidden;
}

.ai-phrase-card {
    text-align: center;
    max-width: 400px;
    animation: ai-phrase-fade 0.5s ease;
}

@keyframes ai-phrase-fade {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-phrase-text {
    font-family: 'Aristotelica Display Trial', 'Georgia', serif;
    font-size: 28px;
    font-weight: 500;
    color: var(--ai-text);
    line-height: 1.4;
    margin: 0 0 16px;
}

.ai-phrase-author {
    font-size: 15px;
    color: var(--ai-text-muted);
    margin: 0;
}

.ai-phrase-nav {
    display: flex;
    gap: 16px;
    margin-top: 32px;
}

.ai-phrase-nav-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: var(--ai-white);
    color: var(--ai-text-muted);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ai-phrase-nav-btn:hover {
    border-color: var(--ai-teal);
    color: var(--ai-teal);
    box-shadow: 0 4px 12px rgba(58, 212, 216, 0.15);
}

.ai-phrase-nav-btn svg {
    width: 20px;
    height: 20px;
}

/* ============================================================================
   Audio Screen
   ============================================================================ */

.ai-audios-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 20px;
    align-content: start;
    overflow-y: auto;
}

.ai-audio-card {
    background: var(--ai-white);
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: var(--ai-radius);
    box-shadow: var(--ai-shadow);
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-audio-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 24px 48px -30px rgba(120, 120, 180, 0.5);
    border-color: var(--ai-purple);
}

.ai-audio-card.playing {
    border-color: var(--ai-teal);
    background: rgba(58, 212, 216, 0.03);
}

.ai-audio-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    margin: 0 auto 12px;
    color: white;
}

.ai-audio-icon.teal {
    background: var(--ai-teal);
}

.ai-audio-icon.purple {
    background: var(--ai-purple);
}

.ai-audio-icon.mixed {
    background: linear-gradient(135deg, var(--ai-teal), var(--ai-purple));
}

.ai-audio-icon svg {
    width: 22px;
    height: 22px;
}

.ai-audio-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 4px;
}

.ai-audio-duration {
    font-size: 12px;
    color: var(--ai-text-muted);
}

/* ============================================================================
   Floating Button
   ============================================================================ */

.ai-floating-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--ai-teal), var(--ai-purple));
    color: white;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(58, 212, 216, 0.35);
    display: grid;
    place-items: center;
    z-index: 99999;
    transition: all 0.2s ease;
    animation: ai-pulse 3s ease-in-out infinite;
}

@keyframes ai-pulse {
    0%, 100% { box-shadow: 0 8px 24px rgba(58, 212, 216, 0.35); }
    50% { box-shadow: 0 8px 32px rgba(58, 212, 216, 0.55); }
}

.ai-floating-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(58, 212, 216, 0.45);
}

.ai-floating-btn svg {
    width: 28px;
    height: 28px;
}

.ai-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, var(--ai-teal), var(--ai-purple));
    color: white;
    font-family: 'Unageo', sans-serif;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 8px 24px rgba(58, 212, 216, 0.3);
}

.ai-trigger-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(58, 212, 216, 0.4);
}

.ai-trigger-btn svg {
    width: 20px;
    height: 20px;
}

/* ============================================================================
   Animations for Lotus Breathing
   ============================================================================ */

@keyframes ai-lotus-inhale {
    from { transform: scale(0.85); }
    to { transform: scale(1.15); }
}

@keyframes ai-lotus-exhale {
    from { transform: scale(1.15); }
    to { transform: scale(0.85); }
}

@keyframes ai-lotus-glow-inhale {
    from { opacity: 0.3; r: 70; }
    to { opacity: 0.6; r: 90; }
}

@keyframes ai-lotus-glow-exhale {
    from { opacity: 0.6; r: 90; }
    to { opacity: 0.3; r: 70; }
}

.ai-lotus.inhaling {
    animation: ai-lotus-inhale var(--ai-inhale-duration, 4s) ease-in-out forwards;
}

.ai-lotus.exhaling {
    animation: ai-lotus-exhale var(--ai-exhale-duration, 8s) ease-in-out forwards;
}

/* ============================================================================
   Responsive
   ============================================================================ */

@media (max-width: 480px) {
    .ai-welcome-title {
        font-size: 24px;
    }

    .ai-option-card {
        padding: 16px;
    }

    .ai-option-icon {
        width: 44px;
        height: 44px;
    }

    .ai-option-icon svg {
        width: 20px;
        height: 20px;
    }

    .ai-phrase-text {
        font-size: 22px;
    }

    .ai-audios-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .ai-lotus {
        max-width: 200px;
    }

    .ai-timer {
        font-size: 36px;
    }
}

@media (min-width: 768px) {
    .ai-app-overlay {
        background: rgba(0, 0, 0, 0.3);
        backdrop-filter: blur(8px);
        display: none;
        align-items: center;
        justify-content: center;
    }

    .ai-app-overlay.active {
        display: flex;
    }

    .ai-app-container {
        max-width: 480px;
        height: 90vh;
        max-height: 800px;
        border-radius: 24px;
        background: linear-gradient(135deg, #F6F8FB 0%, #FFFFFF 100%);
        box-shadow: 0 32px 64px rgba(0, 0, 0, 0.15);
    }
}
