/* 
 * GVB Configurator Styles
 * Updated with comprehensive dark mode support and responsive design
 */

/* Responsive design for mobile devices */
@media (max-width: 640px) {
    /* Hide wallpaper on mobile and use white background in light mode */
    .bg-custom-wallpaper {
        background-image: none !important; /* Hide the wallpaper image */
        background-color: #ffffff; /* White background for light mode */
    }
    
    /* Keep dark background for dark mode */
    html.dark .bg-custom-wallpaper {
        background-color: #1a1a1a; /* Dark background for dark mode */
    }
    
    /* More compact header on mobile */
    .bg-white.shadow-sm.mb-6,
    .dark .bg-white.shadow-sm.mb-6 {
        margin-bottom: 0.75rem;
    }
    
    .bg-white.shadow-sm .px-4.py-3,
    .dark .bg-white.shadow-sm .px-4.py-3 {
        padding: 0.5rem 0.75rem;
    }
    
    /* Smaller logo on mobile */
    .bg-white.shadow-sm img.h-10,
    .dark .bg-white.shadow-sm img.h-10 {
        height: 2rem;
    }
    
    /* Smaller account text on mobile */
    .bg-white.shadow-sm button span.mr-1,
    .dark .bg-white.shadow-sm button span.mr-1 {
        font-size: 0.75rem;
    }
    
    /* Compact mobile menu */
    #mobileMenu .px-2.py-3.space-y-1 {
        padding: 0.5rem;
    }
    
    #mobileMenu a {
        padding: 0.5rem 0.75rem;
        margin-bottom: 0.25rem;
    }
    
    /* Make 2D/3D view wider on mobile and reduce whitespace */
    .order-2.col-span-1 {
        width: 100%;
        max-width: 100%;
    }
    
    /* Reduce padding in 2D/3D container to match product image box */
    .view-container {
        padding: 0.25rem !important;
        min-height: 150px !important;
    }
    
    /* Ensure correct order of elements on mobile */
    #dimensionSliders {
        order: 4 !important;
        margin-top: 0.5rem !important;
        margin-bottom: 1rem !important;
    }
    
    .order-5 {
        order: 5 !important;
    }
    
    /* Make slider containers maintain horizontal layout on mobile */
    #lengthSliderContainer .flex-row,
    #widthSliderContainer .flex-row,
    #heightSliderContainer .flex-row {
        display: flex;
        flex-direction: row !important;
        align-items: center;
    }
    
    /* Ensure slider takes most of the space */
    #lengthSliderWrapper,
    #widthSliderWrapper,
    #heightSliderWrapper {
        flex-grow: 1;
        width: 70%;
    }
    
    /* Keep input field to the right */
    #lengthInputWrapper,
    #widthInputWrapper,
    #heightInputWrapper {
        width: auto;
        display: block;
        text-align: right;
        padding: 0.5rem 0;
        position: relative;
        border-bottom: 1px solid #f3f4f6;
    }
    
    .dark table.min-w-full tbody tr td {
        border-bottom-color: #4a5568;
    }
    
    table.min-w-full tbody tr td:last-child {
        border-bottom: none;
    }
    
    table.min-w-full tbody tr td:before {
        content: attr(data-label);
        float: left;
        font-weight: 500;
        color: #6b7280;
    }
    
    .dark table.min-w-full tbody tr td:before {
        color: #9ca3af;
    }
    
    /* Improve touch targets for mobile */
    button, 
    a.bg-blue-600,
    a.text-blue-600,
    a.text-green-600 {
        padding: 0.625rem 1rem;
        min-height: 44px; /* Minimum touch target size */
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Improve spacing on mobile */
    .space-y-4 {
        margin-bottom: 1.5rem;
    }
    
    /* Better form controls on mobile */
    select, input[type="text"] {
        font-size: 16px; /* Prevent zoom on iOS */
        height: 44px; /* Better touch target */
    }
}

