/**
 * Frequency Relax - Main Styles
 * Modern, relaxing design with glassmorphism
 */

/* ============================================
   CSS Variables (Design Tokens)
   ============================================ */
:root {
    /* Primary Colors - Galassia Cristallina */
    --primary-dark: #0a1929;
    --primary-medium: #132f4c;
    --primary-light: #1e4976;

    /* Accent Colors */
    --accent-blue: #3399ff;
    --accent-teal: #66b2ff;
    --accent-cyan: #99ccff;
    --accent-gradient: linear-gradient(135deg, #3399ff 0%, #66b2ff 100%);

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #b2bac2;
    --text-muted: #8796a5;

    /* Status Colors */
    --success: #66b2ff;
    --error: #f44336;
    --warning: #ff9800;
    --info: #3399ff;

    /* UI Elements */
    --bg-glass: rgba(255, 255, 255, 0.05);
    --bg-glass-hover: rgba(255, 255, 255, 0.1);
    --border-glass: rgba(255, 255, 255, 0.1);
    --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-medium: 0 12px 40px rgba(0, 0, 0, 0.4);
    --shadow-strong: 0 16px 48px rgba(0, 0, 0, 0.5);

    /* Borders */
    --radius-sm: 10px;
    --radius-md: 20px;
    --radius-lg: 30px;

    /* Spacing */
    --spacing-xs: 8px;
    --spacing-sm: 16px;
    --spacing-md: 24px;
    --spacing-lg: 32px;
    --spacing-xl: 48px;

    /* Transitions */
    --transition-fast: 200ms ease-in-out;
    --transition-normal: 300ms ease-in-out;
    --transition-slow: 500ms ease-in-out;
}

/* ============================================
   Reset & Base Styles
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #1e4976 0%, #132f4c 50%, #0a1929 100%);
    background-attachment: fixed;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated background particles (optional) */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(51, 153, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(102, 178, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(153, 204, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: var(--spacing-sm);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: var(--spacing-sm);
}

a {
    color: var(--accent-teal);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-blue);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 32px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--accent-gradient);
    color: var(--text-primary);
    box-shadow: var(--shadow-soft);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-glass-hover);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--bg-glass-hover);
    transform: scale(1.1);
}

/* ============================================
   Loading Screen
   ============================================ */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-content {
    text-align: center;
}

.loader {
    width: 50px;
    height: 50px;
    border: 4px solid var(--bg-glass);
    border-top-color: var(--accent-teal);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--spacing-md);
}

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

/* ============================================
   Screens
   ============================================ */
.screen {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
    z-index: 1;
}

/* ============================================
   Glass Cards
   ============================================ */
.card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-soft);
    transition: all var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow-medium);
}

/* ============================================
   Error Messages
   ============================================ */
.error-message {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid var(--error);
    border-radius: var(--radius-sm);
    padding: var(--spacing-sm);
    color: var(--error);
    font-size: 0.9rem;
    margin: var(--spacing-sm) 0;
    animation: shake 0.5s;
}

.success-message {
    background: rgba(93, 226, 163, 0.1);
    border: 1px solid var(--success);
    border-radius: var(--radius-sm);
    padding: var(--spacing-sm);
    color: var(--success);
    font-size: 0.9rem;
    margin: var(--spacing-sm) 0;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* ============================================
   Modal
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: var(--spacing-md);
    animation: fadeIn var(--transition-normal);
}

.modal-content {
    background: var(--primary-medium);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-strong);
    animation: slideUp var(--transition-normal);
}

.modal-content h3 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-icon {
    width: 24px;
    height: 24px;
    stroke: var(--warning);
    flex-shrink: 0;
}

/* Info modal styling - blue/teal instead of warning red */
.modal-info .modal-icon {
    stroke: var(--accent-teal);
}

.modal-info h3 {
    color: var(--accent-teal);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Utilities
   ============================================ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }

.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }

.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn var(--transition-normal);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    html { font-size: 14px; }

    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }

    .screen {
        padding: var(--spacing-sm);
    }

    .card {
        padding: var(--spacing-md);
    }
}

@media (max-width: 480px) {
    html { font-size: 13px; }

    .btn {
        padding: 10px 24px;
        font-size: 0.9rem;
    }
}

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

*:focus {
    outline: 2px solid var(--accent-teal);
    outline-offset: 2px;
}

button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--accent-teal);
    outline-offset: 2px;
}

/* ============================================
   Scrollbar
   ============================================ */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--primary-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-blue);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-teal);
}

/* ============================================
   PWA Install Banner
   ============================================ */
#pwa-install-banner {
    position: fixed;
    bottom: -100px;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--primary-medium) 0%, var(--primary-dark) 100%);
    border-top: 1px solid var(--border-glass);
    padding: 16px;
    z-index: 10000;
    transition: bottom 0.3s ease-out;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

#pwa-install-banner.show {
    bottom: 0;
}

#pwa-install-banner.ios {
    bottom: -120px;
}

#pwa-install-banner.ios.show {
    bottom: 0;
}

.pwa-install-content {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 600px;
    margin: 0 auto;
}

.pwa-install-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    flex-shrink: 0;
}

.pwa-install-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pwa-install-text strong {
    color: var(--text-primary);
    font-size: 14px;
}

.pwa-install-text span {
    color: var(--text-secondary);
    font-size: 12px;
}

.pwa-install-button {
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.pwa-install-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(51, 153, 255, 0.4);
}

.pwa-dismiss-button {
    background: transparent;
    color: var(--text-muted);
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 0 8px;
    line-height: 1;
    flex-shrink: 0;
}

.pwa-dismiss-button:hover {
    color: var(--text-primary);
}

/* iOS/Android icon styling (inline SVG) */
.ios-share-icon,
.android-menu-icon {
    display: inline-block;
    vertical-align: middle;
    margin: 0 2px;
}
