:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --accent: #a855f7;
    --bg-main: #f8fafc;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --white: #ffffff;
}

.saturn-app, .saturn-app * { box-sizing: border-box; }

.saturn-app {
    display: flex;
    width: 100%;
    min-height: 720px;
    height: auto;
    background: var(--white);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
    overflow: hidden;
    margin: 20px 0;
}

/* Sidebar & Steps */
.saturn-sidebar {
    width: 380px; min-width: 380px; height: 100%;
    background: var(--white); border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
}

.logo-icon { width: 28px; height: 28px; }

.saturn-steps {
    display: flex;
    margin: 20px; 
    padding: 10px;
    gap: 6px;
    background: var(--bg-main);
    border-radius: 16px;
    border: 1px solid var(--border);
    justify-content: space-evenly;
}

.step {
    /* flex: 1; removed to make padding visible */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    border-radius: 10px;
    transition: all 0.3s;
    white-space: nowrap;
    user-select: none;
}

.step:focus-visible,
.size-btn:focus-visible,
.shape-item:focus-visible,
.btn-square-fixed:focus-visible,
.btn-gradient-fixed:focus-visible,
.btn-outline-fixed:focus-visible,
.btn-next-fixed:focus-visible,
.btn-buy-fixed:focus-visible,
#close-modal:focus-visible {
    outline: 3px solid rgba(99, 102, 241, 0.35);
    outline-offset: 2px;
}

