/* ========================================
   WARDROBE DESIGNER PRO - COMPLETE STYLES
   With Collapsible Panels & Quick Toolbar
   ======================================== */

/* Reset & base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #0a0f1c;
    color: #e2e8f0;
    line-height: 1.6;
}

.container {
    max-width: 100vw;
    margin: 0 auto;
    padding: 0;
}

/* Header */
header {
    background: #1e293b;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid #334155;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

header h1 {
    color: #f8fafc;
    font-size: 1.25rem;
}

.header-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.header-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    background: #0f172a;
    border: 1px solid #334155;
    font-size: 0.8rem;
    color: #cbd5e1;
}

/* ========== QUICK TOOLBAR ========== */
.quick-toolbar {
    display: flex;
    gap: 0.25rem;
    padding: 0.4rem 1rem;
    background: #0f172a;
    border-bottom: 1px solid #1e293b;
    overflow-x: auto;
    flex-wrap: nowrap;
}

.quick-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    padding: 0.35rem 0.6rem;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    min-width: 55px;
    color: #e2e8f0;
}

.quick-btn:hover {
    background: #334155;
    border-color: #475569;
    transform: translateY(-1px);
}

.quick-icon {
    font-size: 0.95rem;
}

.quick-label {
    font-size: 0.6rem;
    color: #94a3b8;
    white-space: nowrap;
}

/* Buttons */
button, .btn-primary, .btn-secondary, .btn-small {
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.15s ease;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: #475569;
    color: white;
}

.btn-secondary:hover {
    background: #64748b;
}

.btn-small {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
    background: #334155;
    color: #e2e8f0;
}

.btn-small:hover {
    background: #475569;
}

.btn-success {
    background: #22c55e;
    color: white;
}

.btn-success:hover {
    background: #16a34a;
}

button:active {
    transform: translateY(1px);
}

/* Layout */
.main-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    height: calc(100vh - 95px);
}

/* Panels */
.controls-panel {
    background: #1e293b;
    padding: 0.5rem;
    overflow-y: auto;
    border-right: 1px solid #334155;
}

.visualization-area {
    padding: 1rem;
    overflow-y: auto;
    background: #0f172a;
}

.panel {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.panel h3 {
    color: #f8fafc;
    font-size: 0.95rem;
    margin: 0;
}

/* ========== COLLAPSIBLE PANELS ========== */
.panel.collapsible .panel-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    background: #1e293b;
    border-bottom: 1px solid transparent;
    transition: background 0.15s;
}

.panel.collapsible .panel-header:hover {
    background: #253449;
}

.panel.collapsible .panel-header h3 {
    flex: 1;
}

.panel-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    background: #334155;
    color: #94a3b8;
}

.panel-badge.off {
    background: #374151;
    color: #6b7280;
}

.collapse-icon {
    font-size: 0.7rem;
    color: #64748b;
    transition: transform 0.2s;
}

.panel-body {
    padding: 0.75rem;
    border-top: 1px solid #334155;
}

.panel-body.hidden {
    display: none;
}

/* ========== MINI COLLAPSIBLE ========== */
.mini-collapse {
    margin-top: 0.75rem;
    border: 1px solid #334155;
    border-radius: 6px;
    overflow: hidden;
}

.mini-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.6rem;
    background: #0f172a;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    font-size: 0.8rem;
    text-align: left;
}

.mini-header:hover {
    background: #1e293b;
}

.mini-chevron {
    font-size: 0.6rem;
    color: #64748b;
}

.mini-body {
    padding: 0.6rem;
    background: #111827;
    border-top: 1px solid #334155;
}

.mini-body.hidden {
    display: none;
}

/* ========== TOGGLE SWITCH ========== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.toggle-switch.small {
    width: 34px;
    height: 18px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #334155;
    transition: 0.2s;
    border-radius: 22px;
}

.toggle-switch .slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: 0.2s;
    border-radius: 50%;
}

.toggle-switch.small .slider:before {
    height: 12px;
    width: 12px;
    left: 3px;
    bottom: 3px;
}

.toggle-switch input:checked + .slider {
    background: #3b82f6;
}

.toggle-switch input:checked + .slider:before {
    transform: translateX(18px);
}

.toggle-switch.small input:checked + .slider:before {
    transform: translateX(16px);
}

/* Feature toggle row */
.feature-toggle-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.3rem 0;
    flex-wrap: wrap;
}

