/* ============================================================
   LULU DECOR — Global Styles
   ============================================================ */

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

:root {
    --brand:        #6B4226;
    --brand-light:  #F5EDE6;
    --brand-dark:   #4A2D18;
    --sidebar-w:    230px;
    --topbar-h:     56px;
    --radius-sm:    6px;
    --radius-md:    8px;
    --radius-lg:    12px;
    --font:         'Inter', system-ui, -apple-system, sans-serif;
    --bg:           #F7F5F2;
    --bg-card:      #FFFFFF;
    --border:       rgba(0,0,0,0.08);
    --border-md:    rgba(0,0,0,0.12);
    --text:         #1A1A1A;
    --text-muted:   #6B7280;
    --text-light:   #9CA3AF;
}

body {
    font-family: var(--font);
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

/* ============================================================
   LAYOUT
   ============================================================ */

.layout {
    display: flex;
    min-height: 100vh;
}

.main-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin-left: var(--sidebar-w);
}

.page-content {
    padding: 24px;
    flex: 1;
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
    width: var(--sidebar-w);
    background: #FFFFFF;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo-dot {
    width: 34px; height: 34px;
    border-radius: 8px;
    background: var(--brand);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.sidebar-logo-dot span { color: #fff; font-size: 13px; font-weight: 600; }
.sidebar-logo-img { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; }

.sidebar-company  { font-size: 14px; font-weight: 600; color: var(--text); }
.sidebar-tagline  { font-size: 11px; color: var(--text-light); margin-top: 1px; }

.sidebar-nav { flex: 1; padding: 12px 0; }

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-light);
    padding: 10px 16px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text-muted);
    border-left: 2px solid transparent;
    transition: all 0.15s;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active {
    background: var(--brand-light);
    color: var(--brand);
    border-left-color: var(--brand);
    font-weight: 500;
}
.nav-item i { font-size: 17px; }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-top: 1px solid var(--border);
}
.sidebar-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--brand);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; color: #fff; font-weight: 600;
    flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: var(--text-light); }
.sidebar-logout {
    color: var(--text-light);
    font-size: 18px;
    display: flex; align-items: center;
}
.sidebar-logout:hover { color: #E24B4A; }

/* ============================================================
   TOPBAR
   ============================================================ */

.topbar {
    height: var(--topbar-h);
    background: #FFFFFF;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-left  { flex: 1; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 2px;
}
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb i { font-size: 12px; }

.page-title { font-size: 16px; font-weight: 600; color: var(--text); }

/* ============================================================
   CARDS
   ============================================================ */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}
.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 7px;
}
.card-title i { font-size: 16px; color: var(--brand); }
.card-body { padding: 18px; }

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    transition: all 0.15s;
    white-space: nowrap;
}
.btn i { font-size: 15px; }

.btn-primary   { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }

.btn-secondary { background: #fff; color: var(--text); border-color: var(--border-md); }
.btn-secondary:hover { background: var(--bg); }

.btn-danger    { background: #fff; color: #E24B4A; border-color: #F7C1C1; }
.btn-danger:hover { background: #FCEBEB; }

.btn-success   { background: #EAF3DE; color: #3B6D11; border-color: #C0DD97; }

.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-sm i { font-size: 13px; }

.btn-icon {
    width: 32px; height: 32px;
    padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-md);
    background: #fff;
    color: var(--text-muted);
    transition: all 0.15s;
}
.btn-icon:hover { background: var(--bg); color: var(--text); }
.btn-icon.danger:hover { background: #FCEBEB; color: #E24B4A; border-color: #F7C1C1; }
.btn-icon i { font-size: 15px; }

/* ============================================================
   BADGES
   ============================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}
.badge-opt      { background: #EAF3DE; color: #3B6D11; }
.badge-prog     { background: #FAEEDA; color: #854F0B; }
.badge-ns       { background: #F1EFE8; color: #5F5E5A; }
.badge-active   { background: #E1F5EE; color: #0F6E56; }
.badge-inactive { background: #F1EFE8; color: #5F5E5A; }
.badge-low      { background: #EAF3DE; color: #3B6D11; }
.badge-medium   { background: #FAEEDA; color: #854F0B; }
.badge-high     { background: #FCEBEB; color: #A32D2D; }
.badge-urgent   { background: #E24B4A; color: #fff; }

/* ============================================================
   TABLES
   ============================================================ */

.table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead tr { background: var(--bg); border-bottom: 1px solid var(--border); }
th {
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}
td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #FAFAF9; }

/* ============================================================
   FORMS
   ============================================================ */

.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}
.form-label .required { color: #E24B4A; margin-left: 2px; }

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-md);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text);
    background: #fff;
    transition: border-color 0.15s;
    outline: none;
}
.form-control:focus { border-color: var(--brand); }
.form-control::placeholder { color: var(--text-light); }

textarea.form-control { resize: vertical; min-height: 90px; line-height: 1.5; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }

.form-hint { font-size: 11px; color: var(--text-light); margin-top: 4px; }
.form-error { font-size: 11px; color: #E24B4A; margin-top: 4px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ============================================================
   MODALS
   ============================================================ */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 200;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
    background: #fff;
    border-radius: var(--radius-lg);
    width: 520px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border);
}
.modal-lg { width: 760px; }
.modal-xl { width: 960px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}
.modal-title { font-size: 15px; font-weight: 600; color: var(--text); }
.modal-close {
    width: 30px; height: 30px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-md);
    background: #fff;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    transition: all 0.15s;
}
.modal-close:hover { background: var(--bg); }
.modal-close i { font-size: 16px; }

