/* ═══════════════════════════════════════════
   SonaxShop Dashboard — Professional Theme
   ═══════════════════════════════════════════ */

:root {
    --sidebar-w: 260px;
    --topbar-h: 60px;
    --orange: #f97316;
    --orange-dark: #ea580c;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: #0f172a;
    --content-bg: #f1f5f9;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --radius: 0.5rem;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--content-bg);
    color: var(--text-primary);
    line-height: 1.5;
}

/* ═══════ LOGIN SCREEN ═══════ */

.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #1e293b 100%);
    padding: 1rem;
}

.login-card {
    background: white;
    border-radius: 1rem;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.login-logo img { height: 48px; margin-bottom: 0.5rem; }
.login-logo h1 { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.login-logo p { color: var(--text-secondary); font-size: 0.875rem; }
.login-logo-text { display: flex; align-items: center; justify-content: center; margin-bottom: 0.5rem; }

.login-error {
    background: #fef2f2; border: 1px solid #fecaca; color: #dc2626;
    padding: 0.75rem 1rem; border-radius: var(--radius); font-size: 0.875rem; margin-bottom: 1rem;
}

.login-btn {
    width: 100%; padding: 0.75rem; background: var(--orange); color: white;
    border: none; border-radius: var(--radius); font-size: 1rem; font-weight: 600;
    cursor: pointer; transition: background 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
}
.login-btn:hover { background: var(--orange-dark); }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.turnstile-wrapper { display: flex; justify-content: center; margin: 1rem 0; }
.login-footer { text-align: center; margin-top: 1.5rem; font-size: 0.75rem; color: var(--text-secondary); }

.password-wrapper { position: relative; }
.password-wrapper input { padding-right: 2.5rem; }
.password-toggle {
    position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 0.875rem;
}

/* ═══════ SIDEBAR ═══════ */

.sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w);
    background: var(--sidebar-bg); color: white;
    display: flex; flex-direction: column; z-index: 40; transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1.25rem 1.5rem; display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-brand { display: flex; align-items: center; gap: 0.75rem; font-size: 1.25rem; font-weight: 700; }
.sidebar-brand i { color: var(--orange); font-size: 1.5rem; }
.sidebar-close { background: none; border: none; color: rgba(255,255,255,.6); font-size: 1.25rem; cursor: pointer; }

.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }

.nav-item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem 1.5rem; color: rgba(255,255,255,.7); text-decoration: none;
    font-size: 0.9rem; font-weight: 500; transition: all 0.2s; border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--sidebar-hover); color: white; }
.nav-item.active { background: var(--sidebar-active); color: var(--orange); border-left-color: var(--orange); }
.nav-item i { width: 20px; text-align: center; }

.sidebar-footer {
    padding: 1rem 1.5rem; border-top: 1px solid rgba(255,255,255,.1);
    display: flex; align-items: center; justify-content: space-between;
}
.sidebar-user { display: flex; align-items: center; gap: 0.5rem; min-width: 0; flex: 1; }
.sidebar-user > i { font-size: 1.5rem; opacity: 0.7; flex-shrink: 0; }
.sidebar-user div { min-width: 0; }
.sidebar-user .text-sm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-logout {
    background: none; border: none; color: rgba(255,255,255,.5); font-size: 1.1rem;
    cursor: pointer; padding: 0.5rem; transition: color 0.2s; flex-shrink: 0;
}
.sidebar-logout:hover { color: #ef4444; }

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 35; }

/* ═══════ MAIN CONTENT ═══════ */

.main-content { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    height: var(--topbar-h); background: var(--card-bg); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; padding: 0 1.5rem; gap: 1rem;
    position: sticky; top: 0; z-index: 30;
}
.topbar-title { font-size: 1rem; font-weight: 600; color: var(--text-primary); }
.hamburger-btn { background: none; border: none; font-size: 1.25rem; color: var(--text-secondary); cursor: pointer; padding: 0.5rem; }

.topbar-save-btn {
    padding: 0.5rem 1rem; background: var(--orange); color: white; border: none;
    border-radius: var(--radius); font-weight: 600; font-size: 0.875rem;
    cursor: pointer; transition: background 0.2s; display: flex; align-items: center; gap: 0.5rem; white-space: nowrap;
}
.topbar-save-btn:hover { background: var(--orange-dark); }
.topbar-save-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Platform Switcher */
.platform-switcher { display: flex; gap: 2px; background: var(--content-bg); border-radius: var(--radius); padding: 2px; }
.platform-btn {
    padding: 0.35rem 0.75rem; border-radius: calc(var(--radius) - 2px); border: none;
    background: transparent; color: var(--text-secondary); font-size: 0.8rem; font-weight: 500;
    cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 0.25rem;
}
.platform-btn:hover { color: var(--text-primary); }
.platform-btn.active { background: var(--orange); color: white; box-shadow: 0 1px 2px rgba(0,0,0,.1); }

/* ═══════ PAGE CONTENT ═══════ */

.page-content { flex: 1; padding: 1.5rem; }
.page-inner { max-width: 1400px; margin: 0 auto; }

