@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

body {
    font-family: 'Inter', sans-serif;
}

/* Dynamic Viewport Utilities */
.min-h-dvh {
    min-height: 100vh;
    min-height: 100dvh;
}

.h-dvh {
    height: 100vh;
    height: 100dvh;
}

.max-h-dvh {
    max-height: 100vh;
    max-height: 100dvh;
}

/* Hide number input arrows/spinners */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
}

/* Placeholder for empty contenteditable fields */
.multi-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    /* right: 0; Removed to allow width expansion */
    z-index: 1000;
    /* Increased to stay above everything */
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    margin-top: 0.25rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    display: none;

    /* Optimal Width Logic: Auto-expand but respect screen */
    min-width: 100%;
    width: max-content;
    max-width: 90vw;
    /* Prevent overflow on small screens */
}

.multi-select-dropdown.show {
    display: block;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.15s;
    white-space: nowrap;
    /* Prevent text wrapping */
}

.dropdown-item:hover {
    background-color: #f3f4f6;
}

.summary-accordion-header {
    cursor: pointer;
    transition: background-color 0.15s;
}

.summary-accordion-header:hover {
    background-color: #f9fafb;
}

.summary-accordion-content {
    display: none;
    transition: all 0.3s ease-in-out;
}

.summary-accordion-content.show {
    display: block;
}

.placeholder-active:empty:not(:focus)::before {
    content: attr(data-placeholder);
    color: #b91c1c;
    font-style: italic;
    opacity: 0.7;
    pointer-events: none;
    display: block;
    /* Ensure it takes up space */
}

/* Row highlight when working on it */
tbody tr:focus-within {
    outline: 2px solid #2563eb;
    /* blue-600 */
    outline-offset: -2px;
    background-color: #eff6ff !important;
    /* blue-50, force over hover */
}

/* Custom Horizontal Scrollbar for Table */
.scrollbar-friendly {
    overflow-x: auto;
    scrollbar-width: auto;
    /* Firefox */
}

.scrollbar-friendly::-webkit-scrollbar {
    height: 14px;
    /* Prominent height */
}

.scrollbar-friendly::-webkit-scrollbar-track {
    background: #f3f4f6;
    /* Gray-100 */
    border-radius: 8px;
    margin: 0 4px;
}

.scrollbar-friendly::-webkit-scrollbar-thumb {
    background-color: #9ca3af;
    /* Gray-400 */
    border-radius: 8px;
    border: 3px solid #f3f4f6;
    /* Padding around thumb */
}

.scrollbar-friendly::-webkit-scrollbar-thumb:hover {
    background-color: #6b7280;
    /* Gray-500 */
}

.color-swatch-btn {
    /* width: 2rem; REMOVED fixed width */
    padding: 0.5rem 1rem;
    min-width: 80px;
    font-size: 0.75rem;
    /* text-xs */
    font-weight: 700;
    text-transform: uppercase;

    height: auto;
    border-radius: 9999px;
    border: 1px solid #e5e7eb;
    /* Thinner border */
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;

    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.color-swatch-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.color-swatch-btn.selected {
    border-color: #2563eb;
    /* Fallback */
    box-shadow: 0 0 0 2px #2563eb;
    transform: scale(1.05);
}

/* Animation for newly added row highlight */
@keyframes rowHighlightPulse {
    0% {
        background-color: #fef3c7 !important;
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.7);
    }

    25% {
        background-color: #fde68a !important;
        transform: scale(1.01);
        box-shadow: 0 0 0 8px rgba(251, 191, 36, 0);
    }

    50% {
        background-color: #fef3c7 !important;
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.4);
    }

    75% {
        background-color: #fde68a !important;
        transform: scale(1.005);
        box-shadow: 0 0 0 4px rgba(251, 191, 36, 0);
    }

    100% {
        background-color: inherit !important;
        transform: scale(1);
        box-shadow: none;
    }
}

.row-highlight-animation {
    animation: rowHighlightPulse 2.5s ease-out;
    position: relative;
    z-index: 10;
}

