/* Global Inter font application */
* {
    font-family: "Inter", sans-serif;
    font-optical-sizing: auto;
    font-style: normal;
}

/* Inter font weight utility classes */
.inter-light {
    font-weight: 300;
}

.inter-regular {
    font-weight: 400;
}

.inter-medium {
    font-weight: 500;
}

.inter-semibold {
    font-weight: 600;
}

.inter-bold {
    font-weight: 700;
}

/* Apply appropriate weights to common elements */
h1 {
    font-weight: 700; /* Bold for main headings */
}

h2 {
    font-weight: 600; /* Semi-bold for subheadings */
}

h3, h4, h5, h6 {
    font-weight: 500; /* Medium for smaller headings */
}

p, body {
    font-weight: 400; /* Regular for body text */
}

.btn {
    font-weight: 500; /* Medium for buttons */
}

/* Hero Section */
.hero-section {
    position: relative;
    background: url('/uploads/backgrounds/watten.jpg') center/cover no-repeat;
    min-height: 500px;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    z-index: 0;
}

.dark .hero-section::before {
    background: rgba(17, 24, 39, 0.85);
}

.hero-section .container {
    position: relative;
    z-index: 2;
}

/* Profile Dropdown */
.group:hover .group-hover\:block {
    display: block;
}

.group:focus-within .group-hover\:block {
    display: block;
}

.group .group-hover\:visible {
    transition: opacity 150ms ease-in-out, visibility 0s linear;
}

.group:hover .group-hover\:visible {
    transition-delay: 0s;
}

/* Win Rate Circle */
.win-rate-circle {
    transition: stroke-dashoffset 1s ease-in-out;
}

/* Subheadings Animation */
.subheadings-container {
    position: relative;
    height: 3em;
    overflow: hidden;
}

@media (max-width: 768px) {
    .subheadings-container {
        height: 2em;
    }
}

.subheading {
    position: absolute;
    width: 100%;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    margin: 0;
}

.subheading.active {
    opacity: 1;
}

/* Theme Toggle Animation */
#themeToggle {
    transition: transform 0.3s ease;
}

#themeToggle.rotate-180 {
    transform: rotate(180deg);
}

/* Card Animations */
.card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Page Transitions */
.page-transition {
    transition: opacity 0.3s ease-in-out;
}

.page-transition-enter {
    opacity: 0;
}

.page-transition-enter-active {
    opacity: 1;
}

.page-transition-exit {
    opacity: 1;
}

.page-transition-exit-active {
    opacity: 0;
}

/* Form Focus States */
.form-input:focus,
.form-select:focus,
.form-radio:focus {
    border-color: #6B7280;
    box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.45);
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-section {
        min-height: 400px;
    }
    
    /* Ensure footer is visible and properly spaced on mobile */
    footer {
        position: relative;
        width: 100%;
    }
    
    /* Center content and add proper spacing on mobile */
    .hero-section .container {
        padding-top: 1rem;
        padding-bottom: 3rem;
    }
    
    /* Mobile header adjustments */
    header nav {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    /* Profile menu positioning on mobile - bigger */
    #profileMenu {
        right: -0.5rem;
        min-width: 192px;
    }
    
}

/* Profile Menu Slide Animation */
#profileMenu {
    transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out, transform 0.2s ease-in-out;
    transform: translateY(-10px);
}

#profileMenu.show {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0);
}

/* Dark Mode Transitions */
.dark .card {
    background-color: #1f2937;
    color: #f3f4f6;
}

.dark .text-gray-600 {
    color: #9ca3af;
}

.dark .border-gray-100 {
    border-color: #374151;
}

