/* =========================================
   M&N STORE APP DASHBOARD V2
========================================= */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #eef7f2;
    color: #062f1b;
}

.store-app-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    min-height: 100vh;
}

/* SIDEBAR */

.store-sidebar {
    background: linear-gradient(180deg, #004622, #002f18);
    padding: 34px 22px;
    color: white;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.store-branding {
    text-align: center;
    background: #009a4d;
    padding: 32px 20px;
    border-radius: 28px;
    margin-bottom: 28px;
}

.store-branding img {
    width: 110px;
    height: 110px;
    object-fit: contain;
    background: white;
    padding: 12px;
    border-radius: 22px;
}

.store-branding h2 {
    font-size: 28px;
    margin: 22px 0 10px;
}

.store-branding p {
    margin: 0;
    font-size: 15px;
}

.store-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.store-sidebar-nav>a {
    display: block;
    text-decoration: none;
    color: white;
    font-weight: 800;
    background: rgba(255, 255, 255, 0.10);
    padding: 18px 20px;
    border-radius: 18px;
    transition: 0.25s ease;
}

.store-sidebar-nav>a:hover {
    background: #00b85c;
    transform: translateX(4px);
}

.store-sidebar-cta {
    margin-top: 30px;
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    color: #064e3b;
    padding: 22px;
    border-radius: 24px;
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.18);
}

.store-sidebar-cta span {
    font-weight: 800;
    font-size: 14px;
}

.store-sidebar-cta strong {
    display: block;
    font-size: 20px;
    margin: 12px 0;
}

.store-sidebar-cta p {
    font-size: 14px;
    line-height: 1.5;
}

.store-sidebar-cta a {
    display: block;
    text-align: center;
    text-decoration: none;
    background: #009a4d;
    color: white;
    font-weight: 900;
    padding: 14px;
    border-radius: 999px;
    margin-top: 16px;
}

/* MAIN */

.store-main-content {
    padding: 56px 48px;
    background:
        radial-gradient(circle at top left, rgba(0, 180, 90, 0.12), transparent 34%),
        #f3fbf7;
}

/* TOPBAR */

.store-topbar {
    display: grid;
    grid-template-columns: 1fr auto 320px;
    gap: 28px;
    align-items: start;
    margin-bottom: 30px;
}

.store-topbar-left h1 {
    font-size: clamp(34px, 4vw, 52px);
    line-height: 1.05;
    margin: 0 0 16px;
    color: #004622;
}

.store-topbar-left p {
    margin: 0;
    color: #475569;
    font-size: 16px;
    line-height: 1.6;
}

/* HERO ACTIONS */

.store-hero-actions {
    display: flex;
    gap: 16px;
    justify-content: flex-end;
    align-items: flex-start;
    flex-wrap: wrap;
    padding-top: 18px;
}

.store-hero-main-btn,
.store-hero-secondary-btn {
    text-decoration: none;
    border-radius: 999px;
    padding: 17px 28px;
    font-weight: 900;
    font-size: 15px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.store-hero-main-btn {
    background: linear-gradient(135deg, #007f3d, #00c96b);
    color: white;
    box-shadow: 0 16px 34px rgba(0, 128, 70, 0.24);
}

.store-hero-secondary-btn {
    background: white;
    color: #005f2f;
    border: 1px solid rgba(0, 95, 47, 0.14);
    box-shadow: 0 12px 28px rgba(0, 95, 47, 0.08);
}

/* ACCOUNT CARD */

.store-account-card {
    background: white;
    border-radius: 24px;
    padding: 26px;
    width: 320px;
    min-height: 230px;
    box-shadow: 0 18px 40px rgba(0, 95, 47, 0.10);
    border: 1px solid rgba(0, 95, 47, 0.08);
}

.store-account-card strong {
    display: block;
    font-size: 22px;
    color: #008a45;
    margin-bottom: 18px;
}

.store-account-card p {
    margin: 14px 0;
    color: #1f2937;
    font-size: 15px;
}

/* QUICK STATS — 4 COMPACT CARDS */

.store-quick-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 18px;
    margin: 26px 0 34px;
}

.quick-stat-card {
    background: white;
    border-radius: 22px;
    padding: 18px;
    min-height: 118px;
    border: 1px solid rgba(0, 95, 47, 0.08);
    box-shadow: 0 12px 28px rgba(0, 95, 47, 0.08);
    display: flex;
    align-items: center;
    gap: 14px;
}

.quick-stat-card span {
    width: 48px;
    height: 48px;
    min-width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: linear-gradient(135deg, #007f3d, #00b85c);
    color: white;
    font-size: 22px;
}

.quick-stat-card strong {
    display: block;
    font-size: 30px;
    font-weight: 900;
    color: #005f2f;
    line-height: 1;
    margin-bottom: 6px;
}

.quick-stat-card p {
    margin: 0;
    font-size: 13px;
    font-weight: 800;
    color: #475569;
    line-height: 1.35;
}

/* DASHBOARD GRID — 5 CARDS IN 1 ROW */

.store-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(140px, 1fr));
    gap: 18px;
    margin-top: 24px;
}

.store-dashboard-card {
    text-decoration: none;
    color: #064e3b;
    background: white;
    border-radius: 22px;
    padding: 20px;
    min-height: 150px;
    border-top: 5px solid #00b85c;
    box-shadow: 0 14px 32px rgba(0, 95, 47, 0.08);
    transition: 0.25s ease;
}

.store-dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 18px 40px rgba(0, 95, 47, 0.13);
}

