/* ============================================================
   GlowPath – Styles
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: #ffffff;
    color: #333;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Top Toolbar */
#toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f5f5f7;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.toolbar-brand {
    font-size: 16px;
    font-weight: 700;
    color: #e94560;
    white-space: nowrap;
}

.toolbar-section {
    display: flex;
    align-items: center;
    gap: 4px;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: #ccc;
    margin: 0 4px;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

/* App body (sidebar + main row) */
#appBody {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
#sidebar {
    width: 280px;
    background: #f5f5f7;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-right: 1px solid #ddd;
    flex-shrink: 0;
}

/* Right Sidebar: Shapes */
#rightSidebar {
    width: 240px;
    background: #f5f5f7;
    padding: 12px;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #ddd;
    flex-shrink: 0;
}

/* Shapes panel fills remaining space */
#rightSidebar .panel-shapes {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.credit {
    text-align: center;
    font-size: 11px;
    color: #999;
    padding: 10px 0 4px;
    margin-top: auto;
}

.panel {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
}

.panel h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #666;
    margin-bottom: 8px;
}

.panel label {
    display: block;
    font-size: 12px;
    margin-top: 6px;
    color: #555;
}

.panel input[type="number"],
.panel input[type="text"],
.panel select {
    width: 100%;
    padding: 6px 8px;
    margin-top: 2px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    color: #333;
    font-size: 13px;
}

.panel input[type="range"] {
    width: 100%;
    margin-top: 4px;
}

.panel input[type="color"] {
    width: 40px;
    height: 28px;
    border: none;
    background: none;
    cursor: pointer;
    vertical-align: middle;
}

.color-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.btn {
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-primary {
    background: #e94560;
    color: #fff;
}

.btn-primary:hover {
    background: #c73e54;
}

.btn-secondary {
    background: #e8e8ec;
    color: #333;
}

.btn-secondary:hover {
    background: #d8d8de;
}

.btn-danger {
    background: #fce4e4;
    color: #c0392b;
}

.btn-danger:hover {
    background: #f5c6c6;
}

.btn-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.btn.active {
    outline: 2px solid #e94560;
    outline-offset: 1px;
}

/* Shape list */
#shapeList {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin-top: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 4px;
    background: #f8f8fa;
}

body.dark #shapeList {
    border-color: #0f3460;
    background: #1a1a2e;
}

.shape-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 8px;
    background: #eef0f4;
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 12px;
    cursor: pointer;
}

.shape-item:hover {
    background: #dfe2e8;
}

.shape-item.selected {
    outline: 1px solid #e94560;
}

.shape-item .del-btn {
    background: none;
    border: none;
    color: #e94560;
    cursor: pointer;
    font-size: 14px;
    padding: 0 4px;
}

/* Animation list */
#animList {
    max-height: 140px;
    overflow-y: auto;
    margin-top: 8px;
}

.anim-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 8px;
    background: #eef0f4;
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 12px;
}

.anim-item .del-btn {
    background: none;
    border: none;
    color: #e94560;
    cursor: pointer;
    font-size: 14px;
    padding: 0 4px;
}

/* Main canvas area */
#main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    position: relative;
}

#canvasWrap {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.08);
    display: inline-block;
    overflow: visible;
}

#rulerCanvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 2;
}

canvas#canvas {
    display: block;
    cursor: crosshair;
    position: relative;
    z-index: 1;
}

/* Snapshot bar */
#snapshotBar {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    z-index: 3;
}

#canvasWrap:hover #snapshotBar,
#snapshotBar.show {
    opacity: 1;
    pointer-events: auto;
}

.snap-btn {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    backdrop-filter: blur(4px);
    transition: background 0.15s;
}

.snap-btn:hover {
    background: rgba(0, 0, 0, 0.75);
}

/* Playback bar */
#playbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    background: #eef0f4;
    padding: 10px 16px;
    border-radius: 8px;
}

#playbar button {
    font-size: 18px;
}

#timeline {
    width: 400px;
}

#timeDisplay {
    font-size: 13px;
    font-family: monospace;
    min-width: 80px;
}

/* Export overlay */
#exportOverlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

#exportOverlay.show {
    display: flex;
}

#exportBox {
    background: #ffffff;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #ddd;
    min-width: 300px;
    text-align: center;
}

#exportBox h3 {
    margin-bottom: 12px;
}

#exportProgress {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    margin: 12px 0;
}

#exportStatus {
    font-size: 13px;
    margin-bottom: 12px;
}

/* ---- Dark theme ---- */
body.dark {
    background: #1a1a2e;
    color: #e0e0e0;
}

body.dark #sidebar {
    background: #343b55;
    border-right-color: #0f3460;
}

body.dark #rightSidebar {
    background: #343b55;
    border-left-color: #0f3460;
}

body.dark #toolbar {
    background: #343b55;
    border-bottom-color: #0f3460;
}

body.dark .toolbar-brand {
    color: #e94560;
}

body.dark .toolbar-divider {
    background: #555;
}

body.dark #toolbar label {
    color: #aaa;
}

body.dark #toolbar input[type="number"] {
    background: #0f3460;
    border-color: #1a3a6e;
    color: #e0e0e0;
}

body.dark #toolbar span {
    color: #888;
}

body.dark #multiSegHint {
    background: #2a2a1e;
    color: #bbb;
}

body.dark .panel {
    background: #28283d;
    border-color: #0f3460;
}

body.dark .panel h3 {
    color: #888;
}

body.dark .panel label {
    color: #aaa;
}

body.dark .panel input[type="number"],
body.dark .panel input[type="text"],
body.dark .panel select {
    background: #0f3460;
    border-color: #1a3a6e;
    color: #e0e0e0;
}

body.dark .btn-secondary {
    background: #0f3460;
    color: #e0e0e0;
}

body.dark .btn-secondary:hover {
    background: #1a3a6e;
}

body.dark .btn-danger {
    background: #6b1a1a;
    color: #e0e0e0;
}

body.dark .btn-danger:hover {
    background: #8b2a2a;
}

body.dark .color-stop-row input[type="color"] {
    border-color: #1a3a6e;
}

body.dark .shape-item,
body.dark .anim-item {
    background: #0f3460;
}

body.dark .shape-item:hover {
    background: #1a3a6e;
}

body.dark #canvasWrap {
    border-color: #0f3460;
    box-shadow: 0 0 30px rgba(233, 69, 96, 0.15);
}

body.dark #playbar {
    background: #16213e;
}

body.dark #exportBox {
    background: #16213e;
    border-color: #0f3460;
}

body.dark .credit {
    color: #666;
}

body.dark #themeToggle {
    border-color: #555;
}

/* ---- Small screen warning ---- */
#smallScreenWarning {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #ffffff;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px;
}

.warning-box {
    max-width: 400px;
}

.warning-box h2 {
    font-size: 22px;
    color: #e94560;
    margin: 16px 0 8px;
}

.warning-box p {
    font-size: 15px;
    color: #555;
    line-height: 1.5;
}

body.dark #smallScreenWarning {
    background: #1a1a2e;
}

body.dark .warning-box h2 {
    color: #e94560;
}

body.dark .warning-box p {
    color: #aaa;
}

@media (max-width: 1023px) {
    #smallScreenWarning {
        display: flex;
    }

    #toolbar,
    #multiSegHint,
    #appBody {
        display: none !important;
    }
}