:root {
    --bg: #1e1e1e;
    --panel: #2d2d2d;
    --text: #ffffff;
    --accent: #ff4b4b;
    --input-bg: #3d3d3d;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 320px;
    background-color: var(--panel);
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 2px 0 10px rgba(0,0,0,0.3);
    flex-shrink: 0;
}

h1 { margin: 0 0 10px 0; font-size: 1.4rem; }

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

label { font-size: 0.85rem; color: #aaa; display: flex; justify-content: space-between; }

input[type="range"] { width: 100%; cursor: pointer; }
input[type="number"], select {
    background: var(--input-bg);
    border: 1px solid #555;
    color: white;
    padding: 6px;
    border-radius: 4px;
}

.color-row { display: flex; gap: 10px; }
input[type="color"] {
    border: none; width: 100%; height: 35px; cursor: pointer; background: none;
}

.row { display: flex; gap: 5px; }
.row input { flex-grow: 1; }

.hidden { display: none; }
#customAR { display: flex; gap: 5px; align-items: center; margin-top: 5px; }

.btn {
    border: none; padding: 8px 12px; border-radius: 4px; cursor: pointer;
    font-weight: 600; transition: background 0.2s;
    background: #444; color: white;
}
.btn:hover { background: #555; }
.btn.primary { background: var(--accent); color: white; }
.btn.primary:hover { background: #ff6b6b; }
.btn.secondary { font-size: 0.8rem; margin-top: 5px; }
.btn.download { width: 100%; background: #007acc; }

.actions { display: flex; gap: 10px; margin-top: auto; padding-top: 20px; }
#pdfForm { flex: 1; }

.preview-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background-color: #111;
    position: relative;
}

#gridContainer {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* The SVG will scale inside this */
#gridContainer svg {
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

#statsBar {
    position: absolute;
    bottom: 10px;
    background: rgba(0,0,0,0.7);
    padding: 5px 15px;
    border-radius: 20px;
    display: flex;
    gap: 15px;
    font-size: 0.8rem;
    pointer-events: none;
}
.stat-item { display: flex; align-items: center; gap: 5px; }
.swatch { width: 12px; height: 12px; border: 1px solid #fff; }


/* --- Header & Help Button --- */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px; /* Increased slightly for breathing room */
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 12px; /* Space between logo and text */
}

.app-logo {
    max-width: 50px;
    height: auto;
    display: block;
}

/* Update H1 to remove default margins so it centers with the logo */
.sidebar-header h1 {
    margin: 0;
    font-size: 1.4rem;
    line-height: 1;
}

.btn-icon {
    background: #444; color: #fff; border: none;
    width: 24px; height: 24px; border-radius: 50%;
    font-weight: bold; cursor: pointer;
    flex-shrink: 0; /* Prevents button from squishing */
}

.btn-icon:hover { background: var(--accent); }

/* --- Help Toggle Switch --- */
.help-toggle-group { margin-bottom: 15px; border-bottom: 1px solid #444; padding-bottom: 10px; }
.switch-label {
    display: flex; justify-content: space-between; align-items: center; cursor: pointer; font-size: 0.85rem; color: #aaa;
}
.switch-label input { display: none; }
.slider {
    width: 36px; height: 20px; background-color: #444;
    border-radius: 20px; position: relative; transition: 0.3s;
}
.slider:before {
    content: ""; position: absolute; height: 16px; width: 16px;
    left: 2px; bottom: 2px; background-color: white;
    border-radius: 50%; transition: 0.3s;
}
input:checked + .slider { background-color: var(--accent); }
input:checked + .slider:before { transform: translateX(16px); }

/* --- Help Text (Hidden by default) --- */
.help-text {
    display: none; /* HIDDEN DEFAULT */
    font-size: 0.75rem; color: #888;
    margin: 2px 0 8px 0; font-style: italic; line-height: 1.3;
}
/* This class makes them visible */
body.show-help .help-text { display: block; animation: fadeIn 0.3s; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --- Modal Overlay --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); z-index: 1000;
    display: flex; justify-content: center; align-items: center;
}
.modal-overlay.hidden { display: none; }

.modal-content {
    background: var(--panel); padding: 30px; border-radius: 8px;
    max-width: 500px; width: 90%; color: #ddd; position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.modal-content h2 { margin-top: 0; color: var(--accent); }
.modal-content ul { padding-left: 20px; line-height: 1.6; }
.modal-content li { margin-bottom: 8px; }

.close-btn {
    position: absolute; top: 10px; right: 15px;
    background: none; border: none; font-size: 1.5rem; color: #888; cursor: pointer;
}
.close-btn:hover { color: #fff; }


