/* ==========================================================================
   Azúcar Moreno — Theme
   Palette: white / cream / brown / soft pink
   ========================================================================== */

:root {
    --bk-cream:       #fdf6ee;
    --bk-cream-2:     #f7ecdf;
    --bk-brown:       #5d3a23;
    --bk-brown-2:     #8a5a3b;
    --bk-brown-3:     #b07d54;
    --bk-pink:        #f2b8c6;
    --bk-pink-2:      #e98ea6;
    --bk-pink-dark:   #d16d8a;
    --bk-teal:        #4fa8a0;
    --bk-surface:     #ffffff;
    --bk-body:        #fdf6ee;
    --bk-text:        #3d2b1f;
    --bk-muted:       #9b8574;
    --bk-border:      #eadfd2;
    --bk-shadow:      0 4px 24px rgba(93, 58, 35, .08);
    --bk-radius:      14px;
    --sidebar-w:      256px;
}

[data-bs-theme="dark"] {
    --bk-cream:   #221a14;
    --bk-cream-2: #2b211a;
    --bk-surface: #2b221b;
    --bk-body:    #1c1510;
    --bk-text:    #f0e6dc;
    --bk-muted:   #b39d8b;
    --bk-border:  #3d3128;
    --bk-shadow:  0 4px 24px rgba(0, 0, 0, .35);
}

/* ------------------------------------------------------------------ base */
body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bk-body);
    color: var(--bk-text);
    min-height: 100vh;
}
h1, h2, h3, .page-title, .sidebar-brand .brand-text {
    font-family: 'Playfair Display', Georgia, serif;
}
a { color: var(--bk-brown-2); text-decoration: none; }
a:hover { color: var(--bk-pink-dark); }

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

/* --------------------------------------------------------------- sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--bk-brown) 0%, #4a2d1a 100%);
    color: #f5e9dd;
    position: fixed; inset: 0 auto 0 0;
    z-index: 1040;
    display: flex; flex-direction: column;
    transition: transform .28s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: .6rem;
    padding: 1.25rem 1.25rem 1rem;
    font-size: 1.05rem; font-weight: 700; color: #fff;
}
.brand-icon { font-size: 1.5rem; }
.brand-logo {
    height: 38px; max-width: 46px; object-fit: contain;
    background: #fff; border-radius: 9px; padding: 3px;
}
.sidebar-heading {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
    color: rgba(245, 233, 221, .45);
    padding: 1rem 1.25rem .35rem;
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: .5rem .75rem; }
.sidebar-link {
    display: flex; align-items: center; gap: .75rem;
    color: rgba(245, 233, 221, .82);
    padding: .62rem .8rem; margin-bottom: .15rem;
    border-radius: 10px; font-size: .92rem;
    transition: background .18s, color .18s, transform .18s;
}
.sidebar-link i { font-size: 1.05rem; width: 1.3rem; text-align: center; }
.sidebar-link:hover { background: rgba(255, 255, 255, .08); color: #fff; transform: translateX(3px); }
.sidebar-link.active {
    background: linear-gradient(90deg, var(--bk-pink-2), var(--bk-pink-dark));
    color: #fff; box-shadow: 0 4px 14px rgba(209, 109, 138, .35);
}
.sidebar-footer { padding: 1rem; border-top: 1px solid rgba(255,255,255,.08); }

.sidebar-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.45);
    z-index: 1035; opacity: 0; pointer-events: none; transition: opacity .25s;
}
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-overlay { opacity: 1; pointer-events: auto; }
    .main-content { margin-left: 0 !important; }
}

/* ------------------------------------------------------------------ main */
.main-content {
    flex: 1; margin-left: var(--sidebar-w);
    display: flex; flex-direction: column; min-width: 0;
}
.topbar {
    display: flex; align-items: center; gap: 1rem;
    background: var(--bk-surface);
    border-bottom: 1px solid var(--bk-border);
    padding: .65rem 1.25rem;
    position: sticky; top: 0; z-index: 1020;
}
.page-content { padding: 1.5rem; flex: 1; animation: fadeUp .35s ease; }
.app-footer { padding: .8rem 1.5rem; border-top: 1px solid var(--bk-border); }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

