/* Custom styles to supplement Tailwind CSS */
/* Scoped app containers - don't affect global menu */
.content-container #app, 
.content-container #accountApp {
    max-width: 28rem;
}
.font-mono {
    font-family: 'Courier New', Courier, monospace;
}
#statsSummary, #statsHistory, #accountStats {
    font-size: 0.9rem;
    line-height: 1.5;
}
/* Updated .hidden rule - exclude dropdown menus which use opacity-based visibility */
.content-container .hidden:not([id$="DropdownMenu"]) {
    display: none !important;
}

/* Ensure global menu dropdowns work properly */
#global-menu-container .hidden {
    display: none !important;
}

#global-menu-container [id$="DropdownMenu"] {
    position: absolute !important;
    z-index: 9999 !important;
}

/* Specific fix for account dropdown menu in global menu */
#global-menu-container #accountDropdownMenu {
    position: absolute !important;
    z-index: 9999 !important;
    top: 100% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background-color: rgb(31, 41, 55) !important;
    border: 1px solid rgb(75, 85, 99) !important;
    border-radius: 0.5rem !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
    min-width: 16rem !important;
    transition: opacity 150ms ease-out, transform 150ms ease-out !important;
    transform-origin: top center !important;
    width: auto !important;
    max-width: none !important;
}

/* Account dropdown visibility states */
#global-menu-container #accountDropdownMenu.opacity-0.invisible {
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateX(-50%) scale(0.95) !important;
    pointer-events: none !important;
}

#global-menu-container #accountDropdownMenu.opacity-100.visible {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(-50%) scale(1) !important;
    pointer-events: auto !important;
}

/* Fix for account dropdown button in global menu */
#global-menu-container #accountDropdown {
    display: flex !important;
    align-items: center !important;
    position: relative !important;
    z-index: 1 !important;
}
/* Account section in page content only, not in global menu */
.content-container #accountSection {
    max-width: 28rem;
    margin: 0 auto;
    padding: 1rem;
    background-color: #f9fafb; /* Tailwind gray-50 */
}
.content-container #accountSection h2, 
.content-container #accountSection h3, 
.content-container #accountSection p, 
.content-container #accountSection input, 
.content-container #accountSection select, 
.content-container #accountSection button, 
.content-container #accountSection span, 
.content-container #accountSection div:not([id$="DropdownMenu"]) {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    margin-bottom: 0.5rem;
}
.content-container #accountSection #currentUsername {
    font-size: 1rem;
    color: #1f2937; /* Tailwind gray-800 */
}
.content-container #accountSection select {
    width: 100%;
    padding: 0.5rem;
}

/* Ensure global menu account section works properly */
#global-menu-container #accountSection {
    max-width: none;
    margin: 0;
    padding: 0;
    background-color: transparent;
    position: relative;
    display: inline-block;
}
#accountSection #accountDebug:not(.hidden) {
    background-color: #fee2e2; /* Tailwind red-100 */
    padding: 1rem;
    border: 1px solid #f87171; /* Tailwind red-400 */
}

/* CW Words Audio Settings - Slider Styling */
.slider-thumb-teal {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.slider-thumb-teal::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #14b8a6; /* Teal-500 */
    cursor: pointer;
    border: 3px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.slider-thumb-teal::-webkit-slider-thumb:hover {
    background: #0d9488; /* Teal-600 */
    transform: scale(1.1);
}

.slider-thumb-teal::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #14b8a6; /* Teal-500 */
    cursor: pointer;
    border: 3px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    -moz-appearance: none;
}

.slider-thumb-teal::-moz-range-thumb:hover {
    background: #0d9488; /* Teal-600 */
    transform: scale(1.1);
}

.slider-thumb-teal::-moz-range-track {
    background: transparent;
    border: none;
}

.slider-thumb-teal::-ms-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #14b8a6; /* Teal-500 */
    cursor: pointer;
    border: 3px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Shake animation for incorrect answers */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* CodeSnap Training Layout - 2/3 + 1/3 Split */
.training-container {
    display: flex !important;
    gap: 1.5rem !important;
    margin-bottom: 2rem !important;
    width: 100% !important;
}

.training-display-section {
    flex: 2 !important; /* 2/3 width */
    background-color: rgb(31 41 55) !important; /* gray-800 */
    border-radius: 12px !important;
    padding: 1.5rem !important;
    border: 1px solid rgb(75 85 99) !important; /* gray-600 */
    min-height: 600px !important;
}

.messages-section {
    flex: 1 !important; /* 1/3 width */
    background-color: rgb(31 41 55) !important; /* gray-800 */
    border-radius: 12px !important;
    padding: 1.5rem !important;
    border: 1px solid rgb(75 85 99) !important; /* gray-600 */
    min-height: 600px !important;
}

/* Section headers styling for new layout */
.training-display-section .section-header,
.messages-section .section-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 1rem !important;
    padding-bottom: 0.5rem !important;
    border-bottom: 1px solid rgb(75 85 99) !important; /* gray-600 */
}

.training-display-section .section-header h2,
.messages-section .section-header h2 {
    color: rgb(229 231 235) !important; /* gray-200 */
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    margin: 0 !important;
}

