/* ========================================
   WARDROBE DESIGNER PRO - COMPLETE STYLES
   ======================================== */

/* 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;
}

/* 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;
}

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

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

/* Panels */
.controls-panel {
    background: #1e293b;
    padding: 0.75rem;
    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;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

.panel h3 {
    color: #f8fafc;
    margin-bottom: 0.75rem;
    font-size: 1rem;
    border-bottom: 1px solid #334155;
    padding-bottom: 0.5rem;
}

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

.panel-header {
    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: grid;
    grid-template-columns: repeat(2, 1fr);
    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;
}

.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;
}

/* 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;
}

/* 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;
}

/* 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;
    }
}