/* Tour Styles */
.tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    /* Changed from rgba(0,0,0,0.5) to rely on highlight shadow */
    z-index: 9998;
    pointer-events: none;
    /* Let clicks pass specific elements if needed, but usually we block */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tour-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.tour-highlight {
    position: absolute;
    z-index: 9999 !important;
    /* Box shadow hack for overlay effect around the element */
    box-shadow: 0 0 0 2px #3b82f6, 0 0 0 9000px rgba(0, 0, 0, 0.6);
    background-color: transparent;
    border-radius: 8px;
    transition: all 0.3s ease;
    pointer-events: none;
}

/* Scroll Lock */
body.tour-active {
    overflow: hidden !important;
}

.tour-tooltip {
    position: absolute;
    background: white;
    border-radius: 12px;
    padding: 16px;
    width: 280px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease, top 0.3s ease, left 0.3s ease;
    pointer-events: auto;
    /* Ensure clickable */
    border-left: 5px solid #3b82f6;
}

.tour-tooltip.visible {
    opacity: 1;
}

/* Tooltip Arrow (Beak) */
.tour-tooltip::after {
    content: '';
    position: absolute;
    border-width: 8px;
    border-style: solid;
    /* Dynamic positioning var */
    left: var(--arrow-left, 50%);
    transform: translateX(-50%);
}

/* Top Tooltip -> Arrow at Bottom */
.tour-tooltip.top::after {
    top: 100%;
    border-color: white transparent transparent transparent;
}

/* Bottom Tooltip -> Arrow at Top */
.tour-tooltip.bottom::after {
    bottom: 100%;
    /* Top of tooltip */
    border-color: transparent transparent white transparent;
}

.tour-content h3 {
    color: #1e3a8a;
    font-weight: 800;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.tour-content p {
    color: #4b5563;
    font-size: 0.9rem;
    line-height: 1.4;
}

.tour-controls {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
    gap: 8px;
}

.tour-btn {
    font-size: 0.8rem;
    font-weight: bold;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
}

.tour-btn-next {
    background-color: #3b82f6;
    color: white;
}

.tour-btn-close {
    color: #9ca3af;
}

.tour-btn-close:hover {
    color: #ef4444;
}

/* Custom Toggle Styles from Help Switch */
.toggle-checkbox:checked {
    right: 0;
    border-color: #3b82f6;
    /* blue-500 */
    transform: translateX(100%);
}

#helpToggle:checked+.toggle-label {
    background-color: #3b82f6;
}

#helpToggle:checked {
    transform: translateX(20px);
    /* Move knob */
    border-color: white;
}


/* --- Global Refinements --- */

/* Make unavailable size cells transparent (Clean Look) */
td.bg-gray-100\/50 {
    background-color: transparent !important;
    /* Optional: hide border too if you want total void, but row lines help tracking. 
       Let's keep row lines (td border) but remove the boxy background. */
}

/* Hide the disabled input box visual */
input.bg-gray-100\/50 {
    background-color: transparent !important;
    border-color: transparent !important;
    opacity: 0.1;
    /* Faint hint or invisible */
}

/* [UX] Remove Text Highlighting (Force Transparent) */
mark,
.mark,
span[style*="background-color"] {
    background-color: transparent !important;
    color: inherit !important;
    text-decoration: none !important;
    padding: 0 !important;
}

/* Size Window Mode Styles */
.size-window-cell {
    cursor: pointer !important;
    position: relative;
    /* Optional: Tint when active mode */
}

.size-window-cell:hover::after {
    content: '';
    position: absolute;
    inset: 0;
    background-color: rgba(147, 51, 234, 0.1);
    /* Purple tint */
    pointer-events: none;
}

/* =====================================================
   PREMIUM WIZARD MODAL STYLES
   ===================================================== */

/* Glassmorphism Background */
.wizard-modal-backdrop {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Main Modal Container */
.wizard-modal-container {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.98) 100%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    border-radius: 1.5rem;
    overflow: hidden;
}

/* Wizard Progress Steps */
.wizard-progress {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    padding: 1.5rem 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
}

.wizard-step-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    flex: 1;
    max-width: 120px;
}

