/* assets/css/style.css */

/* =========================================== */
/* YOUR EXISTING DESKTOP CSS (as provided)     */
/* =========================================== */
body {
    font-family: sans-serif;
    margin: 0;
    display: flex;
    min-height: 100vh;
    background-color: #f4f6f9;
}

.sidebar {
    width: 220px;
    background-color: #343a40;
    color: white;
    padding: 20px;
    box-sizing: border-box;
    flex-shrink: 0; /* Prevent sidebar from shrinking too much */
}

.sidebar h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #ffffff;
    font-size: 1.4em; /* Slightly adjust for consistency */
}

.sidebar ul {
    list-style-type: none;
    padding: 0;
}

.sidebar ul li a {
    display: block;
    color: #c2c7d0;
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 4px;
    margin-bottom: 5px;
}

.sidebar ul li a:hover,
.sidebar ul li a.active {
    background-color: #494e53;
    color: white;
}

.main-content {
    flex-grow: 1;
    padding: 20px;
    box-sizing: border-box;
    overflow-x: auto; /* For tables if they become too wide */
}

.container {
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

h1, h2, h3 { /* h2 was missing, h3 added for consistency */
    color: #333;
}
h1 { font-size: 1.8em; margin-bottom: 0.8em; }
h2 { font-size: 1.5em; margin-bottom: 0.7em; }
h3 { font-size: 1.2em; margin-bottom: 0.6em; }


table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
    white-space: nowrap; /* Prevent text wrapping in cells initially */
}

th {
    background-color: #f2f2f2;
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold; /* Good for readability */
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1em; /* Ensure consistent font size */
}

button, input[type="submit"] {
    background-color: #007bff;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em; /* Ensure consistent font size */
}

button:hover, input[type="submit"]:hover {
    background-color: #0056b3;
}

.alert {
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 4px;
}
.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}



/* === General Table and Form Styles (Ensure these match your desired look) === */

