/* ============================================
   ARTIST ONBOARDING - MOBILE-FIRST RESPONSIVE CSS
   ============================================ */

/* Base Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Step Content Transitions */
.step-content {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.step-content.active {
    display: block;
}

/* Form Container Enhancements */
.bg-white.rounded-2xl {
    transition: all 0.3s ease;
}

/* Input Field Enhancements */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
textarea,
select {
    transition: all 0.3s ease;
    font-size: 16px !important; /* Prevents zoom on iOS */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

input:focus,
textarea:focus,
select:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(157, 123, 93, 0.15) !important;
    border-color: #9A7B5E !important;
}

/* Safari-specific fixes */
@supports (-webkit-touch-callout: none) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="url"],
    input[type="number"],
    textarea {
        -webkit-appearance: none;
        border-radius: 0.5rem;
    }
    
    select {
        -webkit-appearance: none;
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
        background-position: right 0.5rem center;
        background-repeat: no-repeat;
        background-size: 1.5em 1.5em;
        padding-right: 2.5rem;
    }
}

/* Error State with Smooth Transition */
.field-error {
    border-color: #ef4444 !important;
    animation: shake 0.3s ease;
}

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

/* Error and Success Messages */
.error-message,
.success-message {
    animation: slideInLeft 0.3s ease;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    border-radius: 0.375rem;
}

.error-message {
    color: #dc2626;
    background-color: #fef2f2;
    border-left: 3px solid #ef4444;
}

.success-message {
    color: #059669;
    background-color: #f0fdf4;
    border-left: 3px solid #10b981;
}

/* Progress Bar Animation */
.progress-bar {
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Button Enhancements */
button {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Safari iOS button fix */
@supports (-webkit-touch-callout: none) {
    button {
        -webkit-appearance: none;
        border-radius: 0.5rem;
    }
}

/* Button Ripple Effect */
button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:active::before {
    width: 300px;
    height: 300px;
}

/* Icon Animations */
.fas, .fab {
    transition: all 0.3s ease;
}

button:hover .fas,
button:hover .fab {
    transform: scale(1.1);
}

/* Profile Picture Preview */
#profile-preview {
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

#profile-preview:hover {
    border-color: #9A7B5E;
    transform: scale(1.05);
}

#profile-preview img {
    transition: all 0.3s ease;
}

/* Loading Overlay */
#loading-overlay {
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
}

#loading-overlay > div {
    animation: scaleIn 0.3s ease;
}

/* Social Media Icons */
.social-media-icons .form-field {
    animation: fadeIn 0.4s ease;
    animation-fill-mode: both;
}

.social-media-icons .form-field:nth-child(1) { animation-delay: 0.1s; }
.social-media-icons .form-field:nth-child(2) { animation-delay: 0.2s; }
.social-media-icons .form-field:nth-child(3) { animation-delay: 0.3s; }
.social-media-icons .form-field:nth-child(4) { animation-delay: 0.4s; }
.social-media-icons .form-field:nth-child(5) { animation-delay: 0.5s; }

/* Selected Location Card */
#selected-location {
    animation: slideInRight 0.4s ease;
}

/* Manual Address Fallback */
#manual-address-fallback {
    animation: slideInLeft 0.4s ease;
}

/* Checkbox Styling */
input[type="checkbox"] {
    transition: all 0.2s ease;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #d1d5db;
    border-radius: 0.25rem;
    background-color: white;
    position: relative;
    flex-shrink: 0;
}

input[type="checkbox"]:checked {
    background-color: #9A7B5E;
    border-color: #9A7B5E;
}

input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 0.375rem;
    height: 0.625rem;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: translate(-50%, -60%) rotate(45deg);
}

input[type="checkbox"]:hover {
    transform: scale(1.1);
}

/* Safari iOS checkbox fix */
@supports (-webkit-touch-callout: none) {
    input[type="checkbox"] {
        -webkit-appearance: none;
    }
}

/* Section Cards */
.bg-gray-50 {
    transition: all 0.3s ease;
}