.modal-body { padding: 20px; }
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
}

/* ============================================================
   SEARCH & FILTER BAR
   ============================================================ */

.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--border-md);
    border-radius: var(--radius-md);
    padding: 7px 12px;
    flex: 1;
    min-width: 200px;
    max-width: 320px;
}
.search-wrap i { font-size: 15px; color: var(--text-light); flex-shrink: 0; }
.search-wrap input {
    border: none;
    background: transparent;
    font-size: 13px;
    color: var(--text);
    outline: none;
    width: 100%;
}

.filter-select {
    padding: 7px 30px 7px 12px;
    border: 1px solid var(--border-md);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text);
    background: #fff;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    outline: none;
    cursor: pointer;
}
.filter-select:focus { border-color: var(--brand); }

/* ============================================================
   PAGINATION
   ============================================================ */

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
}
.page-btns { display: flex; gap: 4px; }
.page-btn {
    min-width: 30px; height: 30px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-md);
    background: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
    color: var(--text-muted);
    transition: all 0.15s;
}
.page-btn:hover { background: var(--bg); color: var(--text); }
.page-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.page-btn:disabled { opacity: 0.4; pointer-events: none; }

/* ============================================================
   ALERTS & TOASTS
   ============================================================ */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.alert-success { background: #EAF3DE; color: #3B6D11; border: 1px solid #C0DD97; }
.alert-danger  { background: #FCEBEB; color: #A32D2D; border: 1px solid #F7C1C1; }
.alert-warning { background: #FAEEDA; color: #854F0B; border: 1px solid #FAC775; }
.alert-info    { background: #E6F1FB; color: #185FA5; border: 1px solid #B5D4F4; }

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    max-width: 380px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    animation: toastIn 0.2s ease;
}
.toast.success { border-left: 3px solid #3B6D11; }
.toast.error   { border-left: 3px solid #E24B4A; }
.toast.warning { border-left: 3px solid #854F0B; }
.toast i { font-size: 18px; }
.toast.success i { color: #3B6D11; }
.toast.error   i { color: #E24B4A; }
.toast.warning i { color: #854F0B; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   IMAGE UPLOAD COMPONENT
   ============================================================ */

.img-upload-zone {
    border: 1.5px dashed var(--border-md);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background: var(--bg);
}
.img-upload-zone:hover { border-color: var(--brand); background: var(--brand-light); }
.img-upload-zone i { font-size: 28px; color: var(--text-light); margin-bottom: 6px; }
.img-upload-zone .upload-text { font-size: 13px; color: var(--text-muted); }
.img-upload-zone .upload-hint { font-size: 11px; color: var(--text-light); margin-top: 3px; }

.img-upload-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 10px;
    background: var(--bg);
    border-radius: var(--radius-md);
    padding: 3px;
    width: fit-content;
}
.img-upload-tab {
    padding: 5px 14px;
    font-size: 12px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-muted);
    border: none;
    background: transparent;
    transition: all 0.15s;
}
.img-upload-tab.active {
    background: #fff;
    color: var(--brand);
    font-weight: 500;
    border: 1px solid var(--border);
}

.img-preview {
    position: relative;
    display: inline-block;
}
.img-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-md);
}
.img-preview .img-remove {
    position: absolute;
    top: 4px; right: 4px;
    width: 22px; height: 22px;
    background: rgba(0,0,0,0.6);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
}

/* Gallery thumbnails */
.gallery-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.gallery-thumb {
    width: 72px; height: 72px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-md);
    overflow: hidden;
    position: relative;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumb .thumb-remove {
    position: absolute;
    top: 2px; right: 2px;
    width: 18px; height: 18px;
    background: rgba(226,75,74,0.85);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 10px;
    cursor: pointer;
}
.gallery-thumb-add {
    width: 72px; height: 72px;
    border-radius: var(--radius-md);
    border: 1.5px dashed var(--border-md);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    background: var(--bg);
    color: var(--text-light);
    font-size: 22px;
    transition: all 0.15s;
}
.gallery-thumb-add:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-light); }

/* ============================================================
   ACCORDION
   ============================================================ */

.accordion-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 8px;
}
.accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    background: var(--bg-card);
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    user-select: none;
}
.accordion-header:hover { background: var(--bg); }
.accordion-header i.chevron { font-size: 16px; color: var(--text-light); transition: transform 0.2s; }
.accordion-item.open .chevron { transform: rotate(180deg); }
.accordion-body { display: none; padding: 16px; border-top: 1px solid var(--border); }
.accordion-item.open .accordion-body { display: block; }

/* ============================================================
   TABS
   ============================================================ */

.tabs-nav {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}
.tab-btn {
    padding: 11px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    border: none;
    background: transparent;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--brand); border-bottom-color: var(--brand); }

