/* === Global Reset & Variables === */
:root {
    --primary: #38bdf8;
    --primary-hover: #0ea5e9;
    --danger: #ef4444;
    --info: #38bdf8;
    --success: #22c55e;
    --warning: #eab308;
    --dark: #1e293b;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --sidebar-width: 300px;
    --right-sidebar-width: 260px;
    --header-height: 50px;
    --toolbar-height: 40px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
    font-family: var(--font);
    font-size: 13px;
    color: var(--gray-800);
    background: var(--gray-100);
    overflow: hidden;
    height: 100vh;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font);
}

.btn:hover { opacity: 0.9; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-info { background: var(--info); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-outline {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-600);
}
.btn-block { display: flex; width: 100%; justify-content: center; }

.btn-upload {
    background: var(--primary);
    color: #fff;
    padding: 10px 24px;
    font-size: 14px;
    border-radius: 8px;
}

.btn-toolbar {
    background: none;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    color: var(--gray-600);
    font-size: 14px;
    transition: all 0.15s;
}

.btn-toolbar:hover { background: var(--gray-200); }
.btn-toolbar.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-500);
    font-size: 14px;
    padding: 4px;
}

.btn-tool { border: 1px solid var(--gray-200); padding: 8px 12px; background: #fff; border-radius: 6px; cursor: pointer; }
.btn-tool:hover { background: var(--gray-50); }

.btn-action {
    background: var(--primary);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    flex: 1;
}

.btn-tool-action {
    background: #fff;
    border: 1px solid var(--gray-200);
    padding: 8px 12px;
    border-radius: 6px;
    flex: 1;
    cursor: pointer;
}
.btn-tool-action:hover { background: var(--gray-50); }

/* === Header === */
#header-bar {
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 100;
}

.header-left .logo {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
}

.header-center {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-center input {
    width: 60px;
    padding: 4px 8px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
}

.header-right {
    display: flex;
    gap: 8px;
}

/* === Main Container === */
#main-container {
    display: flex;
    height: calc(100vh - var(--header-height));
}

/* === Utility === */
.hidden { display: none !important; }

.help-text {
    color: var(--gray-400);
    text-align: center;
    padding: 20px;
    font-size: 12px;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--gray-300);
    border-radius: 22px;
    transition: 0.2s;
}

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

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}

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

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* Checkered background pattern */
.checkerboard {
    background-image:
        linear-gradient(45deg, #ccc 25%, transparent 25%),
        linear-gradient(-45deg, #ccc 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ccc 75%),
        linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