.step::before {
    content: attr(data-step);
    width: 20px;
    height: 20px;
    background: var(--border);
    color: var(--text-muted);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.step.active {
    background: var(--white);
    color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.step.active::before {
    background: var(--primary);
    color: var(--white);
}

.step.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.step:not(.disabled):hover {
    color: var(--primary);
}

.sidebar-scroll-area { flex: 1; overflow-y: auto; padding: 20px; position: relative; }
.step-content { display: none; width: 100%; }
.step-content.active { display: block; animation: slideUp 0.3s ease; }

@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.step-heading { font-size: 18px; font-weight: 800; margin-bottom: 24px; }

/* Restoring Upload Zone Border */
.upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 60px 20px;
    border: 2px dashed var(--border) !important;
    border-radius: 20px;
    cursor: pointer;
    transition: 0.3s;
    background: var(--bg-main);
    text-align: center;
}

.upload-zone:hover { border-color: var(--primary) !important; background: #f5f7ff; }
.upload-zone.dragover { border-color: var(--primary) !important; background: #eef2ff; }
.upload-icon-large { width: 48px; height: 48px; color: var(--primary); margin-bottom: 16px; }

/* Control Group */
.control-group { margin-bottom: 28px; }
.label-sm { display: block; font-size: 12px; font-weight: 800; color: var(--text-muted); text-transform: uppercase; margin-bottom: 12px; }
.label-xs { font-size: 12px; font-weight: 700; color: var(--text); display: block; margin-bottom: 5px; }

/* Grids & Buttons */
.size-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.size-btn { padding: 12px; background: var(--bg-main); border-radius: 12px; font-weight: 700; border: 2px solid transparent; cursor: pointer; transition: 0.2s; }
.size-btn.active { background: #eef2ff; border-color: var(--primary); color: var(--primary); }
.size-btn .size-price { display: block; font-size: 11px; font-weight: 800; color: var(--text-muted); margin-top: 4px; }
.size-btn.active .size-price { color: var(--primary); }

.shape-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.shape-item { height: 50px; background: var(--bg-main); border-radius: 12px; display: flex; align-items: center; justify-content: center; border: 2px solid transparent; cursor: pointer; transition: 0.2s; }
.shape-item.active { background: #eef2ff; border-color: var(--primary); color: var(--primary); }
.shape-item svg { width: 22px; height: 22px; }

.action-grid-fixed { display: grid; grid-template-columns: 55px 55px 1fr; gap: 10px; }
.btn-square-fixed { height: 55px; background: var(--bg-main); border-radius: 12px; display: flex; align-items: center; justify-content: center; cursor: pointer; border: 1.5px solid var(--border); }
.btn-gradient-fixed { height: 55px; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; border-radius: 12px; font-weight: 700; cursor: pointer; border: 0; }
.btn-gradient-fixed:disabled { opacity: 0.6; cursor: not-allowed; }

/* Color Pickers (Restoring 1x1) */
.picker-wrapper { position: relative; width: 45px; height: 45px; cursor: pointer; }
.picker-wrapper input { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 2; }
.picker-square { position: absolute; inset: 0; border-radius: 10px; border: 3px solid #fff; box-shadow: 0 0 0 1.5px var(--border); z-index: 1; transition: 0.2s; }

/* Inputs */
.saturn-input, .saturn-select { width: 100%; padding: 14px; background: var(--bg-main); border: 2px solid transparent; border-radius: 12px; font-weight: 600; margin-bottom: 10px; }
.saturn-input:focus { background: #fff; border-color: var(--primary); outline: none; }
.saturn-range { width: 100%; margin-top: 8px; cursor: pointer; }

/* Stepper */
.stepper-fixed { display: flex; background: var(--bg-main); border-radius: 14px; padding: 6px; gap: 10px; }
.step-btn-fixed { width: 45px; height: 45px; background: #fff; border-radius: 10px; font-size: 20px; font-weight: 700; box-shadow: 0 2px 5px rgba(0,0,0,0.05); cursor: pointer; border: none; }
.stepper-fixed input { flex: 1; text-align: center; background: transparent; border: none; font-weight: 800; font-size: 16px; }

/* Workspace */
.saturn-workspace { flex: 1; background: #f1f5f9; display: flex; align-items: center; justify-content: center; position: relative; }
.workspace-hint { text-align: center; color: var(--text-muted); }
.placeholder-icon { width: 80px; height: 80px; opacity: 0.2; margin-bottom: 20px; }
.canvas-holder { background: #fff; padding: 30px; border-radius: 35px; box-shadow: 0 20px 50px rgba(0,0,0,0.05); }
canvas { border-radius: 12px; display: block; background: #fafafa; cursor: crosshair; }
canvas:focus { outline: none; }

/* UI Helpers */
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-row { display: flex; align-items: center; }
.gap-10 { gap: 10px; }
.btn-group-row { display: flex; gap: 10px; margin-top: 20px; }
.btn-outline-fixed { flex: 1; padding: 14px; background: #fff; border: 2px solid var(--border); border-radius: 12px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-next-fixed { padding: 14px; background: var(--text); color: #fff; border-radius: 12px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-outline-fixed:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn-next-fixed:hover { filter: brightness(0.95); }

/* Summary */
.summary-box-fixed { background: var(--bg-main); padding: 24px; border-radius: 20px; margin-top: 20px; }
.summary-total-fixed { display: flex; justify-content: space-between; font-size: 28px; font-weight: 900; margin-bottom: 20px; }
.btn-buy-fixed { width: 100%; padding: 18px; background: var(--primary); color: #fff; font-size: 16px; border-radius: 14px; font-weight: 800; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.4); border: none; }
.btn-buy-fixed:hover { filter: brightness(0.97); }
.btn-buy-fixed:disabled { opacity: 0.6; cursor: not-allowed; box-shadow: none; }

/* Switch */
.saturn-switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    user-select: none;
}
.saturn-switch input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 44px;
    height: 26px;
    border-radius: 999px;
    background: var(--border);
    border: 1px solid #cbd5e1;
    position: relative;
    cursor: pointer;
    transition: 0.18s ease;
    flex: 0 0 auto;
}
.saturn-switch input[type="checkbox"]::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
    transition: 0.18s ease;
}
.saturn-switch input[type="checkbox"]:checked {
    background: var(--primary);
    border-color: rgba(99, 102, 241, 0.6);
}
.saturn-switch input[type="checkbox"]:checked::after {
    left: 21px;
}
.saturn-switch input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Toast */
.saturn-toast {
    position: absolute;
    left: 20px;
    bottom: 20px;
    background: rgba(15, 23, 42, 0.92);
    color: #fff;
    padding: 12px 14px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 13px;
    max-width: min(520px, calc(100% - 40px));
    box-shadow: 0 20px 40px rgba(0,0,0,0.25);
    display: none;
    z-index: 11000;
}
.saturn-toast.show { display: block; animation: toastIn 0.2s ease-out; }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Modal & Loader */
.saturn-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.8); display: flex; align-items: center; justify-content: center; z-index: 10000; }
.modal-content { background: #fff; width: 90%; max-width: 900px; max-height: 90vh; border-radius: 24px; overflow: hidden; display: flex; flex-direction: column; }
.modal-header { padding: 20px 30px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); }
#close-modal { background: none; border: none; cursor: pointer; color: var(--text-muted); }
.modal-body { flex: 1; overflow-y: auto; padding: 40px; background: #f1f5f9; display: flex; justify-content: center; }
.a4-sheet { width: 210mm; min-height: 297mm; background: #fff; padding: 15mm; display: grid; grid-template-columns: repeat(auto-fill, minmax(50mm, 1fr)); gap: 10mm; box-shadow: 0 10px 30px rgba(0,0,0,0.1); }
.ai-spinner { width: 50px; height: 50px; border: 5px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

#ai-loader { display:none; position:absolute; inset:0; background:rgba(255,255,255,0.9); flex-direction:column; align-items:center; justify-content:center; z-index:100; text-align:center; padding: 24px; }

/* Responsive */
@media (max-width: 980px) {
    .saturn-app { flex-direction: column; min-height: auto; }
    .saturn-sidebar { width: 100%; min-width: 0; border-right: none; border-bottom: 1px solid var(--border); }
    .saturn-steps { margin: 16px; }
    .sidebar-scroll-area { padding: 16px; max-height: 420px; }
    .saturn-workspace { min-height: 420px; padding: 18px; }
    .canvas-holder { width: 100%; padding: 18px; border-radius: 24px; }
    canvas { width: 100%; height: auto; }
}

@media (max-width: 520px) {
    .saturn-steps { padding: 8px; gap: 4px; }
    .step { padding: 9px 10px; font-size: 10px; }
    .step::before { width: 18px; height: 18px; font-size: 9px; }
    .shape-grid { grid-template-columns: repeat(4, 1fr); }
    .action-grid-fixed { grid-template-columns: 50px 50px 1fr; }
    .summary-total-fixed { font-size: 22px; }
}