.bg-gray-50:hover {
    background-color: #f9fafb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* ============================================
   MOBILE RESPONSIVE OPTIMIZATIONS
   ============================================ */

/* Mobile First - Base Styles (320px+) */
@media (max-width: 640px) {
    /* Container Padding */
    .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* Form Container */
    .bg-white.rounded-2xl {
        padding: 1.25rem !important;
        margin-bottom: 1rem !important;
        border-radius: 1rem !important;
    }

    /* Header Text */
    h1 {
        font-size: 1.5rem !important;
        line-height: 2rem !important;
        margin-bottom: 0.5rem !important;
    }

    h2 {
        font-size: 1.25rem !important;
        line-height: 1.75rem !important;
    }

    h3 {
        font-size: 1.125rem !important;
        line-height: 1.5rem !important;
    }

    /* Icons */
    .text-4xl {
        font-size: 2.5rem !important;
    }

    /* Progress Bar */
    .mb-4 {
        margin-bottom: 1rem !important;
    }

    /* Form Fields */
    .space-y-4 > * + * {
        margin-top: 1rem !important;
    }

    .space-y-6 > * + * {
        margin-top: 1.25rem !important;
    }

    /* Input Fields */
    input,
    textarea,
    select {
        padding: 0.875rem 1rem !important;
        font-size: 16px !important; /* Prevents iOS zoom */
        -webkit-appearance: none !important;
        border-radius: 0.5rem !important;
    }

    input[type="email"],
    input[type="password"],
    input[type="text"],
    input[type="url"],
    input[type="number"] {
        padding-left: 2.5rem !important;
    }
    
    /* Safari iOS specific input fixes */
    @supports (-webkit-touch-callout: none) {
        input,
        textarea {
            -webkit-appearance: none !important;
            -webkit-border-radius: 0.5rem !important;
        }
        
        select {
            -webkit-appearance: none !important;
            background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e") !important;
            background-position: right 0.5rem center !important;
            background-repeat: no-repeat !important;
            background-size: 1.5em 1.5em !important;
            padding-right: 2.5rem !important;
        }
    }

    /* Buttons */
    button {
        padding: 0.875rem 1.5rem !important;
        font-size: 0.9375rem !important;
        width: 100%;
    }

    #prev-step,
    #next-step,
    #complete-registration {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    /* Navigation Buttons Container */
    .flex.justify-between.items-center.mt-8 {
        flex-direction: column !important;
        gap: 0.75rem;
    }

    .flex.space-x-4 {
        flex-direction: column !important;
        width: 100%;
        gap: 0.75rem;
    }

    .flex.space-x-4 > * {
        margin: 0 !important;
    }

    /* Grid Layouts */
    .grid.grid-cols-1.md\:grid-cols-2 {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Social Media Grid */
    .social-media-icons {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Profile Picture Section */
    .flex.items-center.space-x-4 {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem;
    }

    .flex.items-center.space-x-4 > * {
        margin: 0 !important;
    }

    #profile-preview {
        width: 5rem !important;
        height: 5rem !important;
        margin: 0 auto;
    }

    /* OTP Input */
    #otp {
        width: 100% !important;
        max-width: 16rem;
        font-size: 1.5rem !important;
        padding: 0.75rem !important;
    }

    /* Subscription Card */
    .bg-white.p-4.rounded-lg {
        flex-direction: column !important;
        text-align: center;
    }

    .text-right {
        text-align: center !important;
        margin-top: 1rem;
    }

    /* Selected Location */
    #selected-location .flex {
        flex-direction: column !important;
        gap: 0.75rem;
    }

    /* Manual Address Grid */
    #manual-address-fallback .grid {
        grid-template-columns: 1fr !important;
    }

    /* Reduce Section Padding */
    .bg-gray-50.p-6 {
        padding: 1rem !important;
    }

    /* Mapbox Geocoder */
    .mapboxgl-ctrl-geocoder {
        font-size: 14px !important;
    }

    .mapboxgl-ctrl-geocoder--input {
        height: 44px !important;
        padding-left: 35px !important;
        font-size: 16px !important; /* Prevents iOS zoom */
    }

    /* Loading Overlay */
    #loading-overlay > div {
        margin: 1rem;
        padding: 1.5rem !important;
    }

    /* Reduce margins */
    .mb-8 {
        margin-bottom: 1.5rem !important;
    }

    .mb-6 {
        margin-bottom: 1rem !important;
    }

    .mt-8 {
        margin-top: 1.5rem !important;
    }

    /* Text sizes */
    .text-sm {
        font-size: 0.875rem !important;
    }

    .text-xs {
        font-size: 0.75rem !important;
    }

    /* Checkbox labels */
    label.flex.items-start {
        font-size: 0.9375rem !important;
    }
}

/* Tablet Styles (641px - 768px) */
@media (min-width: 641px) and (max-width: 768px) {
    .container {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }

    .bg-white.rounded-2xl {
        padding: 2rem !important;
    }

    .grid.grid-cols-1.md\:grid-cols-2 {
        grid-template-columns: 1fr !important;
    }

    button {
        padding: 0.875rem 2rem !important;
    }
}

/* Desktop Styles (769px+) */
@media (min-width: 769px) {
    /* Navigation buttons side by side */
    .flex.justify-between.items-center.mt-8 {
        flex-direction: row !important;
    }

    .flex.space-x-4 {
        flex-direction: row !important;
    }

    #prev-step,
    #next-step,
    #complete-registration {
        width: auto;
    }

    /* Hover effects only on desktop */
    .bg-gray-50:hover {
        transform: translateY(-2px);
    }
}

/* Large Desktop (1024px+) */
@media (min-width: 1024px) {
    .container {
        max-width: 56rem !important;
    }
}

/* ============================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================ */

/* Focus Visible for Keyboard Navigation */
*:focus-visible {
    outline: 2px solid #9A7B5E !important;
    outline-offset: 2px;
}

/* Reduce Motion for Users with Preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    input,
    textarea,
    select,
    button {
        border-width: 2px !important;
    }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */

/* Larger touch targets */
@media (hover: none) and (pointer: coarse) {
    button,
    input[type="checkbox"],
    input[type="radio"],
    a {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    button:hover,
    .bg-gray-50:hover,
    input:hover {
        transform: none !important;
    }
    
    /* iOS Safari specific fixes */
    input,
    textarea,
    select,
    button {
        -webkit-appearance: none !important;
        -webkit-tap-highlight-color: transparent !important;
    }
    
    /* Fix for iOS Safari input zoom */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="url"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* iOS Safari specific media query */
@supports (-webkit-touch-callout: none) {
    /* Prevent iOS Safari from adding default styling */
    input,
    textarea,
    select,
    button {
        -webkit-appearance: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Fix rounded corners on iOS */
    input,
    textarea,
    button,
    select {
        border-radius: 0.5rem;
    }
    
    /* Fix for sticky hover states on iOS */
    * {
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Smooth scrolling for iOS */
    body,
    .overflow-y-auto {
        -webkit-overflow-scrolling: touch;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    #loading-overlay,
    button,
    .progress-bar {
        display: none !important;
    }

    .step-content {
        display: block !important;
        page-break-inside: avoid;
    }
}

/* ============================================
   DARK MODE SUPPORT (Optional)
   ============================================ */

@media (prefers-color-scheme: dark) {
    /* Add dark mode styles if needed in future */
}
