/* MoonLife Custom Styles */

/* CSS Custom Properties */
:root {
    --moonlife-purple: #6A00FF;
    --moonlife-gold: #E7C759;
    --moonlife-dark: #0A0A0A;
    --moonlife-gray: #1A1A1A;
    --gradient-primary: linear-gradient(135deg, var(--moonlife-purple), var(--moonlife-gold));
}

/* Base Styles */
body {
    background: var(--moonlife-dark);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Navigation Styles */
.nav-link {
    @apply text-gray-300 hover:text-moonlife-gold transition-colors duration-200;
    position: relative;
}

.nav-link:hover::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-primary);
    border-radius: 1px;
}

/* Bottom Navigation */
.bottom-nav-link {
    @apply text-gray-400 hover:text-white transition-all duration-200 p-2 rounded-lg;
    min-width: 60px;
    max-width: 70px;
}

.bottom-nav-link:hover {
    @apply text-moonlife-gold bg-moonlife-purple/10;
}

.bottom-nav-link.active {
    @apply text-moonlife-gold;
}

.bottom-nav-link.active div {
    @apply transform scale-110;
}

/* Button Styles */
.btn-primary {
    @apply bg-gradient-to-r from-moonlife-purple to-moonlife-gold text-black font-semibold px-6 py-2 rounded-lg hover:shadow-lg transition-all duration-200;
    background: var(--gradient-primary);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 25px rgba(106, 0, 255, 0.3);
}

.btn-secondary {
    @apply border border-moonlife-purple text-moonlife-purple hover:bg-moonlife-purple hover:text-white font-semibold px-6 py-2 rounded-lg transition-all duration-200;
}

.btn-secondary:hover {
    transform: translateY(-1px);
}

.btn-danger {
    @apply bg-red-600 hover:bg-red-700 text-white font-semibold px-6 py-2 rounded-lg transition-all duration-200;
}

.btn-danger:hover {
    transform: translateY(-1px);
}