.tab-pane { display: none; padding: 20px; }
.tab-pane.active { display: block; }

/* ============================================================
   LIGHTBOX
   ============================================================ */

.lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    z-index: 300;
    align-items: center;
    justify-content: center;
}
.lightbox-overlay.open { display: flex; }
.lightbox-img { max-width: 90vw; max-height: 85vh; border-radius: var(--radius-md); }
.lightbox-close {
    position: absolute;
    top: 20px; right: 20px;
    width: 36px; height: 36px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    border: none;
}
.lightbox-close:hover { background: rgba(255,255,255,0.25); }

/* ============================================================
   STAT CARDS (Dashboard)
   ============================================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
}
.stat-icon {
    width: 34px; height: 34px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 12px;
}
.stat-icon i { font-size: 17px; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-pills { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }

/* ============================================================
   UTILITY
   ============================================================ */

.text-muted   { color: var(--text-muted); }
.text-light   { color: var(--text-light); }
.text-brand   { color: var(--brand); }
.text-danger  { color: #E24B4A; }
.text-success { color: #3B6D11; }
.fw-500       { font-weight: 500; }
.fw-600       { font-weight: 600; }
.fs-12        { font-size: 12px; }
.fs-13        { font-size: 13px; }
.mt-4         { margin-top: 4px; }
.mt-8         { margin-top: 8px; }
.mt-16        { margin-top: 16px; }
.mb-8         { margin-bottom: 8px; }
.mb-16        { margin-bottom: 16px; }
.d-flex       { display: flex; }
.align-center { align-items: center; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.flex-1       { flex: 1; }
.text-right   { text-align: right; }
.divider      { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-page {
    min-height: 100vh;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 40px;
    width: 100%;
    max-width: 420px;
}
.login-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
}
.login-logo-dot {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: var(--brand);
    display: flex; align-items: center; justify-content: center;
}
.login-logo-dot span { color: #fff; font-size: 15px; font-weight: 700; }
.login-title { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.login-sub   { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }

/* ============================================================
   STAT PILLS (Dashboard)
   ============================================================ */
.pill {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 500;
}
.pill-green  { background: #EAF3DE; color: #3B6D11; }
.pill-amber  { background: #FAEEDA; color: #854F0B; }
.pill-gray   { background: #F1EFE8; color: #5F5E5A; }
.pill-teal   { background: #E1F5EE; color: #0F6E56; }
.pill-red    { background: #FCEBEB; color: #A32D2D; }
.pill-blue   { background: #E6F1FB; color: #185FA5; }

/* Utility */
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
