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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #ffffff;
    overflow-x: hidden;
}

/* 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: 0;
}

/* Focus styles for accessibility */
*:focus {
    outline: 2px solid #a855f7;
    outline-offset: 2px;
}

button:focus,
input:focus,
select:focus {
    outline: 2px solid #a855f7;
    outline-offset: 2px;
}

/* Container and Layout */
.container {
    max-width: 1400px;
}

/* Breathing Guide Styles */
.breathing-guide-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    position: relative;
}

.breathing-circle {
    position: relative;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.1) 0%, rgba(168, 85, 247, 0.05) 50%, transparent 100%);
    border: 2px solid rgba(168, 85, 247, 0.3);
    transition: all 0.3s ease;
    transform-origin: center;
    will-change: transform;
}

.breathing-circle-inner {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.2) 0%, rgba(168, 85, 247, 0.1) 70%, transparent 100%);
    border: 1px solid rgba(168, 85, 247, 0.4);
    transition: all 0.3s ease;
    transform-origin: center;
    will-change: transform;
}

.breathing-circle-glow {
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    will-change: opacity;
}

/* Breathing Animation States */
.breathing-circle.inhale {
    transform: scale(1.4);
    border-color: rgba(34, 197, 94, 0.6);
    background: radial-gradient(circle, rgba(34, 197, 94, 0.15) 0%, rgba(34, 197, 94, 0.08) 50%, transparent 100%);
}

.breathing-circle.inhale .breathing-circle-inner {
    transform: scale(1.2);
    border-color: rgba(34, 197, 94, 0.7);
    background: radial-gradient(circle, rgba(34, 197, 94, 0.25) 0%, rgba(34, 197, 94, 0.15) 70%, transparent 100%);
}

.breathing-circle.inhale .breathing-circle-glow {
    opacity: 0.6;
    background: radial-gradient(circle, rgba(34, 197, 94, 0.2) 0%, transparent 70%);
}

.breathing-circle.hold {
    transform: scale(1.4);
    border-color: rgba(59, 130, 246, 0.6);
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.08) 50%, transparent 100%);
}

.breathing-circle.hold .breathing-circle-inner {
    transform: scale(1.2);
    border-color: rgba(59, 130, 246, 0.7);
    background: radial-gradient(circle, rgba(59, 130, 246, 0.25) 0%, rgba(59, 130, 246, 0.15) 70%, transparent 100%);
}

.breathing-circle.hold .breathing-circle-glow {
    opacity: 0.4;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
}

.breathing-circle.exhale {
    transform: scale(0.8);
    border-color: rgba(239, 68, 68, 0.6);
    background: radial-gradient(circle, rgba(239, 68, 68, 0.15) 0%, rgba(239, 68, 68, 0.08) 50%, transparent 100%);
}

.breathing-circle.exhale .breathing-circle-inner {
    transform: scale(0.7);
    border-color: rgba(239, 68, 68, 0.7);
    background: radial-gradient(circle, rgba(239, 68, 68, 0.25) 0%, rgba(239, 68, 68, 0.15) 70%, transparent 100%);
}

.breathing-circle.exhale .breathing-circle-glow {
    opacity: 0.3;
    background: radial-gradient(circle, rgba(239, 68, 68, 0.1) 0%, transparent 70%);
}

