:root {
    --matrix-green: #00FF41;
    --dark-bg: #0D0208;
    --dark-ui: #1a1a1a;
    --dark-border: #2a2a2a;
}

body {
    font-family: 'Share Tech Mono', monospace;
    background-color: var(--dark-bg);
    color: var(--matrix-green);
}

.text-glow {
    text-shadow: 0 0 5px var(--matrix-green), 0 0 10px var(--matrix-green);
}

.card {
    background-color: rgba(10, 10, 10, 0.7);
    border: 1px solid var(--dark-border);
    backdrop-filter: blur(5px);
}

.form-input, .form-select {
    background-color: var(--dark-ui);
    border: 1px solid var(--dark-border);
    color: var(--matrix-green);
    appearance: none; /* Remove default styling */
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--matrix-green);
    box-shadow: 0 0 5px var(--matrix-green);
}

.form-select {
    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='%2300FF41' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 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;
}

.btn-calculate {
    background-color: var(--matrix-green);
    color: var(--dark-bg);
    font-weight: bold;
    transition: all 0.2s ease-in-out;
}

.btn-calculate:hover {
    background-color: var(--dark-bg);
    color: var(--matrix-green);
    border: 1px solid var(--matrix-green);
    box-shadow: 0 0 10px var(--matrix-green);
}

#wind-dial { 
    touch-action: none; 
    user-select: none; 
}

#dial-bg { 
    fill: var(--dark-ui); 
    stroke: var(--dark-border); 
    stroke-width: 2; 
}

#dial-handle { 
    fill: var(--matrix-green); 
    cursor: pointer; 
}

.dial-text { 
    fill: var(--matrix-green); 
    font-size: 14px; 
    font-family: 'Share Tech Mono', monospace; 
}

.result-card { 
    border: 1px solid var(--matrix-green); 
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.5); 
}

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

::-webkit-scrollbar-track {
    background: var(--dark-bg);
    border: 1px solid var(--dark-border);
}

::-webkit-scrollbar-thumb {
    background: var(--matrix-green);
    border-radius: 6px;
    border: 2px solid var(--dark-bg);
}

::-webkit-scrollbar-thumb:hover {
    background: #00CC33;
    box-shadow: 0 0 5px var(--matrix-green);
}

::-webkit-scrollbar-corner {
    background: var(--dark-bg);
}

/* Firefox Scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--matrix-green) var(--dark-bg);
}

/* Prevent unnecessary scrollbars */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Specific fix for index.html */
body.index-page {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    background-color: var(--dark-bg);
}

/* Mobile-specific centering fixes */
@media (max-width: 768px) {
    body.index-page {
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for mobile */
        padding: 0;
    }
    
    .index-page .flex.flex-col.justify-center.items-center.min-h-screen {
        min-height: 100vh;
        min-height: 100dvh; /* Use dynamic viewport height on mobile */
        justify-content: center;
        align-items: center;
        padding: 1rem;
    }
    
    .index-page .relative.z-10.flex.flex-col.justify-center.items-center.min-h-screen {
        min-height: auto;
        justify-content: center;
        align-items: center;
        flex: 1;
        width: 100%;
        /* Ensure equal spacing above and below the language buttons */
        padding: 2rem 0;
    }
    
    /* Ensure proper spacing on mobile */
    .index-page header {
        margin-bottom: 2rem;
    }
    
    .index-page .flex.flex-col.sm\\:flex-row.items-center.justify-center.gap-8.mb-12 {
        margin-bottom: 2rem;
        gap: 1rem;
    }
    
    .index-page footer {
        margin-top: 2rem;
    }
    
    /* Additional fix for perfect symmetry on mobile */
    .index-page .relative.z-10.flex.flex-col.justify-center.items-center.min-h-screen.w-full {
        display: flex;
        flex-direction: column;
        justify-content: space-evenly;
        align-items: center;
        height: 100%;
    }
}

/* Background image responsive styles */
.background-image {
    background-image: url('background.jpg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
}

/* Mobile optimization for background */
@media (max-width: 768px) {
    .background-image {
        background-attachment: scroll;
        background-size: cover;
    }
}

/* Perfect centering for all screen sizes */
.index-page .flex.flex-col.justify-center.items-center.min-h-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    position: relative;
}

.index-page .relative.z-10.flex.flex-col.justify-center.items-center.min-h-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex: 1;
    width: 100%;
    position: relative;
}