.btn-icon {
    width: 40px; height: 40px; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--bk-brown-2); background: var(--bk-cream-2); border: none;
}
.btn-icon:hover { background: var(--bk-pink); color: var(--bk-brown); }

.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--bk-pink-2), var(--bk-brown-3));
    color: #fff; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}
.profile-btn { border: none; background: transparent; color: var(--bk-text); }

.notif-badge {
    position: absolute; top: 2px; right: 2px;
    background: var(--bk-pink-dark); color: #fff;
    font-size: .62rem; font-weight: 700;
    min-width: 17px; height: 17px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
}
.notif-menu { width: 320px; max-width: 90vw; }
.notif-item { white-space: normal; border-bottom: 1px solid var(--bk-border); }
.notif-item:last-child { border-bottom: none; }

/* ----------------------------------------------------------------- cards */
.card {
    background: var(--bk-surface);
    border: 1px solid var(--bk-border);
    border-radius: var(--bk-radius);
    box-shadow: var(--bk-shadow);
}
.card-header {
    background: transparent; border-bottom: 1px solid var(--bk-border);
    font-weight: 600; padding: 1rem 1.25rem;
}

.stat-card { overflow: hidden; position: relative; transition: transform .2s, box-shadow .2s; }
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(93,58,35,.14); }
.stat-card .stat-icon {
    width: 52px; height: 52px; border-radius: 14px; font-size: 1.5rem;
    display: flex; align-items: center; justify-content: center;
}
.stat-card .stat-value { font-size: 1.55rem; font-weight: 700; }
.stat-card .stat-label { color: var(--bk-muted); font-size: .82rem; }