/* Phase Indicator */
.phase-indicator {
    position: absolute;
    bottom: -80px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.phase-text {
    font-size: 1.5rem;
    font-weight: 300;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: color 0.3s ease;
}

.phase-text.inhale {
    color: #22c55e;
}

.phase-text.hold {
    color: #3b82f6;
}

.phase-text.exhale {
    color: #ef4444;
}

/* Timing Display */
.timing-display {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1.5rem 2rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Button Styles */
.btn-primary {
    background: linear-gradient(135deg, #a855f7 0%, #8b5cf6 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
    min-width: 140px;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #9333ea 0%, #7c3aed 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(168, 85, 247, 0.3);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 8px rgba(168, 85, 247, 0.2);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    min-width: 140px;
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.btn-secondary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Pattern Selection */
.pattern-selection {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pattern-option {
    cursor: pointer;
    display: block;
}

.pattern-card {
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.pattern-option input:checked + .pattern-card {
    border-color: #a855f7;
    background: rgba(168, 85, 247, 0.15);
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.2);
}

.pattern-card:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.12);
}

.pattern-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.pattern-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
}

.pattern-timing {
    font-size: 0.85rem;
    color: #a855f7;
    font-weight: 500;
    text-align: right;
    line-height: 1.2;
}

.pattern-description {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.pattern-key {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
}

/* Control Groups */
.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-label {
    font-size: 0.95rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

/* Toggle Switches */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: relative;
    width: 50px;
    height: 26px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 26px;
    transition: background 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-input:checked + .toggle-slider {
    background: #a855f7;
    border-color: #a855f7;
}

.toggle-input:checked + .toggle-slider::before {
    transform: translateX(24px);
}

.toggle-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

/* Range Inputs */
.range-input,
.volume-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.range-input::-webkit-slider-thumb,
.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #a855f7;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.range-input::-webkit-slider-thumb:hover,
.volume-slider::-webkit-slider-thumb:hover {
    background: #9333ea;
    transform: scale(1.1);
}

.range-input::-moz-range-thumb,
.volume-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #a855f7;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Volume Control */
.volume-control-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.volume-display {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    min-width: 40px;
    text-align: right;
}

/* Select Inputs */
.select-input {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 0.95rem;
    backdrop-filter: blur(10px);
    cursor: pointer;
}

.select-input:focus {
    border-color: #a855f7;
    background: rgba(255, 255, 255, 0.15);
}

.select-input option {
    background: #1e293b;
    color: white;
}

/* Progress Bar */
.session-progress {
    margin-top: 1rem;
}

.progress-container {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.progress-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

.progress-percentage {
    font-size: 0.9rem;
    color: #a855f7;
    font-weight: 600;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #a855f7 0%, #8b5cf6 100%);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(51, 65, 85, 0.95) 100%);
    border-radius: 16px;
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
    margin-bottom: 1rem;
}

.modal-description {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Loading Indicator */
.loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-indicator.hidden {
    display: none;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(168, 85, 247, 0.3);
    border-top: 4px solid #a855f7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.loading-text {
    color: white;
    font-size: 1.1rem;
    font-weight: 300;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        padding: 1rem;
    }
    
    main {
        flex-direction: column;
        gap: 2rem;
    }
    
    aside {
        width: 100%;
        max-width: 600px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .breathing-circle {
        width: 240px;
        height: 240px;
    }
    
    .breathing-circle-inner {
        width: 160px;
        height: 160px;
    }
    
    .phase-text {
        font-size: 1.25rem;
    }
    
    .timing-display {
        padding: 1rem 1.5rem;
    }
    
    .timing-display .flex {
        gap: 1rem;
    }
    
    .main-controls {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
        max-width: 200px;
    }
    
    .pattern-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .pattern-timing {
        text-align: left;
    }
    
    .modal-content {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .modal-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .breathing-circle {
        width: 200px;
        height: 200px;
    }
    
    .breathing-circle-inner {
        width: 140px;
        height: 140px;
    }
    
    .breathing-guide-container {
        min-height: 320px;
    }
    
    .phase-indicator {
        bottom: -60px;
    }
    
    .timing-display .flex {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    aside {
        padding: 1rem;
    }
    
    .pattern-card {
        padding: 0.75rem;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .breathing-circle {
        border-width: 3px;
    }
    
    .btn-primary,
    .btn-secondary {
        border-width: 2px;
    }
    
    .pattern-card {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .breathing-circle,
    .breathing-circle-inner,
    .breathing-circle-glow {
        transition: none;
    }
    
    .btn-primary:hover,
    .btn-secondary:hover {
        transform: none;
    }
    
    .loading-spinner {
        animation: none;
    }
}

/* Dark mode adjustments (already dark by default) */
@media (prefers-color-scheme: light) {
    /* Keep dark theme for meditation app */
}

/* Print styles */
@media print {
    .breathing-guide-container,
    .main-controls,
    aside {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
    
    header {
        color: black;
    }
}