/* Medium screen adjustments */
@media (min-width: 641px) and (max-width: 1024px) {
    /* Tablet-specific styles */
    .grid-cols-7 {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
html.dark,
html.dark body {
    background-color: #1a1a1a;
    color: #ffffff;
}
.dark .bg-white {
    background-color: #2d2d2d;
    color: #ffffff;
}
.dark .bg-gray-100 {
    background-color: #1a1a1a;
    color: #ffffff;
}
.dark .text-gray-500 {
    color: #a0aec0;
}
.dark .text-gray-600 {
    color: #cbd5e0;
}
.dark .text-gray-700 {
    color: #e2e8f0;
}
.dark .text-gray-800 {
    color: #ffffff;
}
.dark .text-gray-900 {
    color: #ffffff;
}
.dark .border-gray-200 {
    border-color: #404040;
}
.dark .border-gray-300 {
    border-color: #4a5568;
}
.dark .bg-gray-50 {
    background-color: #2d2d2d;
    color: #ffffff;
}
.dark .bg-gray-50 input {
    background-color: #1a1a1a;
    color: #ffffff;
    border-color: #4a5568;
}
.dark select {
    background-color: #2d2d2d;
    color: #ffffff;
    border-color: #4a5568;
}
.dark select option {
    background-color: #2d2d2d;
    color: #ffffff;
}
.dark .bg-gray-50 label {
    color: #e2e8f0;
}
.dark table {
    color: #e2e8f0;
}
.dark .bg-gray-50 {
    background-color: #2d2d2d;
}
.dark tbody.bg-white {
    background-color: #2d2d2d;
}
.dark tr.hover\:bg-gray-50:hover {
    background-color: #3a3a3a;
}
.dark thead.bg-gray-50 {
    background-color: #3a3a3a;
}
input[type="range"] {
    -webkit-appearance: none;
    height: 8px;
    background: #ddd;
    border-radius: 4px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #2563eb;
    border-radius: 50%;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #2563eb;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.dark input[type="range"] {
    background: #4a5568;
}

.dark input[type="number"] {
    background: #2d2d2d;
    color: white;
    border-color: #4a5568;
}

/* Add to existing styles section */
#notification {
    z-index: 1000;
    opacity: 1;
}

.dark #notification {
    background-color: #2d2d2d;
    color: white;
}

.bg-custom-wallpaper {
    background-size: 120%; /* Changed from 'cover' to zoom in and hide transparent edges */
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    position: relative;
    min-height: 100vh;
}
.bg-custom-wallpaper::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: inherit;
    z-index: -1;
}

/* Tooltip styles */
.tooltip-container {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.tooltip-container .tooltip-text {
    visibility: hidden;
    width: 300px;
    background-color: #333;
    color: #fff;
    text-align: left;
    border-radius: 6px;
    padding: 8px 12px;
    position: absolute;
    z-index: 9999;
    top: -10px;
    left: 50%;
    transform: translate(-50%, -100%);
    opacity: 0;
    transition: opacity 0.3s;
    word-wrap: break-word;
    font-size: 0.875rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    white-space: normal;
    pointer-events: none;
}

.tooltip-container .tooltip-text::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Dark mode support for tooltips */
.dark .tooltip-container .tooltip-text {
    background-color: #4a5568;
    color: #ffffff;
}

.dark .tooltip-container .tooltip-text::after {
    border-color: #4a5568 transparent transparent transparent;
}

/* Formula tooltip specific styles */
.formula-tooltip .tooltip-text {
    font-family: monospace;
}

/* Dark mode for skeleton loading elements */
.dark .skeleton-loading {
    background-color: #3a3a3a;
    animation: darkPulse 1.5s ease-in-out infinite;
}

.dark .skeleton-sales-price {
    background-color: rgba(52, 211, 153, 0.2);
}

.dark .skeleton-purchase-price {
    background-color: rgba(96, 165, 250, 0.2);
}

@keyframes darkPulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* Dark mode for SVG elements */
.dark svg {
    color: #e2e8f0;
}

.dark svg line {
    stroke: #6b7280;
}

.dark svg rect {
    fill: #4b5563;
}

.dark svg text {
    fill: #e2e8f0;
}

/* Dark mode for loading progress bar */
.dark #loading-2d-view {
    background-color: #2d2d2d;
}

.dark #loading-2d-view p {
    color: #e2e8f0;
}

.dark #loading-progress-bar {
    background-color: #4a5568;
}

/* Fix for no image placeholder in dark mode */
.dark #noImagePlaceholder {
    background-color: #2d2d2d;
}

.dark #noImagePlaceholder svg {
    color: #6b7280;
}

.dark #noImagePlaceholder p {
    color: #9ca3af;
}

/* Dark mode for action buttons hover states */
.dark .hover\:bg-blue-700:hover {
    background-color: #1e40af;
}

.dark .hover\:bg-green-700:hover {
    background-color: #047857;
}

.dark .hover\:bg-red-700:hover {
    background-color: #b91c1c;
}

.dark .hover\:text-blue-900:hover {
    color: #93c5fd;
}

.dark .hover\:text-green-900:hover {
    color: #6ee7b7;
}

.dark .hover\:text-red-900:hover {
    color: #fca5a5;
}

