/* Sistem Stok Digital — Toko Pakaian Yulimar */
/* Senior-Friendly Cute Edition — Ibu Yulimar (58 tahun) */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@500;600;700;800;900&display=swap');

:root {
    --pink: #e8628c;
    --pink-dark: #d4497a;
    --pink-light: #fce4ec;
    --pink-soft: #f8bbd0;
    --purple: #9c6fc4;
    --purple-light: #f3e5f5;
    --peach: #ff8a65;
    --peach-light: #fff3e0;
    --mint: #4db6ac;
    --mint-light: #e0f2f1;
    --sky: #4fc3f7;
    --sky-light: #e1f5fe;
    --coral: #ef9a9a;
    --cream: #fefaf6;
    --warm-white: #fffbf7;
    --text-dark: #3a2535;
    --text-body: #4a3347;
    --text-muted: #7a6a7a;
    --green: #43a047;
    --green-light: #e8f5e9;
    --red: #e53935;
    --red-light: #ffebee;
    --yellow: #f9a825;
    --yellow-light: #fff8e1;
    --shadow-soft: 0 4px 20px rgba(232, 98, 140, 0.1);
    --shadow-card: 0 4px 18px rgba(156, 111, 196, 0.1);
    --shadow-hover: 0 8px 30px rgba(232, 98, 140, 0.18);
    --radius: 20px;
    --radius-lg: 28px;
    --tap-min: 52px;
}

* {
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Nunito', system-ui, -apple-system, sans-serif;
    background: linear-gradient(160deg, var(--cream) 0%, #fdf2f8 50%, var(--warm-white) 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-body);
    font-size: 17px;
    font-weight: 500;
    line-height: 1.5;
}

/* ============================================ */
/* Sidebar — Desktop left, Mobile bottom bar    */
/* ============================================ */
.sidebar {
    background: linear-gradient(180deg, var(--pink) 0%, var(--purple) 100%);
    min-height: 100vh;
    padding: 0;
    position: fixed;
    width: 250px;
    z-index: 100;
    transition: all 0.3s;
    box-shadow: 4px 0 24px rgba(156, 111, 196, 0.15);
}

.sidebar .brand {
    padding: 2rem 1.25rem 1.4rem;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    text-align: center;
}

.sidebar .brand h5 {
    color: #fff;
    margin: 0;
    font-weight: 800;
    font-size: 1.2rem;
}

.sidebar .brand small {
    color: rgba(255,255,255,0.75);
    font-size: 0.8rem;
    font-weight: 600;
}

.sidebar .nav-link {
    color: rgba(255,255,255,0.85);
    padding: 0.9rem 1.25rem;
    font-size: 1rem;
    font-weight: 700;
    border-left: none;
    transition: all 0.25s ease;
    margin: 3px 10px;
    border-radius: 14px;
    min-height: var(--tap-min);
    display: flex;
    align-items: center;
}

.sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.18);
    transform: translateX(3px);
}

.sidebar .nav-link.active {
    color: var(--pink);
    background: rgba(255,255,255,0.95);
    font-weight: 800;
    box-shadow: 0 3px 14px rgba(0,0,0,0.1);
}

.sidebar .nav-link i {
    width: 28px;
    text-align: center;
    margin-right: 0.6rem;
    font-size: 1.2rem;
}

/* ============================================ */
/* Main content                                 */
/* ============================================ */
.main-content {
    margin-left: 250px;
    padding: 1.75rem 2rem;
}

/* ============================================ */
/* Stat Cards — big bold numbers                */
/* ============================================ */
.stat-card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    transition: all 0.3s ease;
    background: #fff;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.stat-card .card-body {
    padding: 1.3rem;
}

.stat-card .stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--text-dark);
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    margin-top: 2px;
}

