/* ===============================
   GLOBAL
================================= */
* {
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    background: #f8f9fa;
    color: #333;
    font-size: 14px;
    line-height: 1.5;
}

/* ===============================
   HEADER
================================= */
header {
    background: #ffffff;
    text-align: center;
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

header img {
    max-height: 90px;
}

/* ===============================
   NAVIGATION
   (Bootstrap navbar + dropdowns,
   restyled with the site's brand
   colors — pink active/hover state)
================================= */
.navbar {
    width: 100%;
    background: #ffffff;
    border-bottom: 1px solid #eee;
    padding: 8px 0;
}

.navbar .navbar-nav {
    flex-wrap: wrap;
}

.navbar .nav-link {
    color: #000;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 5px;
    transition: 0.2s;
    white-space: nowrap;
}

.navbar .nav-link:hover,
.navbar .nav-link.active,
.navbar .dropdown-toggle.active {
    background: #fb006e;
    color: #fff !important;
}

.navbar .dropdown-menu {
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    padding: 6px;
}

.navbar .dropdown-item {
    border-radius: 5px;
    font-weight: 500;
    padding: 8px 14px;
}

.navbar .dropdown-item:hover,
.navbar .dropdown-item.active {
    background: #fb006e;
    color: #fff;
}

.navbar-toggler {
    border: none;
    box-shadow: none !important;
}

/* ===============================
   TOP-OF-SCREEN WELCOME / LOGOUT
   (above the logo, right corner,
   small)
================================= */
.top-user-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 4px 12px;
    background: #fafafa;
    border-bottom: 1px solid #eee;
    font-size: 0.75rem;
}

.navbar-welcome {
    font-weight: 600;
    color: #555;
    font-size: 0.75rem;
    white-space: nowrap;
}

.navbar-welcome-emoji {
    margin: 0 1px;
}

.navbar-logout {
    color: #fff;
    background: #fb006e;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.72rem;
    padding: 3px 10px;
    border-radius: 4px;
    white-space: nowrap;
    transition: 0.2s;
}

.navbar-logout:hover {
    background: #c40058;
    color: #fff;
}

/* ===============================
   PAGE CONTENT (FULL WIDTH)
================================= */
.page-content {
    width: 100%;
    padding: 40px 30px;   /* 20px top/bottom, 10px left/right */
}

/* ===============================
   HEADINGS
================================= */
h1, h2, h3 {
    margin-bottom: 15px;
    font-weight: 600;
    color: #000;
}

/* ===============================
   BUTTONS
================================= */
.btn {
    border-radius: 8px;
    padding: 6px 16px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
}

.btn-primary {
    background: #0069d9;
    color: #fff;
    border: none;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-danger {
    background: #dc3545;
    color: #fff;
    border: none;
}

.btn-success {
    background: #28a745;
    color: #fff;
    border: none;
}

/* ===============================
   FORM ELEMENTS
================================= */
input, select, textarea {
    width: 100%;
    padding: 8px 12px;
    margin: 6px 0 14px;
    border-radius: 6px;
    border: 1px solid #ced4da;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #0069d9;
    box-shadow: 0 0 0 0.2rem rgba(0,105,217,0.25);
}

/* ===============================
   CARDS
================================= */
.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border: none;
    margin-bottom: 20px;
}

/* ===============================
   TABLES
================================= */
.table-box {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 8px;
    font-size: 13px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

th {
    background: #f3f4f6;
    cursor: pointer;
}

tr:hover {
    background: #f9fafb;
}

/* ===============================
   SALES TABLE OPTIMIZATION
================================= */
#salesTable {
    table-layout: auto;
    font-size: 0.85rem;
}

#salesTable th,
#salesTable td {
    white-space: normal;
    word-break: break-word;
    padding: 4px 6px;
}

/* ===============================
   PAGINATION
================================= */
.pagination {
    margin-top: 20px;
    text-align: center;
}

.pagination button,
.pagination .page-link {
    margin: 3px;
    padding: 6px 10px;
    border-radius: 5px;
    background: #e5e7eb;
    border: none;
    cursor: pointer;
}

.pagination .active {
    background: #2563eb;
    color: #fff;
}

/* ===============================
   KPI BOX
================================= */
.kpi {
    display: inline-block;
    background: #fff;
    padding: 12px 18px;
    border-radius: 8px;
    margin: 10px 10px 0 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    font-weight: 600;
}

/* ===============================
   PRODUCT GRID
================================= */
.product-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

.product-box {
    border: 1px solid #ddd;
    background: #fff;
    padding: 10px;
    text-align: center;
}

/* ===============================
   MODAL
   (Previously defined twice in this
   file with conflicting values — the
   second definition silently won via
   cascade. This is that same winning
   version now kept as the only one.)
================================= */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
    overflow-y: auto;
    padding: 40px 15px;
}

.modal-content {
    background: #fff;
    margin: auto;
    padding: 25px;
    width: 800px;
    max-width: 95%;
    border-radius: 10px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

/* ===============================
   SQL RUNNER
================================= */
.sql-container {
    max-width: 1000px;
    margin: 30px auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0px 2px 8px rgba(0,0,0,0.1);
}

/* ===============================
   FOOTER
================================= */
footer {
    text-align: center;
    padding: 15px;
    background: #000;
    color: #fff;
    margin-top: 40px;
}

/* ===============================
   RESPONSIVE
================================= */
@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: 1fr;
    }
}