.training-display-section .section-header .text-sm,
.messages-section .section-header .text-sm {
    color: rgb(156 163 175) !important; /* gray-400 */
    font-size: 0.875rem !important;
}

/* Fixed size code display container to prevent layout shifting */
.codesnap-display-container {
    margin-bottom: 1.5rem;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.codesnap-display-container .codesnap-display {
    width: 100% !important;
    min-height: 120px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 1.5rem !important;
    font-size: 2.5rem !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    background-color: rgb(17 24 39) !important; /* gray-900 */
    border: 2px solid rgb(75 85 99) !important; /* gray-600 */
    transition: all 0.3s ease !important;
    font-family: 'Courier New', monospace !important;
    letter-spacing: 0.1em !important;
    color: rgb(229 231 235) !important; /* gray-200 */
}

/* Messages container with fixed height */
.messages-container {
    min-height: 400px !important;
    max-height: 500px !important;
    overflow-y: auto !important;
    position: relative !important;
    background-color: rgb(17 24 39) !important; /* gray-900 */
    border-radius: 8px !important;
    border: 1px solid rgb(75 85 99) !important; /* gray-600 */
    padding: 1rem !important;
}

/* Notification area styling for Messages section */
.messages-section .notification-area {
    display: block !important; /* Always visible in Messages section */
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
}

.messages-section .toast-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.75rem !important;
}

/* Default message styling */
.default-message {
    align-items: center !important;
    justify-content: center !important;
    height: 200px !important;
    text-align: center !important;
    opacity: 0.7 !important;
    color: rgb(156 163 175) !important; /* gray-400 */
}

/* Default message show/hide states */
.default-message.show {
    display: flex !important;
}

.default-message.hide {
    display: none !important;
}

/* Toast styling adjustments for Messages section */
.messages-section .toast {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    font-size: 0.875rem !important; /* sm */
    padding: 1rem !important;
    border-radius: 8px !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
    background-color: rgb(55 65 81) !important; /* gray-700 */
    border: 1px solid rgb(75 85 99) !important; /* gray-600 */
    color: rgb(229 231 235) !important; /* gray-200 */
}

.messages-section .toast-title {
    font-size: 0.875rem !important; /* sm */
    font-weight: 600 !important;
    margin-bottom: 0.5rem !important;
    line-height: 1.4 !important;
    color: rgb(229 231 235) !important; /* gray-200 */
}

.messages-section .toast-message {
    font-size: 0.75rem !important; /* xs */
    line-height: 1.4 !important;
    margin-bottom: 0.5rem !important;
    color: rgb(209 213 219) !important; /* gray-300 */
}

.messages-section .toast-details {
    font-size: 0.75rem !important; /* xs */
    line-height: 1.3 !important;
    opacity: 0.8 !important;
    margin-top: 0.25rem !important;
    color: rgb(156 163 175) !important; /* gray-400 */
}

/* Achievement popup adjustments for narrower space */
.messages-section .achievement-popup {
    max-width: 100% !important;
    padding: 1rem !important;
    font-size: 0.875rem !important;
    background-color: rgb(55 65 81) !important; /* gray-700 */
    border: 1px solid rgb(75 85 99) !important; /* gray-600 */
}

.messages-section .achievement-popup .achievement-title {
    font-size: 1rem !important;
    margin-bottom: 0.5rem !important;
    color: rgb(229 231 235) !important; /* gray-200 */
}

.messages-section .achievement-popup .achievement-description {
    font-size: 0.75rem !important;
    line-height: 1.4 !important;
    color: rgb(209 213 219) !important; /* gray-300 */
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .training-container {
        flex-direction: column !important;
        gap: 1rem !important;
    }
    
    .training-display-section,
    .messages-section {
        flex: none !important;
        width: 100% !important;
    }
    
    .messages-container {
        min-height: 250px !important;
        max-height: 300px !important;
    }
}

/* Additional force overrides to ensure layout works */
body .training-container {
    display: flex !important;
    flex-wrap: nowrap !important;
}

body .training-display-section {
    flex: 2 1 66.666667% !important; /* 2/3 width with grow/shrink */
    max-width: 66.666667% !important;
}

body .messages-section {
    flex: 1 1 33.333333% !important; /* 1/3 width with grow/shrink */
    max-width: 33.333333% !important;
}

/* Remove debugging outlines - layout is working */

/* Session complete toast specific adjustments for Messages section */
.messages-section .toast.session-complete {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
}

.messages-section .toast.session-complete .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 4px !important;
    padding: 6px 8px !important;
    margin: 0 6px !important;
}

.messages-section .toast.session-complete .stat-value {
    font-size: 12px !important;
}

.messages-section .toast.session-complete .stat-label {
    font-size: 9px !important;
}

.messages-section .toast.session-complete .completion-message {
    font-size: 11px !important;
    padding: 4px 8px !important;
}

.messages-section .toast.session-complete .detail-row {
    font-size: 10px !important;
    padding: 0 !important;
}

.messages-section .toast.session-complete .session-details {
    padding: 6px 8px 8px !important;
}