.block-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
    padding: 1rem; background: var(--card-bg); border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 1.5rem;
}
.toolbar-label { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.toolbar-btn {
    padding: 0.4rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius);
    background: white; color: var(--text-primary); font-size: 0.8rem; font-weight: 500;
    cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 0.35rem; white-space: nowrap;
}
.toolbar-btn:hover { border-color: var(--orange); color: var(--orange); background: #fff7ed; }
.toolbar-btn i { font-size: 0.75rem; }

.editor-layout { display: flex; gap: 1.5rem; }
.editor-blocks { flex: 2; min-width: 0; }
.editor-preview { flex: 1; min-width: 0; }

.section-header { margin-bottom: 1rem; }
.section-header h3 { font-size: 0.95rem; font-weight: 600; color: var(--text-secondary); display: flex; align-items: center; gap: 0.5rem; }

.badge { background: var(--orange); color: white; padding: 0.1rem 0.5rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; }

/* Block Cards */
.block-list { display: flex; flex-direction: column; gap: 0.75rem; }
.block-card {
    background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow);
    border: 1px solid var(--border); overflow: hidden; transition: box-shadow 0.2s, border-color 0.2s;
}
.block-card:hover { border-color: #cbd5e1; }
.block-card.dragging { opacity: 0.5; }

.block-header {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.6rem 0.75rem; background: #f8fafc; border-bottom: 1px solid var(--border);
}
.drag-handle { cursor: grab; color: #94a3b8; padding: 0 0.25rem; }

.type-badge {
    font-size: 0.7rem; font-weight: 600; padding: 0.15rem 0.6rem;
    border-radius: 9999px; text-transform: uppercase; letter-spacing: 0.03em;
}
.type-badge.slider { background: #dbeafe; color: #1d4ed8; }
.type-badge.banner_grid { background: #dcfce7; color: #16a34a; }
.type-badge.single_banner { background: #ccfbf1; color: #0d9488; }
.type-badge.section_title { background: #f3e8ff; color: #7c3aed; }
.type-badge.product_shelf { background: #fef9c3; color: #a16207; }
.type-badge.banner_product { background: #fce7f3; color: #db2777; }
.type-badge.video { background: #fee2e2; color: #dc2626; }
.type-badge.marka_slider { background: #e0e7ff; color: #4338ca; }

.block-body { padding: 0.75rem; }
.btn-icon { background: none; border: none; color: #94a3b8; cursor: pointer; padding: 0.25rem; font-size: 0.8rem; transition: color 0.2s; line-height: 1; }
.btn-icon:hover { color: var(--text-primary); }

/* ═══════ FORMS ═══════ */

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 0.35rem; }

.form-group input, .form-group select, .form-input, .form-select {
    width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 0.875rem; color: var(--text-primary); background: white;
    transition: border-color 0.2s, box-shadow 0.2s; font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-input:focus, .form-select:focus {
    outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(249,115,22,.15);
}

.form-label { font-size: 0.75rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 0.25rem; display: block; }

/* ═══════ CARDS ═══════ */

.card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; }
.card-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); background: #f8fafc; }
.card-header h3 { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); }
.card-body { padding: 1.25rem; }

.info-row { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.info-row:last-child { border-bottom: none; }
.info-row label { font-size: 0.85rem; color: var(--text-secondary); font-weight: 500; }
.info-row span { font-size: 0.85rem; color: var(--text-primary); font-weight: 600; }

/* ═══════ USERS TABLE ═══════ */

.users-table { width: 100%; border-collapse: collapse; }
.users-table th {
    text-align: left; padding: 0.75rem 1rem; font-size: 0.75rem; font-weight: 600;
    color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em;
    background: #f8fafc; border-bottom: 1px solid var(--border);
}
.users-table td { padding: 0.75rem 1rem; font-size: 0.85rem; border-bottom: 1px solid var(--border); }
.users-table tr:hover td { background: #f8fafc; }

.role-badge { font-size: 0.7rem; font-weight: 600; padding: 0.2rem 0.6rem; border-radius: 9999px; }
.role-badge.admin { background: #fef3c7; color: #92400e; }
.role-badge.editor { background: #dbeafe; color: #1e40af; }

/* ═══════ BUTTONS ═══════ */

.btn-primary {
    padding: 0.6rem 1.25rem; background: var(--orange); color: white; border: none;
    border-radius: var(--radius); font-weight: 600; font-size: 0.875rem;
    cursor: pointer; transition: background 0.2s; display: inline-flex; align-items: center; gap: 0.5rem;
}
.btn-primary:hover { background: var(--orange-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
    padding: 0.6rem 1.25rem; background: white; color: var(--text-secondary);
    border: 1px solid var(--border); border-radius: var(--radius); font-weight: 500; font-size: 0.875rem;
    cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 0.5rem;
}
.btn-secondary:hover { background: #f8fafc; border-color: #cbd5e1; }

.btn-danger {
    padding: 0.4rem 0.75rem; background: #fee2e2; color: #dc2626; border: none;
    border-radius: var(--radius); font-size: 0.8rem; cursor: pointer; transition: background 0.2s;
}
.btn-danger:hover { background: #fecaca; }

/* ═══════ MODALS ═══════ */

.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.modal-content {
    position: relative; background: white; border-radius: 0.75rem; width: 100%;
    max-width: 440px; box-shadow: var(--shadow-lg); max-height: 90vh; overflow-y: auto;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 1rem; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-secondary); font-size: 1rem; cursor: pointer; }
.modal-body { padding: 1.25rem; }
.modal-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 0.5rem; }

/* ═══════ EMPTY STATE ═══════ */

.empty-state { text-align: center; padding: 3rem 1rem; color: #94a3b8; }
.empty-state i { font-size: 2.5rem; margin-bottom: 0.75rem; display: block; }
.empty-state p { font-size: 0.9rem; }
.empty-state.small { padding: 2rem 1rem; }
.empty-state.small i { font-size: 1.5rem; }
.empty-state.small p { font-size: 0.75rem; }

/* ═══════ PHONE PREVIEW ═══════ */

.phone-frame {
    background: white; border-radius: 1.5rem; border: 3px solid #1e293b;
    overflow: hidden; box-shadow: var(--shadow-lg); max-width: 320px;
}
.phone-notch { background: #1e293b; height: 24px; display: flex; align-items: center; justify-content: center; }
.phone-notch::after { content: ''; width: 60px; height: 4px; background: #475569; border-radius: 2px; }
.phone-screen { max-height: 560px; overflow-y: auto; padding: 0.5rem; background: #f8fafc; }
.phone-screen::-webkit-scrollbar { width: 3px; }
.phone-screen::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

.preview-slider { width: 100%; height: 96px; background: #e2e8f0; border-radius: 0.5rem; overflow: hidden; position: relative; }
.preview-slider img { width: 100%; height: 100%; object-fit: cover; }

.preview-grid-row { display: flex; gap: 4px; margin-bottom: 4px; }
.preview-grid-item { border-radius: 4px; overflow: hidden; }
.preview-grid-item img { width: 100%; height: 60px; object-fit: cover; }

.preview-title { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 0.5rem; color: var(--text-primary); }

.preview-products { display: flex; gap: 6px; overflow-x: hidden; padding: 2px; }
.preview-product { width: 60px; flex-shrink: 0; }
.preview-product .img-placeholder { width: 100%; height: 60px; background: #e2e8f0; border-radius: 4px; }
.preview-product .name-placeholder { height: 6px; background: #cbd5e1; border-radius: 2px; margin-top: 4px; width: 80%; }
.preview-product .price-placeholder { height: 6px; background: var(--orange); border-radius: 2px; margin-top: 2px; width: 50%; opacity: 0.6; }

/* ═══════ LINK / COLSPAN ═══════ */

.link-row { display: flex; gap: 0.35rem; align-items: center; margin-top: 0.35rem; flex-wrap: wrap; }

.colspan-selector { display: flex; align-items: center; gap: 0.25rem; margin-top: 0.25rem; }
.colspan-btn {
    padding: 0.15rem 0.5rem; border: 1px solid var(--border); border-radius: 4px;
    background: white; font-size: 0.7rem; cursor: pointer; transition: all 0.15s;
}
.colspan-btn.active, .colspan-btn:hover { background: var(--orange); color: white; border-color: var(--orange); }

.img-thumb { width: 64px; height: 48px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); cursor: pointer; flex-shrink: 0; }
.img-thumb-placeholder {
    width: 64px; height: 48px; border: 2px dashed #cbd5e1; border-radius: 4px;
    display: flex; align-items: center; justify-content: center; color: #94a3b8;
    cursor: pointer; flex-shrink: 0; transition: all 0.2s;
}
.img-thumb-placeholder:hover { border-color: var(--orange); color: var(--orange); }

/* ═══════ PROGRESS BAR ═══════ */

.progress-bar { width: 100%; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--orange); border-radius: 3px; transition: width 0.3s ease; width: 0%; }

/* ═══════ TOAST ═══════ */

.toast {
    position: fixed; bottom: 1.5rem; right: 1.5rem; padding: 0.75rem 1.25rem;
    background: var(--sidebar-bg); color: white; border-radius: var(--radius);
    box-shadow: var(--shadow-lg); font-size: 0.875rem; z-index: 999;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s;
    display: flex; align-items: center; gap: 0.5rem;
}
@keyframes slideIn { from { transform: translateY(1rem); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

/* ═══════ UTILITY ═══════ */

.hidden { display: none !important; }
.w-full { width: 100%; }
.mt-4 { margin-top: 1rem; }
.flex-1 { flex: 1; }

/* ═══════ RESPONSIVE ═══════ */

@media (max-width: 1023px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.active { display: block; }
    .main-content { margin-left: 0; }
    .editor-layout { flex-direction: column; }
    .editor-preview { order: -1; }
    .phone-frame { margin: 0 auto; }
    .page-content { padding: 1rem; }
}

@media (max-width: 640px) {
    .block-toolbar { padding: 0.75rem; gap: 0.35rem; }
    .toolbar-btn { padding: 0.3rem 0.5rem; font-size: 0.7rem; }
    .topbar { padding: 0 1rem; }
    .login-card { padding: 2rem 1.5rem; }
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