.wizard-step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.wizard-step-indicator.active .wizard-step-number {
    background: white;
    color: #764ba2;
    border-color: white;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.wizard-step-indicator.completed .wizard-step-number {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.wizard-step-indicator.completed .wizard-step-number::after {
    content: '✓';
    position: absolute;
    font-size: 1.2rem;
}

.wizard-step-indicator.completed .wizard-step-number span {
    display: none;
}

.wizard-step-label {
    margin-top: 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.3s ease;
}

.wizard-step-indicator.active .wizard-step-label {
    color: white;
}

/* Progress Line Between Steps */
.wizard-progress-line {
    flex: 1;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 -10px;
    position: relative;
    top: -12px;
    z-index: 1;
    max-width: 80px;
}

.wizard-progress-line-fill {
    height: 100%;
    background: #10b981;
    width: 0%;
    transition: width 0.5s ease;
}

.wizard-progress-line.filled .wizard-progress-line-fill {
    width: 100%;
}

/* Content Area */
.wizard-content-area {
    padding: 1.5rem;
    min-height: 320px;
    position: relative;
    overflow: hidden;
}

.wizard-step-content {
    animation: wizardSlideIn 0.4s ease-out;
}

@keyframes wizardSlideIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes wizardSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(-30px);
    }
}

/* Summary Panel */
.wizard-summary-panel {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-top: 1px solid #e2e8f0;
    padding: 1rem 1.5rem;
}

.wizard-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

@media (min-width: 640px) {
    .wizard-summary-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.wizard-summary-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.wizard-summary-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.wizard-summary-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wizard-summary-value.empty {
    color: #94a3b8;
    font-style: italic;
}

.wizard-summary-item.highlight {
    background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    margin: -0.25rem;
}

.wizard-summary-item.highlight .wizard-summary-value {
    color: #4f46e5;
    font-size: 1rem;
}

/* Navigation Footer */
.wizard-nav-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: white;
    border-top: 1px solid #e2e8f0;
}

.wizard-nav-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
}

.wizard-nav-btn.prev {
    background: #f1f5f9;
    color: #475569;
}

.wizard-nav-btn.prev:hover {
    background: #e2e8f0;
}

.wizard-nav-btn.prev:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.wizard-nav-btn.next {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.4);
}

.wizard-nav-btn.next:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.wizard-nav-btn.confirm {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
    padding: 0.875rem 2rem;
}

.wizard-nav-btn.confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

/* Premium Input Styles */
.wizard-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    background: white;
}

.wizard-input:focus {
    outline: none;
    border-color: #818cf8;
    box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.1);
}

.wizard-input.valid {
    border-color: #10b981;
}

.wizard-input.invalid {
    border-color: #ef4444;
}

.wizard-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.25rem;
    padding-right: 3rem;
}

/* Premium Checkbox */
.wizard-checkbox-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.wizard-checkbox-wrapper:hover {
    background: #f8fafc;
}

.wizard-checkbox-wrapper.checked {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-color: #86efac;
}

.wizard-checkbox {
    position: relative;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.wizard-checkbox input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.wizard-checkbox-box {
    width: 100%;
    height: 100%;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
}

.wizard-checkbox input:checked+.wizard-checkbox-box {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-color: #10b981;
    animation: checkboxPop 0.3s ease;
}

@keyframes checkboxPop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.wizard-checkbox-box svg {
    width: 14px;
    height: 14px;
    stroke: white;
    stroke-width: 3;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s ease;
}

.wizard-checkbox input:checked+.wizard-checkbox-box svg {
    opacity: 1;
    transform: scale(1);
}

/* Section Headers */
.wizard-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.wizard-section-title::before {
    content: '';
    width: 3px;
    height: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

/* Field Group */
.wizard-field-group {
    margin-bottom: 1.25rem;
}

.wizard-field-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

/* Mobile Adjustments */
@media (max-width: 640px) {
    .wizard-progress {
        padding: 1rem 0.5rem;
    }

    .wizard-step-number {
        width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }

    .wizard-step-label {
        font-size: 0.6rem;
    }

    .wizard-content-area {
        padding: 1rem;
        min-height: 280px;
    }

    .wizard-nav-footer {
        padding: 0.75rem 1rem;
    }

    .wizard-nav-btn {
        padding: 0.625rem 1rem;
        font-size: 0.8rem;
    }
}

/* Mobile Bottom Sheet Animation */
@keyframes slideUpMobile {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.animate-slide-up-mobile {
    animation: slideUpMobile 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Helper for Carousel */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}