/* Additional custom styles */

/* Smooth scrolling for navigation links */
html {
    scroll-behavior: smooth;
}


/* Enhanced button styles */
button {
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

button:hover::before {
    left: 100%;
}


/* Responsive design improvements */
@media (max-width: 768px) {
    .text-7xl {
        font-size: 3rem;
        line-height: 1.1;
    }

    .text-5xl {
        font-size: 2.5rem;
        line-height: 1.2;
    }
}

/* Wheel container responsive scaling - replaces JavaScript resize logic */
@media (max-width: 479px) {
    #wheel-container {
        transform: scale(0.75);
    }
}



/* History modal animations */
#history-modal {
    backdrop-filter: blur(4px);
}

#history-modal.hidden {
    animation: fadeOut 0.3s ease-out forwards;
}

#history-modal:not(.hidden) {
    animation: fadeIn 0.3s ease-out forwards;
}

#history-modal .bg-white {
    animation: slideUp 0.3s ease-out forwards;
}

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

/* Full-screen letter display animations */
#fullscreen-letter {
    backdrop-filter: blur(2px);
}

#fullscreen-letter.animate-fade-in {
    animation: fullscreenFadeIn 0.8s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

#fullscreen-letter-text {
    animation: letterPulse 2s ease-in-out infinite alternate;
    text-shadow: 0 0 50px rgba(255, 255, 255, 0.5);
}

@keyframes fullscreenFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes letterPulse {
    from {
        transform: scale(1);
        text-shadow: 0 0 50px rgba(255, 255, 255, 0.5);
    }
    to {
        transform: scale(1.05);
        text-shadow: 0 0 80px rgba(255, 255, 255, 0.8);
    }
}

/* Responsive full-screen letter */
@media (max-width: 768px) {
    #fullscreen-letter-text {
        font-size: 15rem !important;
    }
}

@media (max-width: 480px) {
    #fullscreen-letter-text {
        font-size: 12rem !important;
    }
}

/* Modal responsive design */
@media (max-width: 480px) {
    #history-modal .bg-white {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }
}

/* Improved scrollbar for history list */
.max-h-\[400px\]::-webkit-scrollbar {
    width: 6px;
}

.max-h-\[400px\]::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.max-h-\[400px\]::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.max-h-\[400px\]::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Sound control styling */
.slider {
    background: linear-gradient(to right, #007AFF 0%, #007AFF 50%, #d1d5db 50%, #d1d5db 100%);
    outline: none;
    opacity: 1;
    transition: opacity 0.2s;
}

.slider:hover {
    opacity: 0.8;
}

.slider::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #007AFF;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #007AFF;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.slider:disabled::-webkit-slider-thumb {
    cursor: not-allowed;
    background: #9ca3af;
}

.slider:disabled::-moz-range-thumb {
    cursor: not-allowed;
    background: #9ca3af;
}

/* Update slider fill based on value */
.slider::-webkit-slider-runnable-track {
    background: #d1d5db;
    height: 8px;
    border-radius: 4px;
}

.slider::-moz-range-track {
    background: #d1d5db;
    height: 8px;
    border-radius: 4px;
    border: none;
}

/* Sound control hover popup */
.sound-control-container:hover #volume-popup,
#volume-popup:hover {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0px);
}

/* Keep popup visible when hovering over it */
#volume-popup {
    z-index: 50;
}

/* Volume control custom styling */
#volume-slider {
    z-index: 10;
}

#volume-fill {
    pointer-events: none;
    min-height: 2px;
}

#volume-handle {
    pointer-events: none;
    z-index: 5;
}

/* Wheel Options Modal Animations */
#wheel-options-modal {
    backdrop-filter: blur(4px);
}

#wheel-options-modal.hidden {
    animation: fadeOut 0.3s ease-out forwards;
}

#wheel-options-modal:not(.hidden) {
    animation: fadeIn 0.3s ease-out forwards;
}

#wheel-options-modal .animate-slide-up {
    animation: slideUpModal 0.4s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

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

/* Radio button custom styling */
input[type="radio"]:checked {
    background-color: #007AFF;
    border-color: #007AFF;
}

input[type="radio"]:checked + div {
    border-color: #007AFF !important;
    background-color: rgba(0, 122, 255, 0.05) !important;
}

/* Letter option card hover states */
.border-2:hover {
    box-shadow: 0 4px 20px rgba(0, 122, 255, 0.1);
}

/* Advanced options toggle animation */
#advanced-options-toggle svg {
    transition: transform 0.2s ease;
}

#advanced-options-toggle[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