.icon-cream { background: var(--bk-cream-2); color: var(--bk-brown-2); }
.icon-pink  { background: #fbe4ea; color: var(--bk-pink-dark); }
.icon-teal  { background: #e2f3f1; color: var(--bk-teal); }
.icon-brown { background: #efe2d5; color: var(--bk-brown); }
[data-bs-theme="dark"] .icon-cream { background: #3a2e23; }
[data-bs-theme="dark"] .icon-pink  { background: #45272f; }
[data-bs-theme="dark"] .icon-teal  { background: #21393a; }
[data-bs-theme="dark"] .icon-brown { background: #3d2f22; }

/* --------------------------------------------------------------- buttons */
.btn-brown {
    background: var(--bk-brown-2); color: #fff; border: none;
}
.btn-brown:hover { background: var(--bk-brown); color: #fff; }
.btn-pink {
    background: linear-gradient(90deg, var(--bk-pink-2), var(--bk-pink-dark));
    color: #fff; border: none;
}
.btn-pink:hover { filter: brightness(1.06); color: #fff; }
.btn-outline-brown { border: 1px solid var(--bk-brown-3); color: var(--bk-brown-2); }
.btn-outline-brown:hover { background: var(--bk-brown-2); color: #fff; }

/* ---------------------------------------------------------------- badges */
.badge-status { font-weight: 600; padding: .45em .8em; border-radius: 20px; font-size: .72rem; }
.bg-baking { background-color: #c97b2d !important; color: #fff; }
.bg-pink   { background-color: var(--bk-pink-dark) !important; color: #fff; }
.bg-teal   { background-color: var(--bk-teal) !important; color: #fff; }

/* ----------------------------------------------------------------- forms */
.form-control, .form-select {
    border-radius: 10px; border-color: var(--bk-border);
    background: var(--bk-surface); color: var(--bk-text);
    padding: .55rem .85rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--bk-pink-2);
    box-shadow: 0 0 0 .2rem rgba(233, 142, 166, .2);
}
.form-label { font-weight: 600; font-size: .85rem; margin-bottom: .3rem; }
.form-control.is-invalid, .form-select.is-invalid { border-color: #dc3545; }
.invalid-feedback { display: block; }

/* ------------------------------------------------------------ datatables */
.table { color: var(--bk-text); }
.table thead th {
    background: var(--bk-cream-2); border-bottom: none;
    font-size: .78rem; text-transform: uppercase; letter-spacing: .04em;
    color: var(--bk-brown-2); font-weight: 700; white-space: nowrap;
}
.table-hover tbody tr:hover { background: var(--bk-cream); }
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input { border-radius: 8px; }
.page-item.active .page-link { background: var(--bk-brown-2); border-color: var(--bk-brown-2); }
.page-link { color: var(--bk-brown-2); }

/* ------------------------------------------------------------- dropzone */
.dropzone {
    border: 2px dashed var(--bk-pink-2);
    border-radius: var(--bk-radius);
    background: var(--bk-cream);
    padding: 2rem 1rem; text-align: center;
    cursor: pointer; transition: background .2s, border-color .2s;
}
.dropzone:hover, .dropzone.dragover { background: #fbe4ea; border-color: var(--bk-pink-dark); }
[data-bs-theme="dark"] .dropzone:hover, [data-bs-theme="dark"] .dropzone.dragover { background: #45272f; }

.upload-thumb {
    width: 110px; height: 110px; object-fit: cover;
    border-radius: 12px; border: 1px solid var(--bk-border);
}
.thumb-wrap { position: relative; display: inline-block; }
.thumb-del {
    position: absolute; top: -8px; right: -8px;
    width: 24px; height: 24px; border-radius: 50%;
    background: #dc3545; color: #fff; border: none;
    font-size: .7rem; line-height: 1;
}

/* -------------------------------------------------------------- signature */
.signature-canvas {
    border: 2px dashed var(--bk-border);
    border-radius: var(--bk-radius);
    background: #fff;
    width: 100%; height: 220px; touch-action: none;
}

/* --------------------------------------------------------------- loading */
.loading-overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(253, 246, 238, .7); backdrop-filter: blur(2px);
    display: none; align-items: center; justify-content: center;
}
[data-bs-theme="dark"] .loading-overlay { background: rgba(28, 21, 16, .7); }
.loading-overlay.show { display: flex; }
.cupcake-loader { font-size: 3rem; animation: bounce 0.9s infinite alternate ease-in-out; }
@keyframes bounce { from { transform: translateY(0) } to { transform: translateY(-18px) } }

/* ---------------------------------------------------------------- login */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #fdf6ee 0%, #f7e0d0 50%, #fbe4ea 100%);
    padding: 1rem;
}
.login-card {
    max-width: 420px; width: 100%;
    border-radius: 22px; border: none;
    box-shadow: 0 20px 60px rgba(93, 58, 35, .18);
    overflow: hidden;
}
.login-hero {
    background: linear-gradient(135deg, var(--bk-brown) 0%, var(--bk-brown-2) 100%);
    color: #fff; text-align: center; padding: 2rem 1.5rem 1.6rem;
}
.login-hero .logo { font-size: 2.8rem; }

/* --------------------------------------------------------------- misc */
.page-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 0; }
.breadcrumb-item + .breadcrumb-item::before { color: var(--bk-muted); }
.dropdown-menu { border-radius: 12px; border-color: var(--bk-border); }
.modal-content { border-radius: var(--bk-radius); border: none; }
.modal-header { border-bottom: 1px solid var(--bk-border); }
/* When a <form> wraps header/body/footer inside a scrollable modal, it breaks
   Bootstrap's flex layout: the body no longer scrolls and the footer (Save
   button) is pushed off-screen — e.g. product modal once the image preview
   appears. Making the form the flex column restores the behavior. */
.modal-dialog-scrollable .modal-content > form {
    display: flex;
    flex-direction: column;
    max-height: 100%;
    overflow: hidden;
}
.modal-dialog-scrollable .modal-content > form .modal-body {
    overflow-y: auto;
}
.nav-tabs .nav-link.active { color: var(--bk-pink-dark); font-weight: 600; }
.nav-tabs .nav-link { color: var(--bk-muted); }

.progress-thin { height: 8px; border-radius: 6px; }
.progress-thin .progress-bar { background: linear-gradient(90deg, var(--bk-pink-2), var(--bk-pink-dark)); }

.product-thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 10px; }
.img-preview-lg { max-width: 100%; max-height: 200px; border-radius: 12px; }

@media (max-width: 575.98px) {
    .page-content { padding: 1rem; }
    .stat-card .stat-value { font-size: 1.25rem; }
}

/* ---------------------------------------------------------------- print */
@media print {
    .no-print { display: none !important; }
    body { background: #fff !important; }
}