/* High resolution displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .background-image {
        background-size: cover;
    }
}

/* Enhanced collapsible sections with smooth animations */
.hidden {
    display: none !important;
}

/* Smooth slide animations for collapsible sections */
.collapsible-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: max-height 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                padding 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    padding-top: 0;
    padding-bottom: 0;
}

.collapsible-content.expanded {
    max-height: 3000px; /* Large enough for any content */
    opacity: 1;
    transform: translateY(0);
    padding-top: 1rem;
    padding-bottom: 0.5rem;
}

/* Ensure proper expansion behavior */
.card {
    position: relative;
    overflow: visible;
}

/* Improved toggle button animations */
.toggle-button {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.toggle-button.rotated {
    transform: rotate(45deg);
}

/* Smooth content reveal */
.content-reveal {
    animation: slideDown 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.content-hide {
    animation: slideUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-15px);
        max-height: 0;
    }
    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 3000px;
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translateY(0);
        max-height: 3000px;
    }
    to {
        opacity: 0;
        transform: translateY(-15px);
        max-height: 0;
    }
}

/* Enhanced Unit Toggle Styling */
.unit-toggle-container {
    position: relative;
    background-color: rgba(10, 10, 10, 0.7);
    border: 1px solid var(--dark-border);
    border-radius: 0.5rem;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    width: 140px;
    height: 32px;
}

.unit-toggle-slider {
    position: absolute;
    top: 0.25rem;
    left: 0.25rem;
    width: calc(50% - 0.25rem);
    height: calc(100% - 0.5rem);
    background-color: var(--matrix-green);
    border-radius: 0.375rem;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1;
    box-shadow: 0 0 8px rgba(0, 255, 65, 0.3);
}

.unit-toggle-slider:hover {
    box-shadow: 0 0 12px rgba(0, 255, 65, 0.5);
}

.unit-toggle-slider.imperial {
    transform: translateX(100%);
}

.unit-toggle-button {
    position: relative;
    z-index: 2;
    background: transparent;
    border: none;
    color: var(--matrix-green);
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: color 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50%;
    text-align: center;
    flex: 1;
    height: 100%;
}

.unit-toggle-button.active {
    color: var(--dark-bg);
    font-weight: 600;
}


.unit-toggle-container:hover .unit-toggle-slider {
    box-shadow: 0 0 12px rgba(0, 255, 65, 0.5);
    transform: scale(1.02);
}

.unit-toggle-container:hover .unit-toggle-slider.imperial {
    transform: translateX(100%) scale(1.02);
}

/* Ensure proper hover states for buttons */
.unit-toggle-button:not(.active):hover {
    color: var(--matrix-green);
    text-shadow: 0 0 5px var(--matrix-green);
}

.unit-toggle-button.active:hover {
    color: var(--dark-bg);
    text-shadow: none;
    background: transparent;
}

/* Pulse animation for active state */
@keyframes unitTogglePulse {
    0% { box-shadow: 0 0 8px rgba(0, 255, 65, 0.3); }
    50% { box-shadow: 0 0 16px rgba(0, 255, 65, 0.6); }
    100% { box-shadow: 0 0 8px rgba(0, 255, 65, 0.3); }
}

.unit-toggle-slider.pulse {
    animation: unitTogglePulse 0.6s ease-in-out;
}

/* Fix for conversions dropdown width */
.form-select {
    min-width: 120px !important; /* Increased by 15% from 104px */
}

/* Specific styling for conversions section dropdowns */
#conversions-content .form-select {
    min-width: 120px !important;
    width: 120px !important;
}

#mrad-reticle {
    background-color: rgba(10, 10, 10, 0.9);
    max-width: 100%;
    height: auto;
}

@media (max-width: 640px) {
    #mrad-reticle {
        width: 320px;
        height: 320px;
    }
    
    /* Adjust text box width for mobile */
    .mrad-text-box {
        width: 320px !important;
    }
}

/* Text outline for buttons */
.text-outline {
    text-shadow: 
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000;
}

/* Red glow effect for legal title */
.text-red-glow {
    text-shadow: 0 0 5px #dc2626, 0 0 10px #dc2626, 0 0 15px #dc2626;
}

/* Red glow effect for legal border */
.border-red-glow {
    box-shadow: 0 0 5px #dc2626, 0 0 10px #dc2626, 0 0 15px #dc2626;
}

/* Red glow effect for legal links */
.link-red-glow {
    text-shadow: 0 0 3px #dc2626, 0 0 6px #dc2626, 0 0 9px #dc2626;
}