.feature-toggle-row span {
    font-size: 0.85rem;
    color: #cbd5e1;
}

.inline-input {
    width: 80px;
    padding: 0.3rem 0.4rem;
    font-size: 0.8rem;
}

.inline-input.small {
    width: 60px;
}

.unit-label {
    font-size: 0.75rem;
    color: #64748b;
}

/* Unit buttons row */
.unit-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.panel.soft-panel {
    background: #0f172a;
    border-color: #1f2937;
}

.panel-header-simple {
    font-weight: 600;
    color: #f8fafc;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #334155;
    font-size: 0.9rem;
}

/* Grid helpers */
.grid1 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.grid3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.checkbox-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Form elements */
label {
    display: block;
    font-size: 0.8rem;
    color: #cbd5e1;
}

input, select {
    width: 100%;
    padding: 0.4rem 0.5rem;
    background: #334155;
    border: 1px solid #475569;
    border-radius: 4px;
    color: #f8fafc;
    font-size: 0.8rem;
}

input:focus, select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Chips */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #334155;
    padding: 0.4rem 0.6rem;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s;
}

.chip:hover {
    background: #475569;
}

.chip input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* Sub-options and separators */
.sub-options {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #0f172a;
    border-radius: 4px;
    border: 1px dashed #334155;
}

.sub-separator {
    border: none;
    border-top: 1px dashed #475569;
    margin: 0.75rem 0;
}

.sub-label {
    font-size: 0.8rem;
    color: #94a3b8;
    margin: 0.5rem 0 0.25rem 0;
}

/* Loft column config panels */
.loft-col-panel {
    background: #1e293b;
    padding: 8px;
    border-radius: 4px;
    margin-bottom: 6px;
    border: 1px solid #334155;
}

.loft-col-panel:hover {
    border-color: #475569;
}

.loft-col-panel .grid2 {
    margin-bottom: 0;
}

.loft-col-panel label {
    font-size: 11px;
}

.loft-col-panel input {
    font-size: 11px;
    padding: 0.3rem 0.4rem;
}

#loftColConfig {
    max-height: 300px;
    overflow-y: auto;
}

.hint-text {
    font-size: 0.7rem;
    color: #64748b;
    margin-top: 0.25rem;
    line-height: 1.3;
}

.formula-box {
    background: #0f172a;
    padding: 0.5rem;
    border-radius: 4px;
    border-left: 3px solid #3b82f6;
}

/* Hide helper */
.hide {
    display: none !important;
}

.hidden {
    display: none !important;
}

/* Tabs */
.tabs {
    display: flex;
    margin-bottom: 0.75rem;
    background: #1e293b;
    border-radius: 8px;
    padding: 0.25rem;
}

.tab {
    flex: 1;
    padding: 0.6rem 0.75rem;
    background: transparent;
    border: none;
    color: #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.tab.active {
    background: #3b82f6;
    color: white;
}

/* Preview toolbar */
.preview-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background: #1e293b;
    border-radius: 6px;
    align-items: center;
}

.preview-toolbar input[type="range"] {
    width: 80px;
    cursor: pointer;
    accent-color: #3b82f6;
}

#zoomValue {
    font-size: 0.7rem;
    color: #94a3b8;
    min-width: 35px;
}

/* Legend */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
    color: #cbd5e1;
}

.legend .sw {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    margin-right: 4px;
    border: 1px solid #1e293b;
}

