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

:root {
    --dark: #2B2825;
    --light: #887E68;
    --cream: #F4F0E9;
    --light-text: #D6D2CC;
    --banner: #E6DAB5;
    --white: #FFFFFF;
    --border: #D6D2CC;
    --light-surface: #FAF9F7;
}

/* ---------- Base ---------- */

* {
    box-sizing: border-box;
}

html {
    font-family: 'Montserrat', sans-serif;
}

body {
    margin: 0;
    background: var(--cream);
    color: var(--dark);
    font-family: 'Montserrat', sans-serif;
    line-height: 1.5;
}

/* ---------- Typography ---------- */

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Quicksand', sans-serif;
    color: var(--dark);
    font-weight: 700;
}

h1 {
    margin-top: 0;
}

p {
    margin-top: 0;
}

/* ---------- Links ---------- */

a {
    color: var(--dark);
}

a:hover {
    color: var(--light);
}

/* ---------- Header ---------- */

header {
    background: var(--dark);
    color: var(--cream);
    padding: 20px 40px;
}

header h1 {
    margin: 0;
    color: var(--cream);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.logo {
    display: block;
    width: 180px;
    height: auto;
}

/* ---------- Main content ---------- */

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px;
}

/* ---------- Banner ---------- */

.banner {
    background: var(--banner);
    color: var(--dark);
    padding: 18px 24px;
    border-radius: 8px;
    margin-bottom: 25px;
}

.banner h1,
.banner h2,
.banner h3 {
    color: var(--dark);
    margin-top: 0;
}

/* ---------- Cards ---------- */

.card {
    background: var(--white);
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 25px;
}

.card h2 {
    margin-top: 0;
    font-size: 18px;
}

/* ---------- Buttons ---------- */

button,
.button {
    display: inline-block;
    padding: 10px 16px;
    background: var(--light);
    color: var(--cream);
    border: none;
    border-radius: 5px;
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

button:hover,
.button:hover {
    background: var(--dark);
    color: var(--cream);
}

/* ---------- Forms ---------- */

label {
    display: block;
    margin-bottom: 7px;
    font-weight: 600;
}

input,
select,
textarea {
    padding: 9px 10px;
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--white);
    color: var(--dark);
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--light);
    outline-offset: 1px;
}

/* ---------- Tables ---------- */

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
}

th,
td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--banner);
    color: var(--dark);
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
}

tr:nth-child(even) {
    background: var(--light-surface);
}

tr:hover {
    background: #ECE7DB;
}

.table-container {
    max-height: 75vh;
    overflow-y: auto;
    border: 1px solid var(--border);
}

/* ---------- Dashboard ---------- */

.welcome {
    margin-bottom: 30px;
}

.stats,
.cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.number {
    font-size: 32px;
    font-weight: 700;
    margin: 10px 0 0;
}

/* ---------- Actions ---------- */

.actions {
    margin-top: 30px;
}

.actions a {
    margin-right: 10px;
}

/* ---------- Utility ---------- */

.text-muted {
    color: var(--light);
}

.text-light {
    color: var(--light-text);
}

/* ---------- Mobile ---------- */

