/* =========================
   GLOBAL
========================= */

body {
    font-family: Arial, Helvetica, sans-serif;
    margin: 0;
    background: #f5f5f5;
    color: #222;
}

h2 {
    font-size: 26px;
    margin: 0 0 10px 0;
}

h3 {
    margin: 0;
}

/* =========================
   TOPBAR
========================= */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 30px;
    background: #fff;
    border-bottom: 1px solid #ddd;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-img {
    height: 24px;
}

.topbar-buttons {
    display: flex;
    gap: 16px;
    align-items: center;
}

/* =========================
   LANGUAGE
========================= */

.lang-toggle {
    font-size: 13px;
}

.lang-toggle a {
    text-decoration: none;
    font-weight: bold;
    color: #000;
}

.active-lang {
    text-decoration: underline;
}

/* =========================
   BUTTONS
========================= */

.btn-primary,
.btn-secondary {
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 14px;
    text-decoration: none;
}

.btn-primary {
    background: #000;
    color: #fff;
}

.btn-secondary {
    background: #888;
    color: #fff;
}

/* =========================
   PAGE LAYOUT
========================= */

.page-container {
    padding: 20px 30px;
    max-width: 1200px;
    margin: 0 auto;
}

/* =========================
   MONTH NAV
========================= */

.month-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    width: 100%;
}

.month-nav a {
    text-decoration: none;
    font-size: 18px;
    font-weight: bold;
    color: #000;
}

.month-nav .disabled {
    opacity: 0.3;
}

/* =========================
   BOXES (SHARED STYLE)
========================= */

.summary-box,
.records-box {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 10px;
    border: 1px solid #eee;
    overflow: hidden;
    min-height: 0;
}

#records-container {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.summary-box {
    height: 35vh;
    margin-bottom: 10px;
}

.records-box {
    height: 50vh;
}

/* =========================
   HEADERS
========================= */

.summary-header {
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.records-header {
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* records header layout */
.records-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* =========================
   SEARCH
========================= */

.search-box {
    display: flex;
    align-items: center;
}

.search-box input {
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid #ccc;
    font-size: 13px;
    width: 200px;
}

.search-box input:focus {
    outline: none;
    border-color: #000;
}

/* =========================
   TABLE WRAPPERS (MATCHED)
========================= */

.summary-table-wrapper,
.records-table-wrapper {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 0;
    padding-bottom: 15px;
}

.records-table-wrapper table,
.summary-table-wrapper table {
    min-width: 900px;
}

/* =========================
   TABLES
========================= */

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

thead th {
    padding: 10px 12px;
    font-size: 13px;
    background: #f7f7f7;
    border-bottom: 1px solid #ddd;
    text-align: left;
}

tbody td {
    padding: 8px 12px;
    font-size: 13px;
    border-bottom: 1px solid #eee;
}

tbody tr:hover {
    background: #f9f9f9;
}

.add-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.add-table {
    table-layout: fixed;
    min-width: 1100px;
}

.add-table th,
.add-table td {
    white-space: normal;
}

.add-table input,
.add-table select {
    min-width: 0;
}

/* sticky headers (both tables) */
.summary-table-wrapper thead th,
.records-table-wrapper thead th {
    position: sticky;
    top: 0;
    background: #f7f7f7;
    z-index: 2;
}

/* =========================
   SORTABLE HEADERS
========================= */

th a.sortable {
    text-decoration: none;
    color: #222;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

th a.sortable:hover {
    opacity: 0.7;
}

.arrow {
    font-size: 10px;
    opacity: 0.6;
}

/* =========================
   DELETE BUTTON
========================= */

.delete-btn {
    text-decoration: none;
    font-size: 14px;
    opacity: 0.6;
}

.delete-btn:hover {
    opacity: 1;
    transform: scale(1.2);
}

/* =========================
   SCROLLBAR
========================= */

.records-table-wrapper::-webkit-scrollbar,
.summary-table-wrapper::-webkit-scrollbar {
    width: 8px;
}

.records-table-wrapper::-webkit-scrollbar-thumb,
.summary-table-wrapper::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

/* =========================
   NUMBER ALIGNMENT
========================= */

td:nth-child(2),
td:nth-child(3),
td:nth-child(8),
td:nth-child(9) {
    text-align: right;
}

/* =========================
   ALIGN NUMERIC COLUMNS
========================= */

/* Summary table (Retail + Cost) */
.summary-table-wrapper th:nth-child(2),
.summary-table-wrapper th:nth-child(3) {
    text-align: right;
}

/* Records table (Retail + Cost columns) */
.records-table-wrapper th:nth-child(8),
.records-table-wrapper th:nth-child(9) {
    text-align: right;
}

/* =========================
   FORMS (SHARED)
========================= */

.form-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

input,
select {
    font-family: inherit;
    width: 100%;
    padding: 8px 10px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

input:focus,
select:focus {
    outline: none;
    border-color: #000;
}

/* =========================
   ADD PAGE TABLE
========================= */

.add-table {
    table-layout: fixed;
}

.add-table th:nth-child(1),
.add-table td:nth-child(1) { width: 20%; }   /* Reason */

.add-table th:nth-child(2),
.add-table td:nth-child(2) { width: 8%; }    /* PLU */

.add-table th:nth-child(3),
.add-table td:nth-child(3) { width: 20%; }   /* Product */

.add-table th:nth-child(4),
.add-table td:nth-child(4) { width: 8%; }    /* Qty */

.add-table th:nth-child(5),
.add-table td:nth-child(5) { width: 12%; }   /* Staff */

.add-table th:nth-child(6),
.add-table td:nth-child(6) { width: 12%; }   /* Received Staff ID */

.add-table th:nth-child(7),
.add-table td:nth-child(7) { width: 20%; }   /* Notes */

/* =========================
   LOGIN
========================= */

.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    height: calc(100vh - 80px);
}

.login-box {
    width: 360px;
    padding: 30px;
    background: #fff;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
    border-radius: 8px;
    text-align: center;
}

.login-box h1 {
    font-size: 24px;
    margin-bottom: 25px;
}

.form-group {
    margin-bottom: 15px;
}

/* =========================
   CHANGE PASSWORD
========================= */

.change-password-form {
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 20px;
    row-gap: 18px;
    max-width: 600px;
    margin-top: 20px;
}

.form-row {
    display: contents;
}

.form-row label {
    font-weight: bold;
    text-align: right;
    white-space: nowrap;
    font-size: 14px;
}

.form-row input {
    max-width: 320px;
}