/* Card Styles */
.card {
    @apply bg-moonlife-gray rounded-2xl p-6 border border-moonlife-purple/30 backdrop-blur-sm;
    background: rgba(26, 26, 26, 0.95);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.card:hover {
    border-color: rgba(106, 0, 255, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(106, 0, 255, 0.2);
}

/* Form Styles */
.form-label {
    @apply block text-sm font-semibold text-gray-100 mb-2;
}

.form-input, .form-textarea {
    @apply w-full px-4 py-3 bg-black/70 border border-moonlife-purple/40 rounded-lg text-white placeholder-gray-300 focus:border-moonlife-gold focus:ring-2 focus:ring-moonlife-gold/30 focus:outline-none transition-all duration-200;
    -webkit-appearance: none;
    font-size: 16px; /* Prevents zoom on iOS */
}

.form-input:focus, .form-textarea:focus {
    background: rgba(0, 0, 0, 0.8);
    box-shadow: 0 0 0 2px rgba(231, 199, 89, 0.5);
    transform: scale(1.01);
}

.form-group {
    @apply space-y-1;
}

.form-help {
    @apply text-xs text-gray-300;
}

.form-error {
    @apply text-red-400 text-sm;
}

/* Section Styles */
.section-title {
    @apply text-xl font-semibold mb-6 text-moonlife-gold;
}

/* Path Choice Styles (Onboarding) */
.path-choice {
    @apply block p-6 bg-black/30 border-2 border-moonlife-purple/30 rounded-2xl cursor-pointer transition-all duration-200 hover:border-moonlife-purple/60;
}

.path-choice:hover {
    background: rgba(106, 0, 255, 0.05);
    transform: translateY(-2px);
}

input[type="radio"]:checked + .path-choice {
    border-color: var(--moonlife-purple);
    background: rgba(106, 0, 255, 0.1);
}

/* Flash Messages */
.flash-message {
    @apply flex items-center justify-between p-4 rounded-lg;
}

.flash-success {
    @apply bg-green-600/20 border border-green-600/30 text-green-300;
}

.flash-error {
    @apply bg-red-600/20 border border-red-600/30 text-red-300;
}

.flash-info {
    @apply bg-blue-600/20 border border-blue-600/30 text-blue-300;
}

/* Pill Styles */
.pill {
    @apply inline-flex items-center px-3 py-1 bg-moonlife-purple/20 text-moonlife-gold text-xs font-medium rounded-full border border-moonlife-purple/30;
}

/* Insight Card Styles */
.insight-card {
    @apply bg-gradient-to-br from-moonlife-purple/10 to-moonlife-gold/10 p-4 rounded-xl border border-moonlife-purple/20;
}

.insight-content {
    @apply prose prose-invert max-w-none;
}

.insight-content h1, 
.insight-content h2, 
.insight-content h3, 
.insight-content h4 {
    @apply text-moonlife-gold mb-4;
}

.insight-content p {
    @apply text-gray-200 mb-4 leading-relaxed;
}

.insight-content strong {
    @apply text-moonlife-gold font-semibold;
}

.insight-content ul, 
.insight-content ol {
    @apply space-y-2 mb-4 pl-6;
}

.insight-content li {
    @apply text-gray-200;
}

.insight-content li::marker {
    @apply text-moonlife-purple;
}

/* Cosmology Wheel Styles */
.cosmology-wheel-container {
    @apply relative;
}

.cosmology-wheel-container::after {
    content: '';
    position: absolute;
    inset: -20px;
    background: conic-gradient(from 0deg, 
        rgba(106, 0, 255, 0.1), 
        rgba(231, 199, 89, 0.1), 
        rgba(106, 0, 255, 0.1));
    border-radius: 50%;
    animation: rotate 60s linear infinite;
    z-index: -1;
}

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

/* Switch Component */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background: var(--gradient-primary);
}

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

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

.slide-up {
    animation: slideUp 0.3s ease-out;
}

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

/* Responsive Adjustments & PWA Optimizations */
@media (max-width: 768px) {
    body {
        overscroll-behavior: none;
        touch-action: manipulation;
        -webkit-user-select: none;
        user-select: none;
    }
    
    .cosmology-wheel-container img {
        width: 280px !important;
        height: 280px !important;
    }
    
    .nav-link {
        @apply text-sm;
    }
    
    .card {
        @apply p-4;
        margin-bottom: 1rem;
    }
    
    .section-title {
        @apply text-lg;
    }
    
    /* iPhone-specific optimizations */
    .form-input, .form-textarea {
        font-size: 16px !important; /* Prevent zoom on iOS */
        min-height: 48px; /* Touch target size for PWA */
        touch-action: manipulation;
    }
    
    /* Better touch targets for PWA */
    .btn-primary, .btn-secondary, .btn-danger {
        min-height: 48px;
        padding: 14px 24px;
        touch-action: manipulation;
    }
    
    /* Improved spacing for mobile */
    .grid {
        gap: 1rem;
    }
    
    /* Better text contrast on mobile */
    p, .text-gray-300 {
        color: #e5e7eb !important;
    }
    
    .text-gray-400 {
        color: #d1d5db !important;
    }
}

/* PWA safe areas for notched devices */
@supports (padding-top: env(safe-area-inset-top)) {
    body {
        padding-top: env(safe-area-inset-top);
    }
    
    .bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .cosmology-wheel-container::after {
        animation: none;
    }
    
    .btn-primary:hover,
    .btn-secondary:hover,
    .btn-danger:hover {
        transform: none;
    }
}

/* Focus Styles for Keyboard Navigation */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--moonlife-gold);
    outline-offset: 2px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--gradient-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--moonlife-gold), var(--moonlife-purple));
}

