:root { 
    --symetrix-red: #E31E24; 
    --teal: #00BFA5; 
    --dark-bg: #111111; 
    --sidebar-bg: #000; 
    --sidebar-w: 340px; 
    --header-h: 70px; 
}

body { 
    font-family: 'Inter', sans-serif; 
    margin: 0; 
    background: #fff; 
    color: #1c1e21; 
    height: 100vh; 
    overflow: hidden; 
}

/* Header & Navigation */
header { 
    height: var(--header-h); 
    background: #000; 
    border-bottom: 1px solid #222;
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 0 30px;
    position: relative; 
    z-index: 100;
}

.header-actions { display: flex; align-items: center; gap: 20px; }
.toggle-group { display: flex; align-items: center; gap: 10px; color: #888; font-size: 0.75rem; font-weight: 700; }

/* Toggle Switch */
.switch { position: relative; display: inline-block; width: 44px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #333; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--teal); }
input:checked + .slider:before { transform: translateX(22px); }

/* Main Layout */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: calc(100vh - var(--header-h)); }

.sidebar { background: var(--sidebar-bg); border-right: 1px solid #333; display: flex; flex-direction: column; height: 100%; }
.sidebar-content { 
    padding: 20px; 
    overflow-y: auto; 
    flex: 1; 
    scrollbar-width: thin; 
    scrollbar-color: #444 #111; 
}
.sidebar-content::-webkit-scrollbar { width: 6px; }
.sidebar-content::-webkit-scrollbar-thumb { background: #444; border-radius: 10px; }

.panel { background: #1c1c1c; border-radius: 12px; padding: 18px; margin-bottom: 20px; border: 1px solid #333; }
h2 { font-size: 0.7rem; text-transform: uppercase; color: #888; margin: 0 0 15px 0; letter-spacing: 1px; }

/* Product Cards */
.p-card { 
    background: #252525; border: 1px solid #333; padding: 15px; margin-bottom: 12px; 
    border-radius: 10px; cursor: pointer; transition: all 0.2s ease; 
    display: flex; align-items: center; gap: 15px; color: #fff; 
}
.p-card:hover { border-color: var(--teal); background: #2a2a2a; }
.p-card.selected { border: 2px solid var(--teal); background: #1a2e2a; }
.brand-icon { width: 40px; height: 40px; border-radius: 6px; object-fit: contain; background: #fff; padding: 4px; }
.p-info { flex: 1; }
.p-info strong { font-size: 0.9rem; display: block; color: #eee; }
.p-info span { font-size: 0.75rem; color: #888; }

.canvas { flex: 1; background: #fff; overflow: auto; display: flex; justify-content: center; padding: 60px; }
#wiring-diagram { width: 100%; max-width: 1100px; }

.admin-btn { 
    background: var(--teal); color: #000; border: none; padding: 10px 20px; 
    border-radius: 6px; cursor: pointer; font-weight: 700; text-decoration: none; 
    font-size: 0.85rem; display: flex; align-items: center; gap: 8px; 
}

#wiring-diagram { 
    width: 100%; 
    height: 100%; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
}

#wiring-diagram svg {
    max-width: 100%;
    height: auto;
    filter: drop-shadow(0 10px 30px rgba(0,0,0,0.1));
}

/* Animation Keyframes */
@keyframes flow {
    from { stroke-dashoffset: 24; }
    to { stroke-dashoffset: 0; }
}

/* Animation Classes applied to #wiring-diagram */
.anim-fast .edgePath path {
    stroke-dasharray: 8, 4;
    animation: flow 0.6s linear infinite;
}

.anim-slow .edgePath path {
    stroke-dasharray: 8, 4;
    animation: flow 1.5s linear infinite;
}

.anim-none .edgePath path {
    stroke-dasharray: none;
    animation: none;
}

/* Style for the new Dropdown and Layout Toggle */
select#anim-speed {
    background: #222;
    color: #eee;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 0.7rem;
    cursor: pointer;
    outline: none;
}

select#anim-speed:hover { border-color: var(--teal); }

.control-label {
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

/* --- Signal Flow Animations --- */
@keyframes signalFlow {
    from { stroke-dashoffset: 20; }
    to { stroke-dashoffset: 0; }
}

/* Base style for all diagram lines */
#wiring-diagram .edgePath path {
    transition: stroke-dasharray 0.3s ease;
}

/* Fast Flow Class */
.anim-fast .edgePath path {
    stroke-dasharray: 4, 2;
    animation: signalFlow 0.4s linear infinite;
}

/* Slow Flow Class */
.anim-slow .edgePath path {
    stroke-dasharray: 10, 5;
    animation: signalFlow 2s linear infinite;
}

/* Off State */
.anim-none .edgePath path {
    stroke-dasharray: none;
    animation: none;
}

/* Header UI Styling Fixes */
.toggle-group {
    background: #111;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid #222;
}

.control-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    font-weight: 800;
}

select#anim-speed {
    background: transparent;
    color: var(--teal);
    border: none;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    outline: none;
}

/* Styling the Environment Dropdown */
select#room-size {
    width: 100%;
    background: #111;              /* Dark background like the Flow group */
    color: var(--teal);           /* Teal text color */
    border: 1px solid #333;       /* Subtle border */
    padding: 10px 15px;           /* Comfortable spacing */
    border-radius: 8px;           /* Rounded corners */
    font-family: 'Inter', sans-serif;
    font-weight: 700;             /* Bold font like Flow */
    font-size: 0.8rem;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;

    /* Custom Arrow Logic */
    appearance: none;             /* Removes the default ugly browser arrow */
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300BFA5' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
}

/* Hover effect */
select#room-size:hover {
    border-color: var(--teal);
    background-color: #161616;
}

/* Styling the actual options inside the dropdown (for Windows/Chrome) */
select#room-size option {
    background: #1c1c1c;
    color: #fff;
    padding: 10px;
}

/* Custom Dimension Inputs */
.dim-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dim-grid .full { grid-column: span 2; }
.input-wrap label { font-size: 0.65rem; color: #888; display: block; margin-bottom: 4px; }
.field { position: relative; display: flex; background: #111; border: 1px solid #333; border-radius: 6px; }
.field input { background: transparent; border: none; color: #fff; padding: 8px; width: 60%; outline: none; }
.field select { background: transparent; border: none; color: var(--teal); font-weight: bold; width: 40%; cursor: pointer; outline: none; }

/* Readonly Area Field */
#total-area { width: 100%; background: #000; border: 1px solid #222; color: #555; padding: 10px; border-radius: 6px; }

/* Path Selection Buttons */
.btn-group { display: flex; gap: 10px; }
.path-btn { flex: 1; background: #222; border: 1px solid #444; color: #eee; padding: 10px; border-radius: 6px; cursor: pointer; font-size: 0.75rem; }
.path-btn:hover { border-color: var(--teal); color: var(--teal); }

/* Accordion Panels */
.cat-panel { background: #1c1c1c; border: 1px solid #333; border-radius: 8px; margin-bottom: 10px; overflow: hidden; }
.cat-panel summary { padding: 12px; color: #aaa; font-weight: 700; font-size: 0.7rem; text-transform: uppercase; cursor: pointer; list-style: none; border-bottom: 1px solid #333; }
.cat-list { padding: 10px; }

/* Floating Spec Tooltip */
.p-card { position: relative; }
.p-card .tooltip { 
    position: absolute; left: 105%; top: 0; width: 220px; background: #111; border: 1px solid var(--teal); 
    padding: 15px; border-radius: 8px; visibility: hidden; opacity: 0; transition: 0.2s; z-index: 999;
}
.p-card:hover .tooltip { visibility: visible; opacity: 1; left: 100%; }

/* Side by side layout for inputs */
.side-by-side-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.input-block label {
    display: block;
    font-size: 0.7rem;
    color: #888;
    margin-bottom: 5px;
    font-weight: 600;
}

/* Combined Input and Unit styling */
.input-unit-wrap {
    display: flex;
    background: #111;
    border: 1px solid #333;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.input-unit-wrap:focus-within {
    border-color: var(--teal);
}

.input-unit-wrap input {
    width: 60%;
    background: transparent;
    border: none;
    color: #fff;
    padding: 10px;
    outline: none;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
}

.input-unit-wrap select {
    width: 40%;
    background: transparent;
    border: none;
    color: var(--teal);
    font-weight: bold;
    cursor: pointer;
    outline: none;
    text-align: center;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300BFA5' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 10px;
}

/* Static Portfolio Headers */
.cat-section h3 {
    padding: 20px 0 10px 0;
    margin: 0;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #888;
    letter-spacing: 1px;
    border-top: 1px solid #222; /* Adds separation without an expander box */
}

.cat-section:first-child h3 { border-top: none; }

.cat-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 10px;
}

.path-options { display: flex; gap: 10px; margin-top: 10px; }
.path-btn {
    flex: 1;
    background: #222;
    border: 1px solid #444;
    color: #888;
    padding: 10px 5px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 600;
    transition: all 0.2s;
}
.path-btn:hover { border-color: var(--teal); color: #fff; }
.path-btn.active { background: var(--teal); border-color: var(--teal); color: #000; }

/* --- Invisible Sidebar Scrollbar --- */
.sidebar-content {
    overflow-y: auto;
    flex: 1;
    /* Hide scrollbar for Firefox */
    scrollbar-width: none; 
    /* Hide scrollbar for IE/Edge */
    -ms-overflow-style: none; 
}

/* Hide scrollbar for Chrome, Safari, and Opera */
.sidebar-content::-webkit-scrollbar {
    display: none;
}

/* Adjust Canvas scrolling to be visible but clean */
.canvas::-webkit-scrollbar {
    width: 8px;
}
.canvas::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

/* --- Accordion Styling --- */
.cat-accordion {
    margin-top: 15px;
    border-bottom: 1px solid #222;
}

.cat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    cursor: pointer;
    color: #888;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.2s;
}

.cat-header:hover { color: #fff; }

/* Chevron Icon */
.chevron {
    width: 8px;
    height: 8px;
    border-right: 2px solid #555;
    border-bottom: 2px solid #555;
    transform: rotate(45deg); /* Default Down */
    transition: transform 0.3s ease;
}

/* Toggle Logic */
.cat-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}

.cat-list.expanded {
    max-height: 2000px; /* Large enough to fit content */
}

.cat-header.active .chevron {
    transform: rotate(-135deg); /* Point Up when active */
}

/* --- Corrected Signal Flow Animation --- */
@keyframes signalFlow {
    from { stroke-dashoffset: 40; }
    to { stroke-dashoffset: 0; }
}

/* Base edge style reset */
#wiring-diagram .edgePath path {
    stroke-width: 2px;
}

/* Animation Selectors for Mermaid v10+ SVGs */
#wiring-diagram.anim-fast .edgePath path.path,
#wiring-diagram.anim-fast .edgePath path {
    stroke-dasharray: 8, 4 !important;
    animation: signalFlow 0.6s linear infinite !important;
}

#wiring-diagram.anim-slow .edgePath path.path,
#wiring-diagram.anim-slow .edgePath path {
    stroke-dasharray: 10, 5 !important;
    animation: signalFlow 2.5s linear infinite !important;
}

#wiring-diagram.anim-none .edgePath path {
    stroke-dasharray: none !important;
    animation: none !important;
}

/* UI Styling Cleanup */
.toggle-group {
    background: #111;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid #222;
    display: flex;
    align-items: center;
    gap: 12px;
}

.toggle-group .control-label {
    font-size: 0.65rem;
    color: #666;
    text-transform: uppercase;
    font-weight: 800;
}

/* Styling the Flow Select Dropdown */
#anim-speed {
    background: transparent;
    color: var(--teal);
    border: none;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    outline: none;
    padding-right: 15px;
}