/* === General Table and Form Styles (Ensure these match your desired look) === */
.filter-form { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; align-items: flex-end; }
.filter-form .form-group { flex: 1 1 200px; margin-bottom: 0; }
.form-group label { display: block; margin-bottom: 5px; font-weight: bold; }
.form-group input[type="text"], .form-group input[type="number"], .form-group input[type="date"], .form-group select, .form-group textarea { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; font-size: 1em; }
table { width: 100%; border-collapse: collapse; margin-top: 20px; }
th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
th { background-color: #f2f2f2; font-weight: bold; }
.alert { padding: 10px; margin-bottom: 15px; border-radius: 4px; border: 1px solid transparent; }
.alert-success { background-color: #d4edda; color: #155724; border-color: #c3e6cb; }
.alert-danger { background-color: #f8d7da; color: #721c24; border-color: #f5c6cb; }
.button-delete { display: inline-block; padding: 5px 10px; background-color: #dc3545; color: white; text-decoration: none; border-radius: 4px; font-size: 0.9em; border: none; cursor: pointer; }
.button-delete:hover { background-color: #c82333; }


/* =========================================== */
/* PDA / MOBILE STYLES                         */
/* Targetting .pda-mode class and small screens*/
/* =========================================== */

/* Apply these styles if .pda-mode class is on body OR screen is small */
/* =========================================== */
/* PDA / MOBILE STYLES                         */
/* Targetting .pda-mode class and small screens*/
/* =========================================== */

/* This media query applies to screens 768px wide or less */
@media (max-width: 768px) {
    /* Styles for small screens, regardless of pda-mode class */
    body {
        display: block;
        background-color: #ffffff;
    }

    .sidebar {
        width: 100%;
        padding: 10px;
        background-color: #343a40;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        position: sticky;
        top: 0;
        z-index: 1000;
    }

    .sidebar h2 { /* Style for sidebar h2 on small screens */
        font-size: 1.2em;
        margin-bottom: 10px;
    }

    .sidebar ul {
        display: flex;
        justify-content: space-around;
        margin: 0;
    }

    .sidebar ul li {
        margin-bottom: 0;
        flex: 1;
    }

    .sidebar ul li a {
        padding: 12px 5px;
        text-align: center;
        font-size: 0.9em;
        color: #f0f0f0;
    }
    .sidebar ul li a.active,
    .sidebar ul li a:hover {
        background-color: #007bff;
        color: white;
    }

    .main-content {
        padding: 10px;
        overflow-x: visible;
    }

    .container {
        padding: 15px;
        box-shadow: none;
        border-radius: 0;
    }

    h1 { font-size: 1.5em; }
    h2 { font-size: 1.3em; }
    h3 { font-size: 1.1em; }

    .form-group input[type="text"],
    .form-group input[type="number"],
    .form-group input[type="date"],
    .form-group select,
    .form-group textarea {
        padding: 12px;
        font-size: 1em;
    }

    button, input[type="submit"] {
        width: 100%;
        padding: 12px 15px;
        font-size: 1.1em;
    }

    table {
        display: block;
        overflow-x: auto;
        font-size: 0.9em;
        border: 0;
    }

    th, td {
        padding: 8px 6px;
    }
    th {
        background-color: #e9ecef;
    }

    .filter-form {
        flex-direction: column;
        gap: 15px;
    }
    .filter-form .form-group {
        width: 100%;
        flex-basis: auto;
    }
    .filter-form button[type="submit"], .filter-form a {
        width: 100%;
    }

    .alert {
        font-size: 0.95em;
    }
} /* End of @media (max-width: 768px) */


/* Styles that apply ONLY when body has the .pda-mode class,
   regardless of screen size (can be overridden by the above @media query if screen is also small)
   OR can be combined using a comma if the effect is identical to small screens.
   For simplicity, if pda-mode should look EXACTLY like small screens,
   the original `@media (max-width: 768px), body.pda-mode` is fine IF THE BRACES ARE CORRECT.

   Let's try applying pda-mode styles separately to ensure no brace conflicts.
*/

body.pda-mode {
    display: block; /* Override flex for simpler stacking */
    background-color: #ffffff; /* PDA mode might not need a different bg */
}

body.pda-mode .sidebar {
    width: 100%;
    padding: 10px;
    background-color: #343a40;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

body.pda-mode .sidebar h2 {
    display: none; /* Hide "Return System" title in PDA nav bar */
}

body.pda-mode .sidebar ul {
    display: flex;
    justify-content: space-around;
    margin: 0;
}

body.pda-mode .sidebar ul li {
    margin-bottom: 0;
    flex: 1;
}

body.pda-mode .sidebar ul li a {
    padding: 12px 5px;
    text-align: center;
    font-size: 0.9em;
    color: #f0f0f0;
}
body.pda-mode .sidebar ul li a.active,
body.pda-mode .sidebar ul li a:hover {
    background-color: #007bff;
    color: white;
}

body.pda-mode .main-content {
    padding: 10px;
    overflow-x: visible;
    margin-top: 0; /* If sidebar is sticky, no extra margin needed */
}

body.pda-mode .container {
    padding: 15px;
    box-shadow: none;
    border-radius: 0;
}

body.pda-mode h1 { font-size: 1.5em; }
body.pda-mode h2 { font-size: 1.3em; }
body.pda-mode h3 { font-size: 1.1em; }

body.pda-mode .form-group input[type="text"],
body.pda-mode .form-group input[type="number"],
body.pda-mode .form-group input[type="date"],
body.pda-mode .form-group select,
body.pda-mode .form-group textarea {
    padding: 12px;
    font-size: 1em;
}

body.pda-mode button,
body.pda-mode input[type="submit"] {
    width: 100%;
    padding: 12px 15px;
    font-size: 1.1em;
}

body.pda-mode table {
    display: block;
    overflow-x: auto;
    font-size: 0.9em;
    border: 0;
}

body.pda-mode th,
body.pda-mode td {
    padding: 8px 6px;
}
body.pda-mode th {
    background-color: #e9ecef;
}

body.pda-mode .filter-form {
    flex-direction: column;
    gap: 15px;
}
body.pda-mode .filter-form .form-group {
    width: 100%;
    flex-basis: auto;
}
body.pda-mode .filter-form button[type="submit"],
body.pda-mode .filter-form a {
    width: 100%;
}

body.pda-mode .alert {
    font-size: 0.95em;
}






.dashboard-section {
    margin-bottom: 30px;
    padding: 20px;
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.filter-section { /* More specific styling for the filter area */
    background-color: #f8f9fa;
}

.dashboard-filter-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}
.dashboard-filter-form .form-group {
    flex-grow: 1;
    margin-bottom: 0; /* Remove default form-group margin */
}
.dashboard-filter-form button[type="submit"],
.dashboard-filter-form a.button {
    height: 38px; /* Match typical input height */
    line-height: normal; /* Adjust if text is not centered */
    padding-top: 0;
    padding-bottom: 0;
    display: inline-flex; /* For vertical centering of text if needed */
    align-items: center;
}
a.button-secondary { /* For "Show Today" link */
    background-color: #6c757d;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px; /* Or inherit from button styles */
    padding: 0 15px; /* Adjust horizontal padding */
}
a.button-secondary:hover {
    background-color: #5a6268;
}

.dashboard-layout {
    display: flex;
    gap: 30px; /* Increased gap */
    flex-wrap: wrap;
}
.table-container {
    flex: 1;
    min-width: 350px; /* Ensure table has enough space */
}
.chart-container {
    flex: 1;
    min-width: 350px; /* Ensure chart has enough space */
    max-width: 600px; /* Prevent chart from becoming too wide */
    /* background-color: #fdfdfd; */
    /* padding:15px; */
    /* border: 1px solid #eee; */
    /* border-radius: 4px; */
}
#dailyScansChart {
    max-height: 400px; /* Control chart height */
}


.total-scans-display {
    font-size: 1.2em;
    padding: 15px;
    background-color: #e9ecef;
    border-radius: 5px;
    text-align: center;
    margin-top: 15px;
}






/* === General Table and Form Styles === */
.filter-form { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; align-items: flex-end; }
.filter-form .form-group { flex: 1 1 200px; margin-bottom: 0; }
.form-group label { display: block; margin-bottom: 5px; font-weight: bold; }
.form-group input[type="text"], .form-group input[type="number"], .form-group input[type="date"], .form-group select, .form-group textarea { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; font-size: 1em; }
table { width: 100%; border-collapse: collapse; margin-top: 20px; }
th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
th { background-color: #f2f2f2; font-weight: bold; }
.alert { padding: 10px; margin-bottom: 15px; border-radius: 4px; border: 1px solid transparent; }
.alert-success { background-color: #d4edda; color: #155724; border-color: #c3e6cb; }
.alert-danger { background-color: #f8d7da; color: #721c24; border-color: #f5c6cb; }
.button-delete { display: inline-block; padding: 5px 10px; background-color: #dc3545; color: white; text-decoration: none; border-radius: 4px; font-size: 0.9em; border: none; cursor: pointer; }
.button-delete:hover { background-color: #c82333; }
.copy-tracking-btn { background: none; border: none; cursor: pointer; padding: 2px 5px; vertical-align: middle; }
.copy-tracking-btn svg { vertical-align: middle; }
.copy-tracking-btn.copied svg { fill: green; }


/* === Styles for Table Scrolling and Sticky Headers === */
.table-scroll-wrapper { overflow-x: auto; overflow-y: auto; max-height: 70vh; border: 1px solid #ddd; margin-top: 10px; position: relative; }
.table-scroll-wrapper table { min-width: 1200px; /* CRITICAL: Adjust! */ border-collapse: collapse; }
.table-scroll-wrapper thead th { position: -webkit-sticky; position: sticky; top: 0; background-color: #f2f2f2; color: #333; z-index: 10; border-bottom: 2px solid #ccc !important; border-left: 1px solid #ddd; border-right: 1px solid #ddd; }
.table-scroll-wrapper thead th:first-child { border-left: none; }
.table-scroll-wrapper thead th:last-child { border-right: none; }
body.pda-mode .table-scroll-wrapper thead th { /* top: 55px; */ }
.table-scroll-wrapper td, .table-scroll-wrapper th { white-space: nowrap; padding: 8px 10px; border: 1px solid #ddd; vertical-align: top; }

/* Specific Column Widths and Wrapping */
.table-scroll-wrapper th.th-sku, .table-scroll-wrapper td.td-sku { min-width: 250px; white-space: normal; }
.table-scroll-wrapper td.td-sku span { display: block; white-space: normal; word-break: break-word; }
.table-scroll-wrapper td textarea.sku-edit-textarea,
.table-scroll-wrapper td textarea.notes-edit-textarea,
.table-scroll-wrapper td textarea.date-edit-textarea { 
    width: 95%; box-sizing: border-box; font-family: inherit; font-size: inherit; line-height: 1.5; padding: 5px; border: 1px solid #999; resize: vertical; 
}
.table-scroll-wrapper td textarea.sku-edit-textarea { min-height: 100px; }
.table-scroll-wrapper td textarea.notes-edit-textarea { min-height: 60px; }
.table-scroll-wrapper td textarea.date-edit-textarea { min-height: 38px; line-height: 1.2; }


.table-scroll-wrapper th.th-notes, .table-scroll-wrapper td.td-notes { min-width: 200px; white-space: normal; }
.table-scroll-wrapper td.td-notes span { display: block; white-space: normal; word-break: break-word; }

/* Background Colors for Item Condition Cells */
.table-scroll-wrapper td.condition-damaged { background-color: #ffdddd; color: #a00; }
.table-scroll-wrapper td.condition-fo { background-color: #fff3cd; color: #664d03; }
.table-scroll-wrapper td.condition-good { background-color: #d4edda; color: #155724; }

/* === Styles for Client Autocomplete Inline Edit === */
.table-scroll-wrapper td.editable[data-field="client_id"] { position: relative; }
.autocomplete-suggestions { position: absolute; border: 1px solid #ddd; border-top: none; z-index: 10000; background-color: white; width: calc(95% - 2px); max-height: 150px; overflow-y: auto; box-shadow: 0 2px 4px rgba(0,0,0,0.1); left: 2.5%; display: none; margin-top: -1px; /* Align with bottom of input */ }
.autocomplete-suggestion-item { padding: 8px 10px; cursor: pointer; font-size: 0.9em; }
.autocomplete-suggestion-item:hover { background-color: #f0f0f0; }
.autocomplete-suggestion-item.active-suggestion { background-color: #007bff; color: white; }


/* === Custom Scrollbar Styling === */
.table-scroll-wrapper::-webkit-scrollbar { width: 10px; height: 10px; }
.table-scroll-wrapper::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 10px; }
.table-scroll-wrapper::-webkit-scrollbar-thumb { background: #888; border-radius: 10px; }
.table-scroll-wrapper::-webkit-scrollbar-thumb:hover { background: #555; }
.table-scroll-wrapper { scrollbar-width: thin; scrollbar-color: #888 #f1f1f1; }

/* === Pagination Controls Styling === */
.pagination-controls { margin-top: 20px; text-align: center; padding: 10px 0; }
.pagination-controls .pagination-link { display: inline-block; padding: 8px 12px; margin: 0 3px; border: 1px solid #ddd; color: #007bff; text-decoration: none; border-radius: 4px; transition: background-color 0.3s, color 0.3s; }
.pagination-controls .pagination-link:hover { background-color: #007bff; color: white; border-color: #007bff; }
.pagination-controls .pagination-link.active { background-color: #007bff; color: white; border-color: #007bff; font-weight: bold; }
.pagination-controls .pagination-ellipsis { display: inline-block; padding: 8px 5px; margin: 0 3px; color: #777; }
#entriesForm label { margin-right: 5px; margin-left: 5px; }
#entriesForm select { padding: 5px 8px; border-radius: 4px; border: 1px solid #ccc; }
.pagination-info { font-size: 0.9em; color: #555; }





.tracking-number-cell {
    position: relative; /* If you want to absolute position the icon */
    /* OR use flex for easier alignment */
    display: flex;
    align-items: center;
    justify-content: space-between; /* Pushes icon to the right if cell has width */
}

.tracking-number-cell span {
    flex-grow: 1; /* Allows span to take available space */
    margin-right: 5px; /* Space between text and icon */
}

.copy-tracking-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 5px; /* Adjust padding */
    margin-left: 5px; /* Space from the tracking number text */
    color: #007bff; /* Bootstrap primary blue, or your theme color */
    opacity: 0.6;
    transition: opacity 0.2s ease-in-out, color 0.2s ease-in-out;
}

.copy-tracking-btn:hover {
    opacity: 1;
    color: #0056b3; /* Darker blue on hover */
}

.copy-tracking-btn svg {
    vertical-align: middle; /* Helps align SVG nicely */
}

/* Optional: Style for feedback after copying */
.copy-tracking-btn.copied {
    color: green;
}
.copy-tracking-btn.copied svg path { /* If you want to change SVG color too */
    fill: green;
}


/* In assets/css/style.css */
.table-scroll-wrapper td textarea.date-edit-textarea {
    min-height: 40px; /* Or just 1 row if you set rows="1" in JS */
    height: auto; /* Allow it to grow slightly if content wraps in a single line */
    line-height: 1.5; /* Standard line height */
    padding: 5px;
    font-family: inherit;
    font-size: inherit;
    resize: none; /* Prevent user from resizing a date input textarea typically */
}



/* In assets/css/style.css or <style> tag in mark_attendance.php */
#attendanceTable td.editable-cell span { 
    cursor: pointer; 
    padding: 5px; /* Add some padding to make it easier to click */
    display: inline-block; /* Ensure padding applies correctly */
    min-width: 60px; /* Give some base width to empty spans */
    min-height: 20px; /* Give some base height */
    border: 1px dashed transparent; /* Show border on hover */
}
#attendanceTable td.editable-cell span:hover { 
    background-color: #f0f0f0; 
    border-color: #ccc;
}
#attendanceTable td.editable-cell.editing span {
    display: none; /* Hide span when editing */
}

#attendanceTable td.editable-cell input[type="time"],
#attendanceTable td.editable-cell select {
    display: inline-block;
    width: auto; /* Fit content */
    max-width: 130px; /* Prevent excessive width */
    padding: 4px 6px;
    font-size: 0.9em;
    margin-right: 5px; /* Space before save button */
    border: 1px solid #ccc;
    border-radius: 3px;
}
#attendanceTable td.editable-cell select {
    max-width: 150px;
}

.save-attendance-btn {
    padding: 4px 8px;
    font-size: 0.85em;
    margin-left: 5px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}
.save-attendance-btn:hover {
    background-color: #218838;
}

.time-display { /* For the span holding the time */
    min-width: 80px; 
    display: inline-block; 
}
td[data-disabled="true"] span {
    color: #999;
    cursor: not-allowed;
}
td[data-disabled="true"] span:hover {
    background-color: transparent !important;
    border-color: transparent !important;
}