/* Mobile optimizations for wheel options modal */
@media (max-width: 640px) {
    #wheel-options-modal {
        align-items: flex-end;
    }

    #wheel-options-modal .bg-white {
        width: 100%;
        max-height: 90vh;
        border-radius: 1.5rem 1.5rem 0 0;
        margin: 0;
        overflow: hidden;
    }

    /* Adjust card content padding for mobile */
    .modal-card .p-4 {
        padding: 1rem;
    }

    .modal-card .px-5 {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Ensure proper scrolling on mobile */
    .modal-card {
        display: flex;
        flex-direction: column;
        max-height: 90vh;
    }

    .modal-card .p-4 {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Maintain touch targets on mobile */
    input[type="radio"] {
        width: 1rem;
        height: 1rem;
    }

    label .border-2 {
        padding: 0.875rem;
    }

    /* Advanced options specific mobile optimizations */
    #advanced-options-card .space-y-2 {
        gap: 0.75rem;
    }

    /* Reduce spacing in advanced options for mobile */
    #advanced-options-card .space-y-3 > * + * {
        margin-top: 0.75rem;
    }

    /* Compact helper text on mobile */
    #advanced-options-card .bg-blue-50 {
        padding: 0.75rem;
    }

    #advanced-options-card .bg-blue-50 .text-xs {
        font-size: 0.7rem;
        line-height: 1.2;
    }
}

/* iOS-style radio buttons */
input[type="radio"] {
    -webkit-appearance: none;
    appearance: none;
    border-radius: 50%;
    position: relative;
}

input[type="radio"]:checked::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 60%;
    border-radius: 50%;
    background-color: white;
}

/* Smooth transitions for all interactive elements */
input[type="radio"],
.border-2,
button {
    transition: all 0.2s ease;
}

/* Focus styles for accessibility */
input[type="radio"]:focus {
    outline: 2px solid #007AFF;
    outline-offset: 2px;
}

.border-2:focus-within {
    outline: 2px solid #007AFF;
    outline-offset: -2px;
}

/* Confirm button styling */
#confirm-wheel-options {
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.2);
}

#confirm-wheel-options:hover {
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.3);
}

#confirm-wheel-options:active {
    box-shadow: 0 1px 4px rgba(0, 122, 255, 0.4);
}

#confirm-wheel-options:focus {
    outline: 2px solid #007AFF;
    outline-offset: 2px;
}

/* Loading state animation for confirm button */
#confirm-wheel-options.loading {
    pointer-events: none;
    opacity: 0.7;
}

#confirm-wheel-options.loading svg {
    animation: spin 1s linear infinite;
}

/* Advanced options checkbox styling */
input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    border-radius: 3px;
    position: relative;
    transition: all 0.2s ease;
}

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

input[type="checkbox"]:checked::before {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 10px;
    font-weight: bold;
    line-height: 1;
}

input[type="checkbox"]:focus {
    outline: 2px solid #007AFF;
    outline-offset: 1px;
}

/* Custom textarea styling */
#custom-letters {
    transition: all 0.2s ease;
}

#custom-letters:focus {
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

/* Advanced options grid layout improvements */
.grid.grid-cols-2 label {
    min-height: 20px;
}

/* Ensure proper alignment for checkbox labels */
.flex.items-center input[type="checkbox"] {
    flex-shrink: 0;
}

/* Modal card transitions */
.modal-card {
    transition: all 0.3s ease-in-out;
}

.modal-card.hidden {
    opacity: 0;
    transform: translateX(20px);
    pointer-events: none;
}

.modal-card:not(.hidden) {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

/* Ensure cards take full width and height */
.modal-card {
    width: 100%;
    min-height: 400px;
    max-height: 80vh;
    overflow-y: auto;
}

/* Responsive card heights */
@media (max-width: 640px) {
    .modal-card {
        min-height: auto;
        max-height: 75vh;
    }
}

/* Advanced options navigation styling */
#show-advanced-options {
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.1), rgba(88, 86, 214, 0.1));
    border-radius: 0.75rem;
    padding: 0.75rem;
}

#show-advanced-options:hover {
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.15), rgba(88, 86, 214, 0.15));
    transform: translateY(-1px);
}

#back-to-core-letters {
    border-radius: 0.75rem;
    padding: 0.75rem;
}

#back-to-core-letters:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Enhanced styling for core confirm button */
#core-confirm-btn {
    background: linear-gradient(135deg, #007AFF, #5856D6);
}

#core-confirm-btn:hover {
    background: linear-gradient(135deg, #0056b3, #4a48c7);
}

/* Card header styling consistency */
.modal-card .bg-gray-50 {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
}

/* Animation for card switching */
@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Apply animations when cards are shown */
#advanced-options-card:not(.hidden) {
    animation: slideInFromRight 0.3s ease-out;
}

#core-letters-card:not(.hidden) {
    animation: slideInFromLeft 0.3s ease-out;
}

/* Mobile scroll styling for modal cards */
@media (max-width: 640px) {
    .modal-card::-webkit-scrollbar {
        width: 3px;
    }

    .modal-card::-webkit-scrollbar-track {
        background: transparent;
    }

    .modal-card::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.2);
        border-radius: 3px;
    }

    .modal-card::-webkit-scrollbar-thumb:hover {
        background: rgba(0, 0, 0, 0.3);
    }

    /* Add scroll indicator for better UX */
    .modal-card .p-4 {
        padding-bottom: 2rem; /* Extra bottom padding for mobile scroll */
    }

    /* Ensure confirm button is always visible */
    #advanced-options-card .space-y-3 {
        padding-bottom: 1rem;
    }
}