/* Dark mode for product image container */
.dark .border {
    border-color: #4a5568;
}

/* Fix for focus states in dark mode */
.dark .focus\:ring-blue-500:focus {
    --tw-ring-color: #3b82f6;
}

.dark .focus\:border-blue-500:focus {
    border-color: #3b82f6;
}

/* Dark mode for colored text */
.dark .text-green-600 {
    color: #34d399;
}

.dark .text-blue-600 {
    color: #60a5fa;
}

.dark .text-red-600 {
    color: #f87171;
}

/* Dark mode for shadows */
.dark .shadow {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px 0 rgba(0, 0, 0, 0.24);
}

.dark .shadow-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

/* Dark mode for rounded corners with borders */
.dark .rounded-lg {
    border-color: #4a5568;
}

.dark .rounded-md {
    border-color: #4a5568;
}

/* Fix for filter input in projects table */
.dark input[type="text"] {
    background-color: #2d2d2d;
    color: white;
    border-color: #4a5568;
}

/* Dark mode for dividers */
.dark .divide-y > * + * {
    border-top-color: #4a5568;
}

.dark .divide-x > * + * {
    border-left-color: #4a5568;
}

.dark .divide-gray-200 > * + * {
    border-color: #4a5568;
}

/* Dark mode for font weights */
.dark .font-medium {
    color: #f3f4f6;
}

.dark .font-bold {
    color: #ffffff;
}

/* Fix for tab buttons in dark mode */
.dark button {
    color: #e2e8f0;
    border-color: #4a5568;
}

.dark button:hover {
    background-color: #374151;
}

.dark button:focus {
    outline-color: #3b82f6;
}

/* Fix for overflow containers in dark mode */
.dark .overflow-hidden {
    background-color: #2d2d2d;
}

.dark .overflow-x-auto {
    background-color: #2d2d2d;
}

/* Fix for whitespace and text formatting in dark mode */
.dark .whitespace-nowrap {
    color: inherit;
}

.dark .tracking-wider {
    letter-spacing: 0.05em;
}

.dark .uppercase {
    text-transform: uppercase;
}

/* Fix for specific dashboard elements */
.dark #productSelect {
    background-color: #2d2d2d;
    color: #ffffff;
    border-color: #4a5568;
}

.dark #productSelectSkeleton {
    background-color: #3a3a3a;
}

/* Fix for specific table elements */
.dark th {
    color: #a0aec0;
}

.dark td {
    color: #e2e8f0;
}

/* Fix for specific text colors in dark mode */
.dark .text-sm {
    color: inherit;
}

.dark .text-xs {
    color: inherit;
}

.dark .text-lg {
    color: inherit;
}

.dark .text-2xl {
    color: inherit;
}

/* Fix for navigation header in dark mode */
.dark .bg-white.shadow-sm {
    background-color: #2d2d2d;
}

/* Fix for navigation item active state in dark mode */
.dark .bg-blue-50.text-blue-700 {
    background-color: #1e40af !important; /* darker blue background */
    color: #93c5fd !important; /* lighter blue text */
}

/* Fix for navigation item hover state in dark mode */
.dark .hover\:text-gray-900:hover {
    color: #ffffff !important;
}

.dark .hover\:bg-gray-100:hover {
    background-color: #374151 !important; /* dark gray background */
}

/* Fix for language picker and user menu dropdowns in dark mode */
.dark #languageMenu, 
.dark #userMenu {
    background-color: #2d2d2d;
    border-color: #4a5568;
}

.dark #languageMenu button, 
.dark #userMenu a {
    color: #e2e8f0;
}

.dark #languageMenu button:hover, 
.dark #userMenu a:hover {
    background-color: #374151;
    color: #ffffff;
}

/* Fix for selected language in dropdown */
.dark #languageMenu .bg-blue-50.text-blue-700 {
    background-color: #1e40af !important;
    color: #93c5fd !important;
}

/* Fix for divider in user menu */
.dark #userMenu .border-t.border-gray-100 {
    border-color: #4a5568;
}

/* Dark mode for blue backgrounds in formula examples */
.dark .bg-blue-50 {
    background-color: #172554; /* More subtle dark blue background */
    background-color: rgba(30, 58, 138, 0.15); /* More subtle dark blue with transparency */
    color: #e2e8f0;
}

.dark .text-blue-800 {
    color: #93c5fd; /* Light blue text for better contrast */
}

.dark .bg-blue-100 {
    background-color: rgba(30, 64, 175, 0.25); /* Slightly lighter blue for code examples with transparency */
    color: #e2e8f0;
}
