/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700&family=Raleway:wght@300;400;500&display=swap');

/* Reset default margins and ensure full viewport coverage */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    overflow: hidden;
    font-family: 'Lato', sans-serif;
    line-height: 1.6;
}

/* Background image styling */
.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    /* Replace with your image */
    background: url('background.jpg') no-repeat center center fixed;
    background-size: cover;
    z-index: -1;
}

/* Common text container style */
.text-container {
    background: rgba(255, 255, 255, 0.15);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    padding: 1.5rem;
    border-radius: 12px;
}

/* Timer styling */
#timer {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: min(1.2cm, 10vw);
    font-family: 'Raleway', sans-serif;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.5);
    background: transparent;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: 2px;
}

/* Final message container styling */
.message-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    opacity: 0;
    display: none;
    transition: opacity 14s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animation class for final message */
.message-visible {
    display: block !important;
    opacity: 1 !important;
}

/* Main message styling */
.main-message {
    font-size: min(2.2rem, 7vw);
    font-family: 'Raleway', sans-serif;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 1.5rem;
    line-height: 1.4;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Stats message styling */
.stats-message {
    font-size: min(1.4rem, 5vw);
    font-family: 'Lato', sans-serif;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 1.5rem;
    line-height: 1.4;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#meditation-count {
    font-weight: 700;
    color: rgba(255, 255, 255, 1);
}

/* Gratitude message styling */
.gratitude-message {
    font-size: min(1.2rem, 4.5vw);
    font-family: 'Lato', sans-serif;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 1.5rem;
    line-height: 1.4;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Updated coffee link styling */
#coffee-link {
    position: static;
    transform: none;
    display: inline-block;
    margin-top: 0.5rem;
    opacity: 1;
}

#coffee-link a {
    font-family: 'Lato', sans-serif;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    font-size: min(1.1rem, 4vw);
    transition: all 0.3s ease;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: inline-block;
    margin-bottom: 0.5rem;
    position: relative;
    overflow: hidden;
}

#coffee-link a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        rgba(255, 255, 255, 0.6),
        rgba(255, 255, 255, 0.4),
        transparent
    );
    transition: left 0.8s ease-in-out;
    pointer-events: none;
}

#coffee-link a:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Support subtitle styling */
.support-subtitle {
    font-family: 'Lato', sans-serif;
    font-size: min(0.9rem, 3.5vw);
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    line-height: 1.3;
    margin-top: 0.3rem;
    font-weight: 300;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.support-subtitle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        rgba(255, 255, 255, 0.5),
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transition: left 0.8s ease-in-out;
    pointer-events: none;
}

/* Show coffee link when visible class is added */
#coffee-link.visible {
    display: block;
    opacity: 1;
}

/* Shine animation trigger */
#coffee-link.visible a::before {
    left: 100%;
    animation: shineEffect 1.2s ease-in-out 0.5s;
}

#coffee-link.visible .support-subtitle::before {
    left: 100%;
    animation: shineEffect 1.2s ease-in-out 1.2s;
}

@keyframes shineEffect {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Repeat shine animation every 8 seconds for extra attention */
#coffee-link.visible a::before {
    animation: shineEffect 1.2s ease-in-out 0.5s, 
               shineEffectRepeat 1.2s ease-in-out 8.5s infinite;
}

#coffee-link.visible .support-subtitle::before {
    animation: shineEffect 1.2s ease-in-out 1.2s, 
               shineEffectRepeat 1.2s ease-in-out 9.2s infinite;
}

@keyframes shineEffectRepeat {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Enhance hover effect with additional shine */
#coffee-link a:hover::before {
    animation: quickShine 0.6s ease-in-out;
}

@keyframes quickShine {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Welcome message styling */
#welcome-message {
    position: fixed;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: min(2.2rem, 7vw);
    color: rgba(255, 255, 255, 0.95);
    text-align: center;
    line-height: 1.4;
    background: rgba(0, 0, 0, 0.2);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    display: none;
    font-family: 'Raleway', sans-serif;
    width: 90%;
    max-width: 600px;
    letter-spacing: 1px;
    padding: 1.5rem;
    opacity: 1;
    transition: all 0.5s ease-out;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#welcome-message span {
    font-size: 1.8rem;
    opacity: 0.9;
    display: block;
    margin-top: 1rem;
    font-weight: 300;
}

#welcome-message.fade-out {
    opacity: 0;
}