/* Custom stat icon backgrounds */
.stat-icon.bg-primary, .stat-icon.bg-primary.bg-opacity-10 { background: var(--pink-light) !important; }
.stat-icon.text-primary { color: var(--pink) !important; }
.stat-icon.bg-success, .stat-icon.bg-success.bg-opacity-10 { background: var(--mint-light) !important; }
.stat-icon.text-success { color: var(--mint) !important; }
.stat-icon.bg-warning, .stat-icon.bg-warning.bg-opacity-10 { background: var(--peach-light) !important; }
.stat-icon.text-warning { color: var(--peach) !important; }
.stat-icon.bg-info, .stat-icon.bg-info.bg-opacity-10 { background: var(--sky-light) !important; }
.stat-icon.text-info { color: var(--sky) !important; }

/* ============================================ */
/* Alert cards                                  */
/* ============================================ */
.alert-card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    background: #fff;
}

.alert-card .card-header {
    border-radius: var(--radius) var(--radius) 0 0;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.85rem 1.1rem;
}

.alert-card .card-header.bg-success { background: linear-gradient(135deg, #66bb6a, var(--mint)) !important; }
.alert-card .card-header.bg-danger { background: linear-gradient(135deg, var(--pink), var(--coral)) !important; }
.alert-card .card-header.bg-warning { background: linear-gradient(135deg, #ffca28, var(--peach)) !important; }
.alert-card .card-header.bg-dark { background: linear-gradient(135deg, #78909c, #546e7a) !important; }
.alert-card .card-header.bg-primary { background: linear-gradient(135deg, var(--purple), var(--pink)) !important; }

/* ============================================ */
/* Tables — larger text, more padding           */
/* ============================================ */
.table-clean {
    background: #fff;
    border-radius: var(--radius);
    overflow: visible;
    box-shadow: var(--shadow-card);
}

.table-clean .table-responsive {
    border-radius: var(--radius);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-clean thead th {
    background: linear-gradient(135deg, var(--pink) 0%, var(--purple) 100%);
    color: #fff;
    font-weight: 800;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    padding: 1rem 1rem;
}

.table-clean tbody td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    font-size: 1rem;
    border-color: #fce4ec;
    font-weight: 600;
    color: var(--text-body);
}

.table-clean tbody tr {
    transition: background 0.2s;
}

.table-clean tbody tr:hover {
    background: var(--pink-light);
}

.table-clean tbody tr:nth-child(even) {
    background: var(--warm-white);
}

.table-clean tbody tr:nth-child(even):hover {
    background: var(--pink-light);
}

/* ============================================ */
/* Badges — bigger, bolder, color-coded         */
/* ============================================ */
.badge {
    border-radius: 20px !important;
    padding: 0.4em 0.9em !important;
    font-weight: 800 !important;
    font-size: 0.82rem !important;
}

.badge.bg-secondary { background: var(--purple-light) !important; color: var(--purple) !important; }

.badge-stok-aman {
    background: var(--green-light);
    color: var(--green);
    font-size: 0.85rem !important;
}
.badge-stok-rendah {
    background: var(--yellow-light);
    color: #e65100;
    font-size: 0.85rem !important;
}
.badge-stok-habis {
    background: var(--red-light);
    color: var(--red);
    font-size: 0.85rem !important;
}
.badge-stok-mati {
    background: #eceff1;
    color: #546e7a;
}
.badge-restock-segera {
    background: var(--red-light);
    color: var(--red);
    font-weight: 900 !important;
    animation: pulse-badge 2s ease-in-out infinite;
}
.badge-restock-perlu {
    background: var(--yellow-light);
    color: #e65100;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.65; }
}

/* ============================================ */
/* Page header                                  */
/* ============================================ */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h4 {
    font-weight: 900;
    color: var(--text-dark);
    margin: 0;
    font-size: 1.4rem;
}

.page-header h4 .text-primary { color: var(--pink) !important; }

.page-header p {
    color: var(--text-muted);
    margin: 0.3rem 0 0;
    font-size: 0.95rem;
    font-weight: 600;
}

/* ============================================ */
/* Forms — big inputs, easy to tap              */
/* ============================================ */
.form-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 1.75rem;
    border: none;
}

.form-control, .form-select {
    border-radius: 14px;
    border: 2.5px solid #ede0f0;
    padding: 0.8rem 1.1rem;
    font-weight: 600;
    font-size: 1.05rem;
    min-height: var(--tap-min);
    transition: all 0.25s ease;
    color: var(--text-dark);
}

.form-control:focus, .form-select:focus {
    border-color: var(--pink-soft);
    box-shadow: 0 0 0 5px rgba(232, 98, 140, 0.12);
}

.form-control::placeholder {
    color: #c4b0c4;
    font-weight: 500;
}

.form-label {
    color: var(--text-dark);
    font-weight: 800;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

/* ============================================ */
/* Buttons — large tap targets                  */
/* ============================================ */
.btn {
    border-radius: 14px;
    font-weight: 700;
    padding: 0.7rem 1.4rem;
    font-size: 1rem;
    min-height: var(--tap-min);
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--pink), var(--purple));
    border: none;
    color: #fff;
    box-shadow: 0 4px 14px rgba(232, 98, 140, 0.3);
}

.btn-primary:hover, .btn-primary:active {
    background: linear-gradient(135deg, var(--pink-dark), #8a5eb0);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(232, 98, 140, 0.4);
    color: #fff;
}

.btn-success {
    background: linear-gradient(135deg, var(--green), var(--mint));
    border: none;
    color: #fff;
    box-shadow: 0 4px 14px rgba(67, 160, 71, 0.25);
}

.btn-success:hover, .btn-success:active {
    background: linear-gradient(135deg, #388e3c, #3da89e);
    transform: translateY(-1px);
    color: #fff;
}

.btn-outline-secondary {
    border: 2.5px solid #e0d4e8;
    color: var(--purple);
    background: transparent;
    font-weight: 700;
}

.btn-outline-secondary:hover {
    background: var(--purple-light);
    border-color: var(--purple);
    color: var(--purple);
}

.btn-outline-primary {
    border: 2.5px solid var(--pink-soft);
    color: var(--pink);
}

.btn-outline-primary:hover {
    background: var(--pink-light);
    border-color: var(--pink);
    color: var(--pink);
}

.btn-sm {
    border-radius: 12px;
    padding: 0.4rem 0.9rem;
    font-size: 0.9rem;
    min-height: 42px;
}

.btn-lg, .btn-aksi {
    min-height: 58px;
    font-size: 1.15rem;
    font-weight: 800;
    padding: 0.85rem 1.8rem;
    border-radius: 16px;
}

/* Quick action buttons on dashboard */
.btn-quick {
    min-height: 70px;
    font-size: 1.1rem;
    font-weight: 800;
    border-radius: 18px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: none;
    color: #fff;
    box-shadow: var(--shadow-card);
    transition: all 0.25s ease;
}

.btn-quick:hover, .btn-quick:active {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    color: #fff;
}

.btn-quick i {
    font-size: 1.5rem;
}

.btn-quick-jual {
    background: linear-gradient(135deg, var(--green), var(--mint));
}

.btn-quick-stok {
    background: linear-gradient(135deg, var(--pink), var(--purple));
}

.btn-quick-lihat {
    background: linear-gradient(135deg, var(--sky), #7986cb);
}

/* ============================================ */
/* Filter bar                                   */
/* ============================================ */
.filter-bar {
    background: #fff;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-card);
    margin-bottom: 1.2rem;
}

/* ============================================ */
/* Chart container                              */
/* ============================================ */
.chart-container {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-card);
}

.chart-container h6 {
    color: var(--text-dark);
    font-weight: 800;
    font-size: 1rem;
}

/* ============================================ */
/* Alerts (flash messages)                      */
/* ============================================ */
.alert {
    border-radius: 16px !important;
    border: none;
    font-weight: 700;
    font-size: 1rem;
    padding: 1rem 1.25rem;
}

.alert-success {
    background: var(--green-light);
    color: var(--green);
}

.alert-danger {
    background: var(--red-light);
    color: var(--red);
}

/* ============================================ */
/* Confirmation modal                           */
/* ============================================ */
.modal-content {
    border-radius: var(--radius-lg);
    border: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

.modal-header {
    border-bottom: 2px solid var(--pink-light);
    padding: 1.25rem 1.5rem;
}

.modal-title {
    font-weight: 800;
    color: var(--text-dark);
    font-size: 1.2rem;
}

.modal-body {
    padding: 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-body);
}

.modal-footer {
    border-top: 2px solid var(--pink-light);
    padding: 1rem 1.5rem;
    gap: 0.75rem;
}

.modal-footer .btn {
    min-width: 120px;
}

/* ============================================ */
/* Product cards for mobile                     */
/* ============================================ */
.product-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 1.1rem;
    margin-bottom: 0.85rem;
    transition: all 0.2s ease;
}

.product-card:active {
    transform: scale(0.98);
}

.product-card .product-name {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--text-dark);
}

.product-card .product-code {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--purple);
}

.product-card .product-price {
    font-weight: 900;
    font-size: 1.15rem;
    color: var(--green);
}

.product-card .product-category {
    display: inline-block;
    background: var(--purple-light);
    color: var(--purple);
    font-weight: 700;
    font-size: 0.8rem;
    padding: 0.2em 0.75em;
    border-radius: 20px;
}

/* Stock item card for mobile */
.stock-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 1.1rem;
    margin-bottom: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stock-card .stock-qty {
    font-weight: 900;
    font-size: 1.6rem;
    line-height: 1;
}

.stock-card .stock-qty.stok-aman { color: var(--green); }
.stock-card .stock-qty.stok-rendah { color: var(--yellow); }
.stock-card .stock-qty.stok-habis { color: var(--red); }

/* Sale item card for mobile */
.sale-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 1.1rem;
    margin-bottom: 0.85rem;
}

.sale-card .sale-total {
    font-weight: 900;
    font-size: 1.2rem;
    color: var(--green);
}

/* ============================================ */
/* Text color overrides                         */
/* ============================================ */
.text-primary { color: var(--pink) !important; }
.text-success { color: var(--green) !important; }
.text-danger { color: var(--red) !important; }
.text-muted { color: var(--text-muted) !important; }
.fw-bold { font-weight: 700 !important; }
strong { font-weight: 800; }

/* ============================================ */
/* Scrollbar                                    */
/* ============================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--pink-light); border-radius: 10px; }
::-webkit-scrollbar-thumb { background: var(--pink-soft); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--pink); }

/* Table header overrides */
.table-light th {
    background: var(--warm-white) !important;
    color: var(--text-dark);
    font-weight: 800;
    font-size: 0.85rem;
}

.table-sm td, .table-sm th {
    padding: 0.7rem 0.75rem;
    font-size: 0.95rem;
}

.card-footer {
    background: var(--warm-white);
    border-top: 2px solid var(--pink-light);
}

.card-footer a { color: var(--pink); font-weight: 800; text-decoration: none; font-size: 1rem; }
.card-footer a:hover { color: var(--purple); }

/* Desktop: hide mobile card views */
.mobile-cards { display: none; }
.desktop-table { display: block; }

/* ============================================ */
/* MOBILE — iPhone 16+ (430px)                  */
/* ============================================ */
@media (max-width: 768px) {
    body {
        font-size: 16px;
    }

    /* Bottom nav bar */
    .sidebar {
        position: fixed;
        bottom: 0;
        top: auto;
        left: 0;
        right: 0;
        width: 100%;
        min-height: auto;
        z-index: 1000;
        border-radius: 24px 24px 0 0;
        box-shadow: 0 -4px 28px rgba(156, 111, 196, 0.22);
        background: linear-gradient(135deg, var(--pink), var(--purple));
    }
    .sidebar .brand { display: none; }
    .sidebar .mt-auto { display: none; }
    .sidebar .nav {
        display: flex;
        flex-wrap: nowrap;
        justify-content: space-around;
        padding: 0.6rem 0.5rem 0.4rem;
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
    }
    .sidebar .nav-link {
        white-space: nowrap;
        padding: 0.5rem 0.5rem;
        font-size: 0.72rem;
        text-align: center;
        border-radius: 14px;
        flex-direction: column;
        display: flex;
        align-items: center;
        gap: 3px;
        margin: 0;
        min-height: auto;
        color: rgba(255,255,255,0.8);
    }
    .sidebar .nav-link i {
        font-size: 1.45rem;
        margin-right: 0;
        display: block;
    }
    .sidebar .nav-link.active {
        background: rgba(255,255,255,0.28);
        color: #fff;
        box-shadow: none;
    }

    /* Main content */
    .main-content {
        margin-left: 0;
        padding: 1.1rem 0.9rem;
        padding-bottom: 6.5rem;
    }

    /* Page header */
    .page-header {
        margin-bottom: 1.1rem;
    }
    .page-header h4 {
        font-size: 1.25rem;
    }
    .page-header p {
        font-size: 0.88rem;
    }

    /* Stat cards */
    .stat-card {
        border-radius: 16px;
    }
    .stat-card .stat-value {
        font-size: 1.2rem;
    }
    .stat-card .stat-icon {
        width: 46px;
        height: 46px;
        font-size: 1.25rem;
        border-radius: 13px;
    }
    .stat-card .card-body {
        padding: 1rem;
    }
    .stat-card .stat-label {
        font-size: 0.72rem;
    }

    /* Quick action buttons */
    .btn-quick {
        min-height: 62px;
        font-size: 0.95rem;
        border-radius: 16px;
    }
    .btn-quick i {
        font-size: 1.35rem;
    }

    /* Filter bar */
    .filter-bar {
        padding: 0.75rem 0.85rem;
        overflow-x: auto;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch;
        border-radius: 16px;
    }
    .filter-bar .btn-sm {
        font-size: 0.82rem;
        padding: 0.35rem 0.75rem;
        flex-shrink: 0;
        min-height: 38px;
    }

    /* Show card layout, hide table */
    .mobile-cards { display: block; }
    .desktop-table { display: none; }

    /* Tables (fallback when cards not available) */
    .table-clean {
        border-radius: 16px;
    }
    .table-clean thead th {
        font-size: 0.72rem;
        padding: 0.6rem 0.45rem;
        letter-spacing: 0;
    }
    .table-clean tbody td {
        font-size: 0.88rem;
        padding: 0.6rem 0.45rem;
    }
    .table-responsive {
        border-radius: 16px;
    }

    /* Forms */
    .form-card {
        padding: 1.25rem;
        border-radius: 18px;
    }
    .form-control, .form-select {
        font-size: 1.05rem;
        min-height: 52px;
        border-radius: 12px;
    }
    .form-label {
        font-size: 1rem;
    }

    /* Buttons */
    .btn {
        border-radius: 12px;
        font-size: 1rem;
    }
    .btn-lg, .btn-aksi {
        min-height: 56px;
        font-size: 1.1rem;
        border-radius: 14px;
    }

    /* Charts */
    .chart-container {
        padding: 0.85rem;
        border-radius: 18px;
    }

    /* Alert cards */
    .alert-card {
        border-radius: 18px;
    }
    .alert-card .card-header {
        font-size: 0.88rem;
        padding: 0.75rem 1rem;
        border-radius: 18px 18px 0 0;
    }
    .table-sm td, .table-sm th {
        padding: 0.6rem 0.6rem;
        font-size: 0.9rem;
    }
}

/* ============================================ */
/* User chip in sidebar                         */
/* ============================================ */
.user-chip {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border-radius: 14px;
    padding: 0.55rem 0.85rem;
    font-weight: 700;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    line-height: 1.2;
    max-width: 100%;
}

.user-chip i {
    font-size: 1.05rem;
}

@media (max-width: 768px) {
    .user-chip { display: none; }
}

/* iPhone safe area */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .sidebar {
        padding-bottom: env(safe-area-inset-bottom);
    }
}