/* Dropdown Menu Animation */
.group-hover\:opacity-100 {
    transition: opacity 0.15s ease-in-out;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    padding: 1rem;
    border-radius: 0.5rem;
    background: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    z-index: 50;
    opacity: 0;
    transform: translateY(1rem);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.dark .toast {
    background: #1f2937;
    color: white;
}

/* iOS Safe Area Support */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    /* Add padding to fixed positioned elements at bottom */
    .toast {
        bottom: calc(1rem + env(safe-area-inset-bottom));
    }
    
    /* Ensure body has padding for safe areas */
    body {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* iOS Modal Fixes - Prevent body scroll when modal is open */
body.modal-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

/* Notification Menu Mobile iOS Fixes */
@media (max-width: 768px) {
    #notificationMenu {
        /* Position relative to viewport on mobile - must override Tailwind's absolute */
        position: fixed !important;
        top: calc(5rem + env(safe-area-inset-top, 0)) !important;
        right: 0.5rem !important;
        left: 0.5rem !important;
        bottom: auto !important;
        margin-top: 0 !important;
        max-width: none !important;
        width: calc(100vw - 1rem) !important;
        /* Increase z-index to appear above other content */
        z-index: 1000 !important;
        /* Enable smooth scrolling on iOS */
        -webkit-overflow-scrolling: touch !important;
        /* Ensure content is scrollable - must override Tailwind */
        max-height: calc(80vh - env(safe-area-inset-top, 0) - 5rem - env(safe-area-inset-bottom, 0)) !important;
        overflow-y: auto !important;
        /* Add better shadow for mobile */
        box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
    }
}

/* Settings Modal iOS Fixes */
#settingsModal {
    /* Ensure modal covers full viewport including safe areas */
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
}

#settingsModal > div {
    /* Enable scrolling on the modal content wrapper */
    max-height: 100vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

#settingsModal .max-w-md {
    /* Ensure modal content respects safe areas */
    margin-top: max(1rem, env(safe-area-inset-top, 0)) !important;
    margin-bottom: max(1rem, env(safe-area-inset-bottom, 0)) !important;
    max-height: calc(100vh - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0) - 2rem) !important;
}

/* Settings modal smaller on mobile with margins - iOS optimized */
@media (max-width: 768px) {
    #settingsModal .max-w-md {
        max-width: calc(100vw - 4rem) !important;
        margin-left: 2rem !important;
        margin-right: 2rem !important;
        margin-top: calc(env(safe-area-inset-top, 0) + 2rem) !important;
        margin-bottom: calc(env(safe-area-inset-bottom, 0) + 2rem) !important;
        max-height: calc(85vh - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0)) !important;
    }
}

#settingsModal .max-w-md > div {
    /* Make inner content scrollable */
    max-height: calc(80vh - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0) - 4rem) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Further reduce on very small screens (iPhone SE, etc) */
@media (max-width: 480px) {
    #settingsModal .max-w-md {
        max-width: calc(100vw - 3rem) !important;
        margin-left: 1.5rem !important;
        margin-right: 1.5rem !important;
        max-height: calc(80vh - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0)) !important;
    }
    
    #settingsModal .max-w-md > div {
        max-height: calc(75vh - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0) - 4rem) !important;
    }
    
    /* Reduce padding on small screens to maximize space */
    #settingsModal .p-4,
    #settingsModal .p-6 {
        padding: 1rem !important;
    }
    
    #settingsModal .mb-4,
    #settingsModal .mb-6 {
        margin-bottom: 0.75rem !important;
    }
    
    #settingsModal .space-y-4 > * + *,
    #settingsModal .space-y-6 > * + * {
        margin-top: 0.75rem !important;
    }
}

/* Notification menu scrolling improvements */
#notificationMenu #notificationContent {
    max-height: inherit !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

/* Delete Account Modal iOS Fixes */
#deleteAccountModal {
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
}

#deleteAccountModal > div {
    max-height: 100vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin-top: max(1rem, env(safe-area-inset-top, 0)) !important;
    margin-bottom: max(1rem, env(safe-area-inset-bottom, 0)) !important;
}

/* Change Password Modal iOS Fixes */
#changePasswordModal {
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
}

#changePasswordModal > div {
    max-height: 100vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin-top: max(1rem, env(safe-area-inset-top, 0)) !important;
    margin-bottom: max(1rem, env(safe-area-inset-bottom, 0)) !important;
}

/* Password Success Modal iOS Fixes */
#passwordSuccessModal {
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
}

#passwordSuccessModal > div {
    max-height: 100vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin-top: max(1rem, env(safe-area-inset-top, 0)) !important;
    margin-bottom: max(1rem, env(safe-area-inset-bottom, 0)) !important;
}

/* Ensure header respects safe area on iOS */
@supports (padding-top: env(safe-area-inset-top)) {
    header nav {
        padding-top: env(safe-area-inset-top, 0);
    }
}