/* Start button styling */
#start-button {
    margin-top: 2.5rem !important;
    font-size: 1.8rem !important;
    padding: 15px 40px !important;
    font-family: 'Lato', sans-serif !important;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.15)) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 30px !important;
    color: rgba(255, 255, 255, 0.95) !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    -webkit-backdrop-filter: blur(10px) !important;
    backdrop-filter: blur(10px) !important;
    /* Fallback for browsers that don't support backdrop-filter */
    @supports not ((backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px))) {
        background: rgba(255, 255, 255, 0.85) !important;
    }
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

#start-button:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.25)) !important;
}

/* Coffee link styling */
#coffee-link a {
    background: rgba(255, 255, 255, 0.2);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    /* Fallback for browsers that don't support backdrop-filter */
    @supports not ((backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px))) {
        background: rgba(255, 255, 255, 0.85);
    }
}

/* Медиа-запрос для очень маленьких экранов */
@media screen and (max-height: 600px) {
    .message-container {
        top: 45%;
        padding: 1rem;
    }
    
    .main-message {
        margin-bottom: 1rem;
    }
    
    .stats-message, .gratitude-message {
        margin-bottom: 0.8rem;
    }
}

.feature-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-family: 'Lato', sans-serif;
    font-size: min(0.9rem, 3.5vw);
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    display: inline-block;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.feature-link:hover {
    color: rgba(255, 255, 255, 1);
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.page-footer {
    position: fixed;
    bottom: 0;
    width: 100%;
    padding: 20px;
    text-align: center;
    display: none; /* Скрываем footer по умолчанию */
}

/* Добавляем стили для селектора фона */
#background-selector {
    margin-top: 1.5rem;
    text-align: center;
}

.selector-title {
    font-size: min(1.2rem, 5vw);
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.8rem;
}

.background-options {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.bg-option {
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.7;
    border-radius: 8px;
    padding: 0.5rem;
    border: 2px solid transparent;
}

.bg-option[data-selected="true"] {
    opacity: 1;
    border-color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.1);
}

.bg-option:hover {
    opacity: 0.9;
}

.bg-preview {
    width: 60px;
    height: 40px;
    border-radius: 4px;
    margin-bottom: 0.3rem;
    background-size: cover;
    background-position: center;
}

.auto-bg {
    background-image: linear-gradient(to right, #3494e6, #ec6ead);
}

.video-bg {
    background-image: url('video-preview.jpg');
}

.image-bg {
    background-image: url('background.jpg');
}

.bg-label {
    font-size: min(0.9rem, 4vw);
    color: rgba(255, 255, 255, 0.9);
}

/* Fullscreen Button Styles */
.fullscreen-btn {
    /* Positioning */
    position: fixed;
    top: 24px;
    right: 24px;
    
    /* Sizing - Accessible touch target */
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    
    /* Glassmorphism effect matching existing design */
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    
    /* Shape and styling */
    border-radius: 50%;
    cursor: pointer;
    
    /* Icon styling */
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    
    /* Transitions */
    transition: all 0.3s ease;
    opacity: 1;
    transform: scale(1);
    
    /* Ensure it's above other elements */
    z-index: 100;
}

/* Hover state */
.fullscreen-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.9);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Active/pressed state */
.fullscreen-btn:active {
    transform: scale(0.98);
}

/* Focus indicators for accessibility */
.fullscreen-btn:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.8);
    outline-offset: 3px;
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.2);
}

/* Remove outline for mouse users */
.fullscreen-btn:focus:not(:focus-visible) {
    outline: none;
}

/* Fade out state (matching timer) */
.fullscreen-btn.fade-out {
    opacity: 0;
    pointer-events: none;
    transition: opacity 2s ease-in-out;
}

/* Fade in state */
.fullscreen-btn.fade-in {
    opacity: 1;
    pointer-events: all;
    transition: opacity 2s ease-in-out;
}

/* Button animation during fullscreen transition */
@keyframes buttonPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(255, 255, 255, 0);
    }
}

.fullscreen-btn.transitioning {
    animation: buttonPulse 0.6s ease-out;
}

/* Breathing animation for fullscreen transition */
@keyframes breatheTransition {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }
    40% {
        transform: scale(1.02);
        filter: brightness(1.1);
    }
    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}

/* Applied to body during transition */
body.fullscreen-transition {
    animation: breatheTransition 0.8s ease-in-out;
}

body.fullscreen-transition #timer {
    transform: scale(1.02);
    filter: brightness(1.1);
    transition: all 0.8s ease-in-out;
}

body.fullscreen-transition .background-container {
    transform: scale(1.01);
    filter: brightness(1.05) saturate(1.1);
    transition: transform 0.8s ease-in-out, filter 0.8s ease-in-out;
}