@media (max-width: 800px) {

    main {
        padding: 20px;
    }

    header {
        padding: 20px;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .logo {
        width: 150px;
    }

    .stats,
    .cards {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 14px;
    }

    th,
    td {
        padding: 8px;
    }
}
/* =========================================================
   SHARED SITE LAYOUT
   ========================================================= */

.site-header {
    background: var(--light);
    color: var(--cream);
    min-height: 72px;
    padding: 14px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
}

.site-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.site-logo img {
    display: block;
    width: 180px;
    height: auto;
    max-height: 60px;
    object-fit: contain;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 24px;
}

.site-nav a {
    color: var(--dark);
    text-decoration: none;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 14px;
}

.site-nav a:hover {
    color: var(--banner);
}

.site-main {
    width: min(1200px, calc(100% - 48px));
    margin: 0 auto;
    padding: 40px 0;
    box-sizing: border-box;
}

@media (max-width: 700px) {

    .site-header {
        padding: 14px 20px;
        flex-direction: column;
        gap: 16px;
    }

    .site-logo img {
        width: 150px;
    }

    .site-nav {
        gap: 16px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .site-main {
        width: min(100% - 32px, 1200px);
        padding: 28px 0;
    }

}
/* =========================================================
   AUTHENTICATION
   ========================================================= */

   .auth-page {
    min-height: calc(100vh - 160px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    width: min(100%, 440px);
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-sizing: border-box;
    box-shadow: 0 4px 18px rgba(43, 40, 37, 0.08);
}

.auth-card h1 {
    margin: 0 0 10px;
    font-family: 'Quicksand', sans-serif;
    color: var(--dark);
    font-size: 32px;
}

.auth-subtitle {
    margin: 0 0 30px;
    color: var(--light);
    font-size: 15px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-form label {
    font-weight: 600;
    font-size: 14px;
    margin-top: 8px;
}

.auth-form input {
    width: 100%;
    padding: 12px 14px;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: white;
    color: var(--dark);
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
}

.auth-form input:focus {
    outline: 2px solid var(--banner);
    outline-offset: 1px;
}

.auth-form button {
    margin-top: 16px;
    padding: 13px 18px;
    border: none;
    border-radius: 6px;
    background: var(--light);
    color: white;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
}

.auth-form button:hover {
    background: var(--dark);
}
/* =========================================================
   SEARCH PAGE
   ========================================================= */

.search-page {
    width: 100%;
}

.page-heading {
    margin-bottom: 25px;
}

.page-heading h1 {
    margin: 0 0 8px;
}

.page-heading p {
    margin: 0;
    color: var(--light);
}

.search-form {
    display: flex;
    gap: 10px;
    margin-bottom: 35px;
}

.search-form input {
    width: min(420px, 100%);
    padding: 12px 14px;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--white);
    color: var(--dark);
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
}

.search-form input:focus {
    outline: 2px solid var(--banner);
    outline-offset: 1px;
}

.search-form button {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    background: var(--light);
    color: white;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    cursor: pointer;
}

.search-form button:hover {
    background: var(--dark);
}

.results-heading {
    margin-bottom: 15px;
}

.results-heading h2 {
    margin: 0 0 5px;
}

.results-heading p {
    margin: 0;
    color: var(--light);
    font-size: 14px;
}

.table-container {
    width: 100%;
    max-height: 70vh;
    overflow: auto;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
}

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

.table-container th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--banner);
    color: var(--dark);
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    white-space: nowrap;
}

.table-container th,
.table-container td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table-container tbody tr:nth-child(even) {
    background: #faf9f6;
}

.table-container tbody tr:hover {
    background: #eee9df;
}

.table-container td a {
    color: var(--dark);
    font-weight: 600;
    text-decoration: none;
}

.table-container td a:hover {
    text-decoration: underline;
}

.table-container .price {
    font-weight: 700;
    white-space: nowrap;
}

@media (max-width: 800px) {

    .search-form {
        flex-direction: column;
    }

    .search-form input {
        width: 100%;
    }

    .search-form button {
        width: fit-content;
    }

}

/* Keep tariff month on one line */

.table-container th:nth-child(6),
.table-container td:nth-child(6) {
    white-space: nowrap;
}
.medicine-row {
    cursor: pointer;
}

.medicine-row:hover {
    background: #E6DAB5;
}
.chart-container {
    position: relative;
    height: 400px;
    margin-bottom: 30px;
}

/* =========================================================
   MEDICINE PAGE
   ========================================================= */

   .medicine-page {
    width: 100%;
}

.medicine-heading {
    margin-bottom: 35px;
}

.back-link {
    display: inline-block;
    margin-bottom: 18px;
    color: var(--light);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.back-link:hover {
    color: var(--dark);
    text-decoration: underline;
}

.medicine-heading h1 {
    margin: 0 0 15px;
}

.medicine-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.medicine-meta span {
    display: inline-block;
    padding: 7px 12px;
    background: var(--banner);
    color: var(--dark);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
}


/* =========================================================
   PRICE SUMMARY
   ========================================================= */

.price-summary {
    margin-bottom: 40px;
}

.price-summary h2,
.price-history h2 {
    margin-bottom: 18px;
}

.price-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.price-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 22px;
}

.price-label {
    display: block;
    margin-bottom: 10px;
    color: var(--light);
    font-size: 14px;
    font-weight: 600;
}

.price-card strong {
    display: block;
    color: var(--dark);
    font-family: 'Quicksand', sans-serif;
    font-size: 28px;
}

.price-card .percentage {
    display: block;
    margin-top: 6px;
    color: var(--light);
    font-size: 14px;
}

.no-comparison {
    color: var(--light);
}


/* =========================================================
   PRICE HISTORY
   ========================================================= */

.price-history {
    margin-bottom: 40px;
}

.price-history .table-container {
    max-height: 500px;
}

.price-history table {
    width: 100%;
    border-collapse: collapse;
}

.price-history th {
    background: var(--banner);
    color: var(--dark);
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
}

.price-history th,
.price-history td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.pack-colour {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.price-history .price {
    font-weight: 700;
    white-space: nowrap;
}


/* =========================================================
   MEDICINE PAGE — MOBILE
   ========================================================= */

@media (max-width: 800px) {

    .price-cards {
        grid-template-columns: 1fr;
    }

    .medicine-heading h1 {
        font-size: 28px;
    }

    .medicine-meta {
        flex-direction: column;
        align-items: flex-start;
    }

}
.medicine-row td:first-child {
    font-weight: 600;
}

/* =========================================================
   ADMIN PAGE
   ========================================================= */

   .admin-page {
    width: 100%;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 45px;
}

.admin-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 22px;
}

.admin-card h2 {
    margin: 0 0 12px;
    color: var(--light);
    font-family: 'Quicksand', sans-serif;
    font-size: 15px;
}

.admin-number {
    margin: 0;
    color: var(--dark);
    font-family: 'Quicksand', sans-serif;
    font-size: 30px;
    font-weight: 700;
}

.admin-section {
    margin-bottom: 45px;
}

.section-heading {
    margin-bottom: 18px;
}

.section-heading h2 {
    margin: 0;
}

.new-products-list {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.new-product {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

.new-product:last-child {
    border-bottom: none;
}

.new-product strong {
    display: block;
    margin-bottom: 8px;
}

.product-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.product-details span {
    display: inline-block;
    padding: 5px 9px;
    background: var(--banner);
    border-radius: 5px;
    color: var(--dark);
    font-size: 13px;
    font-weight: 600;
}

.muted {
    color: var(--light);
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.button {
    display: inline-block;
    padding: 12px 18px;
    border-radius: 6px;
    background: var(--light);
    color: white;
    text-decoration: none;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 600;
}

.button:hover {
    background: var(--dark);
}

.button.secondary {
    background: var(--dark);
}

.button.secondary:hover {
    background: var(--light);
}

.clients {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.client-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.client-card h3 {
    margin: 0 0 7px;
}

.client-card p {
    margin: 0;
    color: var(--light);
    font-size: 14px;
}


/* =========================================================
   ADMIN PAGE — MOBILE
   ========================================================= */

@media (max-width: 900px) {

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

}

@media (max-width: 600px) {

    .admin-stats {
        grid-template-columns: 1fr;
    }

    .client-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-actions {
        flex-direction: column;
        align-items: flex-start;
    }

}

/* =========================================================
   ADMIN UPLOAD
   ========================================================= */

   .admin-upload-page {
    width: 100%;
}

.upload-card {
    max-width: 700px;
    margin-bottom: 40px;
    padding: 25px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.upload-form {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.upload-form label {
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
}

.upload-form input[type="file"] {
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--cream);
    font-family: 'Montserrat', sans-serif;
}

.upload-form input[type="file"]:focus {
    outline: 2px solid var(--banner);
    outline-offset: 1px;
}

.import-results {
    margin-bottom: 40px;
}

.import-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 35px;
}

.import-stat {
    padding: 20px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.import-stat span {
    display: block;
    margin-bottom: 8px;
    color: var(--light);
    font-size: 13px;
}

.import-stat strong {
    display: block;
    font-family: 'Quicksand', sans-serif;
    font-size: 26px;
}

.new-products-result h3 {
    margin-bottom: 15px;
}

.page-actions {
    margin-top: 20px;
}


@media (max-width: 800px) {

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

}

@media (max-width: 500px) {

    .import-stats {
        grid-template-columns: 1fr;
    }

}


/* =========================================================
   CLIENT PRICING PAGE
   ========================================================= */

   .client-pricing-page {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

.pricing-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 28px;
    margin-bottom: 25px;
    box-sizing: border-box;
}

.pricing-card h2 {
    margin: 0 0 20px;
    font-family: 'Quicksand', sans-serif;
    color: var(--dark);
}


/* Default markup form */

.pricing-form {
    display: flex;
    align-items: end;
    gap: 15px;
    flex-wrap: wrap;
}

.pricing-form label,
.override-markup label {
    display: block;
    margin-bottom: 7px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
}

.pricing-form input,
.override-markup input {
    box-sizing: border-box;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--white);
    color: var(--dark);
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
}

.pricing-form input {
    width: 150px;
}

.override-markup input {
    width: 150px;
}

.pricing-form input:focus,
.override-markup input:focus,
.medicine-search input:focus {
    outline: 2px solid var(--banner);
    outline-offset: 1px;
}


/* Buttons */

.pricing-card button {
    padding: 11px 18px;
    border: none;
    border-radius: 6px;
    background: var(--light);
    color: white;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.pricing-card button:hover {
    background: var(--dark);
}


/* Existing overrides table */

.pricing-table-container {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.pricing-table-container table {
    width: 100%;
    border-collapse: collapse;
}

.pricing-table-container th {
    background: var(--banner);
    color: var(--dark);
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
}

.pricing-table-container th,
.pricing-table-container td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.pricing-table-container tbody tr:last-child td {
    border-bottom: none;
}

.pricing-table-container tbody tr:nth-child(even) {
    background: #faf9f6;
}

.pricing-table-container tbody tr:hover {
    background: #eee9df;
}

.pricing-table-container .price {
    font-weight: 700;
    white-space: nowrap;
}


/* Medicine search */

.medicine-search {
    display: flex;
    gap: 10px;
    align-items: center;
}

.medicine-search input {
    width: min(500px, 100%);
    box-sizing: border-box;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--white);
    color: var(--dark);
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
}

.help-text {
    margin: 8px 0 18px;
    color: var(--light);
    font-size: 13px;
}


/* Medicine selection list */

.medicine-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--white);
    margin-bottom: 22px;
}

.medicine-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 14px;
    border-bottom: 1px solid #eee9df;
    cursor: pointer;
    font-weight: normal;
}

.medicine-option:last-child {
    border-bottom: none;
}

.medicine-option:hover {
    background: #faf9f6;
}

.medicine-option input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
    accent-color: var(--light);
}

.medicine-name {
    display: block;
    min-width: 0;
}

.medicine-name strong {
    display: block;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    color: var(--dark);
}

.raw-names {
    display: block;
    margin-top: 5px;
    color: var(--light);
    font-size: 13px;
    line-height: 1.5;
}

.raw-names span {
    display: block;
}


/* Override markup */

.override-markup {
    margin-bottom: 20px;
}


/* Bottom actions */

.client-pricing-actions {
    display: flex;
    gap: 20px;
    margin-top: 5px;
    margin-bottom: 30px;
}

.client-pricing-actions a {
    color: var(--dark);
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.client-pricing-actions a:hover {
    text-decoration: underline;
}


/* Mobile */

@media (max-width: 700px) {

    .pricing-card {
        padding: 20px;
    }

    .pricing-form {
        align-items: stretch;
        flex-direction: column;
    }

    .pricing-form input {
        width: 100%;
    }

    .medicine-search {
        align-items: stretch;
        flex-direction: column;
    }

    .medicine-search input {
        width: 100%;
    }

    .medicine-search button {
        width: fit-content;
    }

    .client-pricing-actions {
        flex-direction: column;
        gap: 10px;
    }

}