.store-dashboard-card span {
    font-size: 30px;
    display: block;
    margin-bottom: 14px;
}

.store-dashboard-card h3 {
    margin: 0 0 10px;
    font-size: 18px;
    color: #005f2f;
}

.store-dashboard-card p {
    margin: 0;
    color: #475569;
    font-size: 13px;
    line-height: 1.45;
}

/* FOOTER */

.store-app-footer {
    margin-top: 42px;
    padding: 24px 0 0;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    border-top: 1px solid rgba(0, 95, 47, 0.12);
    color: #475569;
    font-size: 14px;
}

.store-app-footer strong {
    color: #005f2f;
}

.store-app-footer a {
    color: #005f2f;
    font-weight: 800;
    text-decoration: none;
    margin-left: 16px;
}

/* RESPONSIVE */

@media (max-width: 1300px) {
    .store-topbar {
        grid-template-columns: 1fr;
    }

    .store-hero-actions {
        justify-content: flex-start;
        padding-top: 0;
    }

    .store-account-card {
        width: 100%;
    }

    .store-dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1000px) {
    .store-app-layout {
        grid-template-columns: 1fr;
    }

    .store-sidebar {
        position: relative;
        height: auto;
    }

    .store-main-content {
        padding: 32px 20px;
    }

    .store-quick-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .store-dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .store-app-footer {
        flex-direction: column;
    }

    .store-app-footer a {
        margin-left: 0;
        margin-right: 14px;
    }
}

@media (max-width: 640px) {

    .store-quick-stats,
    .store-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .store-hero-main-btn,
    .store-hero-secondary-btn {
        width: 100%;
    }
}

/* =========================================
   INVOICE MODAL FIX
========================================= */

.invoice-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.invoice-box {
    width: 100%;
    max-width: 950px;
    max-height: 95vh;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 24px;
    padding: 32px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.20);
}

.invoice-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    border: none;
    background: #f1f5f9;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 30px;
}

.invoice-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.invoice-details-grid div {
    background: #f8fafc;
    padding: 18px;
    border-radius: 16px;
}

.invoice-details-grid small {
    display: block;
    color: #64748b;
    margin-bottom: 8px;
}

.invoice-items-section {
    margin-top: 20px;
}

.invoice-total-box {
    margin-top: 30px;
    background: #ecfdf5;
    padding: 24px;
    border-radius: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 20px;
    font-weight: 700;
}

.invoice-actions {
    margin-top: 30px;
    display: flex;
    justify-content: flex-end;
}

/* =========================================
   PRINT INVOICE ONLY
========================================= */

@media print {

    body * {
        visibility: hidden;
    }

    #invoiceModal,
    #invoiceModal * {
        visibility: visible;
    }

    #invoiceModal {
        position: absolute;
        inset: 0;
        background: white;
        padding: 0;
        margin: 0;
    }

    .invoice-box {
        width: 100%;
        max-width: 100%;
        box-shadow: none;
        border-radius: 0;
        padding: 20px;
    }

    .invoice-close-btn,
    .invoice-actions {
        display: none !important;
    }

    .store-sidebar,
    .store-topbar,
    .store-section-card {
        display: none !important;
    }

    table {
        width: 100%;
        border-collapse: collapse;
    }

    table th,
    table td {
        border: 1px solid #ccc;
        padding: 10px;
    }
}