body.fullscreen-transition #welcome-message {
    transform: translate(-50%, -50%) scale(1.02);
    transition: all 0.8s ease-in-out;
}

/* Loading state for slower devices */
.fullscreen-btn.loading {
    pointer-events: none;
    opacity: 0.6;
}

.fullscreen-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error state animation */
@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.fullscreen-btn.error {
    animation: errorShake 0.3s ease-in-out;
    border-color: rgba(255, 100, 100, 0.5);
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .fullscreen-btn {
        background: rgba(0, 0, 0, 0.8);
        border: 2px solid white;
        color: white;
    }
    
    .fullscreen-btn:hover {
        background: white;
        color: black;
    }
    
    .fullscreen-btn:focus {
        outline: 3px solid white;
        outline-offset: 3px;
    }
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
    .fullscreen-btn {
        /* Slightly larger for mobile */
        width: 48px;
        height: 48px;
        
        /* Adjust position for mobile safe areas */
        top: max(24px, env(safe-area-inset-top, 24px));
        right: max(24px, env(safe-area-inset-right, 24px));
    }
    
    /* Always visible on mobile during meditation */
    .fullscreen-btn.fade-out {
        opacity: 0.3; /* Subtle presence instead of fully hidden */
    }
    
    /* Mobile breathing animation (subtler) */
    @keyframes breatheTransitionMobile {
        0%, 100% {
            transform: scale(1);
            filter: brightness(1);
        }
        50% {
            transform: scale(1.01); /* Subtler on mobile */
            filter: brightness(1.05);
        }
    }
    
    body.fullscreen-transition {
        animation: breatheTransitionMobile 0.6s ease-in-out;
    }
}

/* iOS specific adjustments */
@supports (-webkit-touch-callout: none) {
    .fullscreen-btn {
        /* iOS Safari needs special handling */
        -webkit-tap-highlight-color: transparent;
    }
}

/* Reduced motion support for accessibility */
@media (prefers-reduced-motion: reduce) {
    .fullscreen-transition,
    .fullscreen-btn.transitioning,
    body.fullscreen-transition,
    body.fullscreen-transition * {
        animation: none !important;
        transition: opacity 0.3s ease !important;
    }
    
    .fullscreen-btn.transitioning {
        opacity: 0.6;
    }
}

/* Performance optimizations */
.fullscreen-btn,
.background-container,
#timer {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Use transform instead of position changes */
.fullscreen-transition * {
    will-change: transform, opacity, filter;
}

/* Clean up after animation */
body:not(.fullscreen-transition) * {
    will-change: auto;
}
/* Random background preview styles */
.random-bg {
    background: linear-gradient(135deg, 
        rgba(70, 130, 180, 0.8) 0%, 
        rgba(135, 206, 235, 0.8) 25%,
        rgba(255, 182, 193, 0.8) 50%,
        rgba(221, 160, 221, 0.8) 75%,
        rgba(173, 216, 230, 0.8) 100%);
    position: relative;
    overflow: hidden;
}

.random-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><path d="M20 20h60v60h-60z" fill="none" stroke="rgba(255,255,255,0.3)" stroke-width="2"/><path d="M35 35h30v30h-30z" fill="none" stroke="rgba(255,255,255,0.3)" stroke-width="2"/><circle cx="50" cy="50" r="8" fill="rgba(255,255,255,0.4)"/></svg>') center/60% no-repeat;
    animation: randomPulse 2s ease-in-out infinite;
}

.random-bg::after {
    content: '🎲';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    z-index: 1;
    animation: randomRotate 3s linear infinite;
}

@keyframes randomPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

@keyframes randomRotate {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Hover effect for random option */
.bg-option[data-type="random"]:hover .random-bg::after {
    animation-duration: 0.5s;
}

.bg-option[data-type="random"][data-selected="true"] .random-bg {
    background: linear-gradient(135deg, 
        rgba(70, 130, 180, 1) 0%, 
        rgba(135, 206, 235, 1) 25%,
        rgba(255, 182, 193, 1) 50%,
        rgba(221, 160, 221, 1) 75%,
        rgba(173, 216, 230, 1) 100%);
}

.bg-option[data-type="random"][data-selected="true"] .random-bg::after {
    animation-play-state: paused;
    transform: translate(-50%, -50%) rotate(0deg);
}

/* Mobile adjustments for random option */
@media (max-width: 768px) {
    .random-bg::after {
        font-size: 14px;
    }
}