.sw.carcass { background: #64748b; }
.sw.laminate { background: #6b7280; }
.sw.glass { background: #3b82f6; }
.sw.partition { background: #f97316; }
.sw.hanging { background: #22c55e; }
.sw.drawer { background: #f87171; }
.sw.shelf-marker { background: #facc15; }

/* SVG host — white background for export */
#svgHost {
    background: #ffffff;
    border: 1px solid #334155;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    min-height: 450px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

/* Isometric host — also white */
#isometricHost {
    background: #ffffff;
    border: 1px solid #334155;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

#isometricCanvas {
    border-radius: 8px;
}

/* Summary box */
.summary-box {
    background: #0f172a;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: #94a3b8;
}

/* Cutlist */
.cutlist-preview {
    max-height: 350px;
    overflow-y: auto;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 4px;
    margin-top: 0.5rem;
}

.cutlist-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.7rem;
}

.cutlist-table th,
.cutlist-table td {
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid #334155;
    text-align: left;
}

.cutlist-table th {
    background: #1e293b;
    color: #f8fafc;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.cutlist-table td {
    color: #cbd5e1;
}

.cutlist-table tr:hover {
    background: rgba(59, 130, 246, 0.08);
}

.category-header td {
    background: #334155 !important;
    font-weight: bold;
    color: #facc15 !important;
}

/* Toolbar */
.toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.toolbar button {
    font-size: 0.75rem;
    padding: 0.35rem 0.6rem;
}

/* Wardrobe unit cards */
.wardrobe-unit {
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    background: #0f172a;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.wardrobe-unit:hover {
    border-color: #475569;
}

.wardrobe-unit.active-unit {
    border-color: #22c55e;
    box-shadow: 0 0 0 2px #22c55e44;
}

.wardrobe-unit .unit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid #1e293b;
}

.wardrobe-unit .unit-header h4 {
    margin: 0;
    font-size: 0.9rem;
    color: #f8fafc;
}

.wardrobe-unit .active-badge {
    color: #22c55e;
    font-size: 0.7rem;
    font-weight: normal;
    margin-left: 0.5rem;
}

.wardrobe-unit .unit-section {
    margin-bottom: 0.6rem;
    padding: 0.4rem;
    background: #1e293b;
    border-radius: 4px;
}

.wardrobe-unit .section-title {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 0.4rem;
    font-weight: 500;
}

.wardrobe-unit .unit-summary {
    padding: 0.3rem 0.4rem;
    background: #1e293b;
    border-radius: 4px;
    text-align: center;
}

.wardrobe-unit .unit-summary small {
    color: #64748b;
    font-size: 0.7rem;
}

.wardrobe-unit .custom-widths-row {
    margin-top: 0.3rem;
}

.wardrobe-unit .custom-widths-row.hide {
    display: none;
}

.wardrobe-unit .unit-actions {
    display: flex;
    gap: 0.25rem;
}

.wardrobe-unit .unit-actions button {
    padding: 0.15rem 0.4rem;
    font-size: 0.75rem;
}

/* ========== COLUMN PANEL STYLES ========== */
.col-panel {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.col-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.6rem;
    background: #1e293b;
    cursor: pointer;
    border-bottom: 1px solid #334155;
}

.col-panel-header h4 {
    font-size: 0.85rem;
    font-weight: 500;
    color: #e2e8f0;
    margin: 0;
}

.col-dimensions {
    font-size: 0.7rem;
    color: #64748b;
    background: #0f172a;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.col-panel-body {
    padding: 0.6rem;
    display: none;
}

.col-panel-body.expanded {
    display: block;
}

.col-section {
    margin-bottom: 0.6rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px dashed #1e293b;
}

.col-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.col-section h5 {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 0.4rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-group {
    margin-bottom: 0.4rem;
}

.form-group label {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 0.15rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
}

.checkbox-label input {
    width: auto;
    margin: 0;
}

.checkbox-label span {
    font-size: 0.8rem;
    color: #cbd5e1;
}

.hint {
    display: block;
    font-size: 0.65rem;
    color: #64748b;
    margin-top: 0.15rem;
}

/* Hanging options highlight */
.hanging-options {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.25);
    border-radius: 4px;
}

.hanging-partition-options {
    margin-top: 0.4rem;
    padding: 0.4rem;
    background: #0f172a;
    border-radius: 4px;
}

/* Type selector pills */
.type-selector {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.type-btn {
    flex: 1;
    padding: 0.4rem;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 4px;
    color: #94a3b8;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.type-btn:hover {
    background: #253449;
}

.type-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

/* Dimension styles */
.dimension rect {
    fill: #ffffff;   /* white dim box */
    stroke: #d1d5db;
    stroke-width: 0.5;
}

.dimension text {
    fill: #000000;   /* black text */
    font-weight: 500;
}

.dimension line {
    stroke: #374151;
}

/* Make all SVG text black (wardrobe drawing) */
#svgHost svg text {
    fill: #000000;
}

/* Profile light visual — yellow lines */
.profile-light-line {
    stroke: #facc15;
    stroke-width: 3;
    stroke-linecap: round;
}

.profile-light-glow {
    stroke: #fef08a;
    stroke-width: 5;
    stroke-linecap: round;
    opacity: 0.5;
}

/* Shelf / drawer position markers: white circle + black text */
.shelf-marker {
    fill: #ffffff;
    stroke: #000000;
    stroke-width: 1;
}

.shelf-marker-text {
    fill: #000000;
    font-size: 8px;
    font-weight: 600;
}

.shelf-marker-line {
    stroke: #facc15;
    stroke-width: 1;
    stroke-dasharray: 3,2;
}

/* Drawer zone */
.drawer-zone {
    fill: rgba(248, 113, 113, 0.18);
    stroke: #f97373;
    stroke-width: 1;
}

/* Partition styles */
.partition-line {
    stroke: #f97316;
    stroke-width: 1.2;
}

/* Groove / Pattam lines — red */
.groove-line,
.pattam-line {
    stroke: #ef4444;
    stroke-width: 2;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #1e293b;
}

::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* ========== CONSOLIDATED CUTLIST STYLES ========== */
.cutlist-table.consolidated {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.8rem;
}

.cutlist-table.consolidated th {
    background: #1e293b;
    padding: 0.5rem 0.4rem;
    text-align: left;
    font-weight: 500;
    border-bottom: 2px solid #3b82f6;
    white-space: nowrap;
}

.cutlist-table.consolidated td {
    padding: 0.4rem;
    border-bottom: 1px solid #1e293b;
}

.cutlist-table.consolidated tr:hover {
    background: #1e293b;
}

.cutlist-table.consolidated .category-header {
    background: #0f172a;
}

.cutlist-table.consolidated .category-header td {
    padding: 0.6rem;
    border-bottom: 1px solid #334155;
}

.cutlist-table.consolidated .cat-count {
    font-size: 0.7rem;
    color: #64748b;
    font-weight: normal;
    margin-left: 0.5rem;
}

.cutlist-table.consolidated .piece-no {
    font-size: 0.8rem;
    font-weight: 600;
    width: 30px;
    text-align: center;
}

.cutlist-table.consolidated .desc-cell {
    max-width: 150px;
}

.cutlist-table.consolidated .dim-cell {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.75rem;
    color: #e2e8f0;
    text-align: right;
    padding-right: 8px;
    min-width: 55px;
}

.cutlist-table.consolidated .qty-cell {
    text-align: center;
    color: #22c55e;
    font-weight: 600;
}

.cutlist-table.consolidated .labels-cell {
    font-size: 0.75rem;
    color: #f97316;
    font-family: 'Monaco', 'Consolas', monospace;
}

/* Vertical pieces (even numbers) - purple */
.cutlist-table.consolidated tr.vertical-piece .piece-no {
    color: #a78bfa;
}

/* Horizontal pieces (odd numbers) - blue */
.cutlist-table.consolidated tr.horizontal-piece .piece-no {
    color: #60a5fa;
}

.consolidation-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.8rem;
    margin-top: 0.5rem;
    background: #1e293b;
    border-radius: 6px;
    font-size: 0.8rem;
}

.consolidation-summary .saved-info {
    color: #22c55e;
    font-size: 0.75rem;
}

.glass-profile-summary {
    padding: 0.6rem 0.8rem;
    margin-top: 0.5rem;
    background: #1e3a5f;
    border-radius: 6px;
    font-size: 0.8rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.glass-profile-summary .total {
    color: #22c55e;
    font-weight: 600;
}

.sheet-info {
    padding: 0.4rem 0.8rem;
    margin-top: 0.5rem;
    background: #1e293b;
    border-radius: 4px;
    color: #94a3b8;
}
    margin-top: 0.5rem;
    background: linear-gradient(135deg, #1e3a5f 0%, #1e293b 100%);
    border-radius: 6px;
    border-left: 3px solid #3b82f6;
    font-size: 0.8rem;
    line-height: 1.6;
}

.glass-profile-summary strong {
    color: #60a5fa;
}

/* Responsive */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .controls-panel {
        height: auto;
        max-height: 50vh;
    }
}

@media (max-width: 640px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .grid2 {
        grid-template-columns: 1fr;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .preview-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .quick-toolbar {
        padding: 0.3rem 0.5rem;
    }

    .quick-btn {
        min-width: 48px;
        padding: 0.25rem 0.4rem;
    }
}