/* iPhone 13 mini specific optimizations */
@media screen and (max-width: 375px) and (max-height: 812px) {
    /* iPhone 13 mini viewport: 375x812 */
    
    /* Optimize text sizes for small screen */
    h1 { font-size: 1.875rem !important; }
    h2 { font-size: 1.5rem !important; }
    h3 { font-size: 1.25rem !important; }
    
    /* Better spacing */
    .max-w-6xl {
        max-width: 100% !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    /* Enhanced contrast for better readability */
    .text-gray-300 {
        color: #f3f4f6 !important;
    }
    
    .text-gray-400 {
        color: #e5e7eb !important;
    }
    
    /* Better mobile navigation */
    .nav-link {
        font-size: 14px !important;
        padding: 8px 12px !important;
        display: flex !important;
        align-items: center !important;
    }
    
    /* Optimized form inputs for small screens */
    .form-input, .form-textarea {
        font-size: 16px !important;
        padding: 14px 16px !important;
        border-width: 2px !important;
    }
    
    /* Better card spacing */
    .card {
        margin: 0.75rem 0 !important;
        padding: 1rem !important;
    }
    
    /* Grid optimizations */
    .grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
    
    /* Button improvements */
    .btn-primary, .btn-secondary, .btn-danger {
        width: 100% !important;
        padding: 16px 20px !important;
        font-size: 16px !important;
        font-weight: 600 !important;
        margin-bottom: 0.5rem !important;
    }
}

/* PWA specific styles */
.pwa-install-btn {
    @apply fixed bottom-4 right-4 bg-gradient-to-r from-moonlife-purple to-moonlife-gold text-black font-semibold px-4 py-2 rounded-full shadow-lg z-50;
    display: none;
}

.pwa-install-btn.show {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Enhanced focus states for better accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--moonlife-gold);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Modern Form Components */
.form-card {
    background: rgba(106, 0, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(106, 0, 255, 0.3);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
    color: #ffffff;
}

.form-section {
    margin-bottom: 32px;
}

.form-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Selection Buttons */
.selection-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.selection-btn {
    background: rgba(106, 0, 255, 0.2);
    border: 1px solid rgba(106, 0, 255, 0.4);
    border-radius: 16px;
    padding: 8px 16px;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    user-select: none;
}

.selection-btn:hover {
    background: rgba(106, 0, 255, 0.3);
    border-color: rgba(106, 0, 255, 0.6);
    transform: translateY(-1px);
}

.selection-btn.active {
    background: rgba(106, 0, 255, 0.8);
    border-color: rgba(106, 0, 255, 1);
    color: #ffffff;
}

/* Modern Sliders */
.slider-container {
    margin: 16px 0;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
    color: #ffffff;
}

.range-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #6A00FF, #E7C759);
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

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

/* Scale Indicators */
.scale-indicators {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

/* Toggle Switches */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.3);
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #6A00FF;
}

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

/* Circular Selection (Pain Intensity) */
.circle-selection {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 16px 0;
}

.circle-option {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(106, 0, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.circle-option.active {
    border-color: #6A00FF;
    background: #6A00FF;
}

.circle-option:hover {
    border-color: #6A00FF;
    transform: scale(1.1);
}

/* Input Fields with Better Contrast */
.modern-input {
    background: rgba(106, 0, 255, 0.2);
    border: 1px solid rgba(106, 0, 255, 0.4);
    border-radius: 16px;
    padding: 12px 16px;
    color: #ffffff;
    font-size: 16px;
    width: 100%;
    transition: all 0.2s ease;
}

.modern-input:focus {
    outline: none;
    border-color: #E7C759;
    background: rgba(106, 0, 255, 0.3);
    box-shadow: 0 0 0 2px rgba(231, 199, 89, 0.3);
}

.modern-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* Print Styles */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    
    .card {
        border: 1px solid #ccc !important;
        background: white !important;
    }
    
    .btn-primary,
    .btn-secondary,
    .btn-danger {
        display: none;
    }
}
