/* Global Styles */
:root {
    --background-dark: #1a1a1a;
    --background-light: #333;
    --text-light: #e0e0e0;
    --text-bright: #fff;
    --highlight-color: #4caf50;
    --highlight-color-light: #ffddcc;
    --font-size-base: 12px;
    --padding-base: 10px;
    --border-radius: 5px;
    --font-family: Arial, sans-serif;
}

body {
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

/* Smaller global heading sizes */
h1 { font-size: 1.4rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
h4 { font-size: 0.95rem; }
h5 { font-size: 0.9rem; }
h6 { font-size: 0.85rem; }

header, footer {
    background: var(--background-light);
    color: var(--text-bright);
    text-align: center;
    padding: 1rem 0;
}

header nav a, footer a {
    color: var(--text-bright);
    margin: 0 10px;
    text-decoration: none;
}

header nav a:hover, footer a:hover {
    text-decoration: underline;
}

main {
    padding: 20px;
}

/* Layout Adjustments */
.container {
    display: flex;
    align-items: flex-start;
}

.navigation {
    width: 150px; /* Fixed width */
    min-width: 150px; /* Prevent shrinking */
    max-width: 150px; /* Prevent expanding */
    background: var(--background-dark);
    padding: 20px;
    border-right: 1px solid var(--background-light);
    height: 100vh;
    position: sticky;
    top: 0;
    color: var(--text-light);
    overflow-y: auto; /* Enable scrolling if content overflows */
    flex-shrink: 0; /* Prevent sidebar from shrinking */
}

.navigation h2 {
    font-size: 1.5rem;
    color: var(--text-bright);
    margin-bottom: 20px;
    text-align: center;
    font-weight: bold;
    letter-spacing: 1px;
}

.navigation nav a {
    display: block;
    margin: 10px 0;
    padding: 10px;
    color: #d4bfff;
    text-decoration: none;
    border-radius: var(--border-radius);
    font-weight: bold;
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.navigation nav a:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    color: #ffddcc;
}

.navigation nav a:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.25);
}

.content {
    flex: 3;
    padding: 20px;
}

/* Form Styles */
form {
    padding: 20px;
    background: var(--background-dark);
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    color: var(--text-light);
}
/* Mobile override for inline action forms in stock location table */
@media (max-width: 768px) {
    .content-container table .location-form {
        background: transparent !important;
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        border: none !important;
    }
    .content-container table .location-form * {
        margin: 0 !important;
    }
}

form h2 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--text-bright);
    font-size: 1.5rem;
    letter-spacing: 1px;
}

form label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    color: #d4bfff;
}

form input,
form select,
form button {
    width: calc(100% - 20px);
    padding: var(--padding-base);
    margin: 10px auto;
    border-radius: var(--border-radius);
    border: 1px solid #555;
    background: var(--background-light);
    color: var(--text-bright);
    font-size: var(--font-size-base);
    box-sizing: border-box;
}

/* Inline compact form (e.g., physio report filters) */
form.inline-form {
    background: transparent;
    box-shadow: none;
}
form.inline-form > div {
    min-width: 180px;
}
form.inline-form input,
form.inline-form select,
form.inline-form button {
    width: auto;
    margin: 0;
}
form.inline-form label {
    text-align: left;
}

form input::placeholder {
    color: #aaa;
}

form input:focus, form select:focus {
    border-color: #d4bfff;
    outline: none;
    box-shadow: 0 0 5px #d4bfff;
}

form button {
    background: var(--highlight-color);
    color: var(--text-bright);
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s ease;
}

form button:hover {
    background: #45a049;
}

form button:active {
    background: #39843c;
}

form .error {
    color: #ff6f61;
    font-size: 0.9rem;
    margin: 5px 0;
}

/* Flatpickr Styles for Date Selectors */
input#date_from, input#date_to, input#dob {
    padding: var(--padding-base);
    font-size: var(--font-size-base);
    border: 1px solid #555;
    background: var(--background-light);
    color: var(--text-bright);
    width: 100%;
    border-radius: var(--border-radius);
}

/* Flatpickr Calendar Popup */
.flatpickr-calendar {
    background: var(--background-dark);
    border-radius: var(--border-radius);
    color: var(--text-light);
}

.flatpickr-day:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-bright);
}

.flatpickr-day.selected {
    background: var(--highlight-color);
    color: var(--text-bright);
}

.flatpickr-day.today {
    background: var(--highlight-color-light);
    color: var(--text-bright);
}

.flatpickr-months {
    background: var(--background-light);
    color: var(--text-bright);
}

.flatpickr-month {
    font-weight: bold;
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    margin: 0 auto; /* Centers the table horizontally */
}

table, th, td {
    border: 1px solid #555;
}

th, td {
    padding: 10px;
    text-align: left;
    color: var(--text-light);
    white-space: nowrap; /* Prevent columns from stretching unnecessarily */
    font-size: 12px;
}

th {
    background-color: #444;
}

tr:nth-child(even) {
    background-color: #2a2a2a;
}

tr:nth-child(odd) {
    background-color: #5c5b5b;
}

tr:hover {
    background-color: #999999;
}

/* Patient list row background colors */
.status-consultation {
    background-color: rgb(172, 33, 33) !important;
    color: white;
}

.status-payment {
    background-color: rgb(124, 124, 8) !important;
    color: black;
}

.status-complete {
    background-color: rgb(3, 99, 3) !important;
    color: white;
}



/* Button Container */
.button-container {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

button {
    width: 20%;
    padding: var(--padding-base);
    border-radius: var(--border-radius);
    font-weight: bold;
    cursor: pointer;
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

button:hover {
    opacity: 0.8;
}

button:active {
    opacity: 0.6;
}

.icon-style {
    width: 20px;
    height: 20px;
    vertical-align: middle; /* Align with text if needed */
    margin: 0 5px;          /* Add spacing */
    cursor: pointer;        /* Show a pointer on hover */
}

textarea {
    width: 100%; /* Makes it take the full width of the form */
    height: 40px; /* Adjust height for more space */
    padding: 8px; /* Adds padding for better readability */
    border: 1px solid #ccc; /* Adds a light border */
    border-radius: 4px; /* Slightly rounded corners */
    resize: vertical; /* Allows resizing vertically only */
    font-size: 12px; /* Ensures readable font size */
    font-family: inherit; /* Matches the font of the surrounding form */
    box-sizing: border-box; /* Prevents padding from affecting width */
}

/* Hide the modal by default */
.modal {
    display: none; 
    position: fixed;
    z-index: 1; /* On top of other content */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4); /* Semi-transparent black background */
}

/* Modal Content Box */
.modal-content {
    background-color: #fefefe;
    margin: 15% auto; /* Center the modal vertically and horizontally */
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px; /* Limit max width */
    border-radius: 8px;
}

/* Close Button */
.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.menu {
    border: 1px solid #ccc;
    padding: 10px;
    border-radius: 5px;
    background-color: #f9f9f9;
}

.menu-toggle {
    display: block;
    margin: 4px 0;
    padding: 6px;
    color: #d4bfff;
    text-decoration: none;
    border-radius: var(--border-radius);
    font-weight: bold;
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.menu-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    color: #ffddcc;
}

.menu-content {
    padding: 5px 10px;
    border: 1px solid #ccc;
    margin-bottom: 10px;
    border-radius: 5px;
    background-color: #ffffff;
}

.menu-content ul {
    list-style-type: none;
    padding: 0;
}

.menu-content ul li {
    margin: 5px 0;
}

.menu-content ul li a {
    text-decoration: none;
    color: #000000;
}

.menu-content ul li a:hover {
    text-decoration: underline;
}

/* Previous Notes Styling */
.menu-content a {
    text-decoration: none;
    color: #ffffff; /* Default text color */
    padding: 5px 10px;
    display: block;
    border-radius: 5px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.menu-content a.inactive-date:hover {
    background-color: #3b3b3b; /* Hover background color for inactive dates */
    color: #ffffff; /* Hover text color for inactive dates */
}

.menu-content a.active-date {
    background-color: #4caf50; /* Active date background color */
    color: #ffffff; /* Active date text color */
    font-weight: bold; /* Emphasize active date */
}


/* Specific styles for Add Stock and Add SKU buttons */
.btn-success.mx-2, .btn-secondary.mx-2 {
    padding: 5px 10px; /* Adjust padding for smaller size */
    font-size: 12px;   /* Adjust font size */
    width: auto;       /* Ensure width is not fixed */
    border-radius: 4px; /* Optional: smaller rounded corners */
}

.form-container {
    display: flex; /* Arrange the forms side by side */
    justify-content: space-between; /* Add space between the sections */
    align-items: flex-start; /* Align sections to the top */
    gap: 20px; /* Space between the two forms */
    width: 80%; /* Make the container fill 80% of the page width */
    margin: 20px auto; /* Center the container horizontally and add vertical spacing */
}

.form-section {
    flex: 1; /* Allow each section to take up equal width */
    background: var(--background-light); /* Optional: Add a background for distinction */
    padding: 20px; /* Add padding inside each section */
    border-radius: var(--border-radius); /* Rounded corners */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3); /* Optional: Add a subtle shadow */
    display: flex;
    flex-direction: column; /* Stack form elements vertically */
    gap: 15px; /* Space between elements inside each section */
}

form {
    flex: 1; /* Make each form take up equal space */
    display: flex;
    flex-direction: column; /* Stack form elements vertically */
    gap: 10px; /* Space between form elements (label, input, button) */
}

.form-group {
    display: flex;
    flex-direction: column; /* Stack the label and input vertically */
    gap: 10px; /* Space between label and input */
    width: 100%; /* Ensure full width within the form */
}

button.complete-button {
    background-color: #4caf50; /* Default green color */
    color: #fff;
    border: none;
    border-radius: 5px;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

button.complete-button:hover {
    background-color: #45a049; /* Hover color */
    transform: scale(1.05);    /* Slightly enlarge on hover */
    cursor: pointer;
}

button.complete-button:active {
    background-color: #39843c; /* Active color */
    transform: scale(0.95);    /* Slightly shrink on click */
}

/* Red button styles for reopen consultation */
.btn-danger, button.btn-danger {
    background-color: #dc3545 !important;
    color: #fff !important;
    border: none;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.btn-danger:hover, button.btn-danger:hover {
    background-color: #c82333 !important;
    color: #fff !important;
    transform: scale(1.05);
    cursor: pointer;
}

.btn-danger:active, button.btn-danger:active {
    background-color: #bd2130 !important;
    transform: scale(0.95);
}

/* Disabled section styling */
.disabled-section {
    background-color: #f8f9fa !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 5px;
    padding: 20px;
    text-align: center;
    opacity: 0.8;
}

.disabled-section h6 {
    color: #6c757d !important;
    margin-bottom: 10px;
    font-weight: bold;
}

.disabled-section p {
    color: #6c757d !important;
    font-size: 14px;
    margin: 0;
}

/* Warning message styling for editvisit */
.warning-message {
    background-color: #fff3cd !important;
    border: 1px solid #ffeaa7 !important;
    border-radius: 5px;
    padding: 15px;
    margin: 20px auto;
    max-width: 500px;
}

.warning-message h4 {
    color: #856404 !important;
    margin-top: 0;
}

.warning-message p, .warning-message li {
    color: #856404 !important;
}

.warning-message ul {
    margin-bottom: 15px;
}

.warning-message .btn {
    margin-right: 10px;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: bold;
}

.warning-message .btn-primary {
    background-color: #007bff;
    color: white;
}

.warning-message .btn-secondary {
    background-color: #6c757d;
    color: white;
}

/* Scrollable Table Container */
.table-container {
    width: 85vw; /* Use full viewport width */
    max-width: 85vw; /* Ensure no artificial limit */
    height: 1000px; /* Fixed height to allow scrolling */
    overflow-y: auto; /* Vertical scrolling */
    overflow-x: auto; /* Horizontal scrolling if needed */
    border: 1px solid #ddd; /* Optional: Adds border */
    display: block; /* Required to enable scrolling */
    margin: 0 auto; /* Center the table */
}

/* Ensure the table does not exceed the container */
.table-container table {
    width: 100%; /* Ensure table does not exceed container */
    border-collapse: collapse;
}

/* Sticky Table Header */
.table-container thead tr {
    position: sticky;
    top: 0;
    background-color: white;
    z-index: 2;
}

/* Keep existing table styles */
.table th, .table td {
    text-align: center;
    vertical-align: middle;
    font-size: 12px;
    min-width: 100px; /* Ensures columns don’t shrink */
    height: 60px;
}

.table th {
    background-color: #444;
    color: white; /* Ensures text is readable */
}

.table td {
    min-width: 100px;
    height: 60px;
}

/* Appointment Styling */
.appointment {
    padding: 5px;
    border-radius: 5px;
    font-size: 12px;
}

/* Style clickable appointment cells */
.appointment-cell {
    display: block;
    width: 100%;
    height: 100%;
    text-align: center;
    text-decoration: none;
    color: rgb(255, 255, 255);
}

/* Empty appointment slot styling */
.add-appointment {
    font-size: 20px;
    font-weight: bold;
    color: gray;
}
.add-appointment:hover {
    color: rgb(0, 0, 0);
}

.pending {
    color: grey;
    opacity: 0.5;
}

.confirmed {
    color: rgb(0, 241, 0);
}

.cancelled {
    color: red;
    opacity: 0.2;
}

.arrived {
    color: white;
}

#medication-search:focus {
    border-color: #2E8B57; /* Darker green on focus */
    outline: none;
    box-shadow: 2px 2px 10px rgba(46, 139, 87, 0.3);
}

/* Unified Button Styles (Form and Sidebar) */
.btn, button, .btn-primary, .btn-secondary {
    display: inline-block;
    font-weight: bold;
    color: #fff !important;
    text-align: center;
    vertical-align: middle;
    user-select: none;
    background-color: #4caf50;
    border: none;
    padding: 0.5rem 1.2rem;
    font-size: 12px;
    border-radius: 5px;
    text-decoration: none !important;
    transition: background 0.3s, box-shadow 0.2s;
    margin-bottom: 5px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
}

.btn:hover, button:hover, .btn-primary:hover, .btn-secondary:hover,
.btn:focus, button:focus, .btn-primary:focus, .btn-secondary:focus {
    background-color: #45a049;
    color: #fff !important;
    outline: none;
    box-shadow: 0 4px 10px rgba(76,175,80,0.15);
}

.btn:active, button:active, .btn-primary:active, .btn-secondary:active {
    background: #39843c;
    color: #fff !important;
    box-shadow: 0 2px 5px rgba(76,175,80,0.10);
}

/* Disabled button styling */
.btn:disabled, button:disabled, .btn-primary:disabled, .btn-secondary:disabled {
    background-color: #6c757d !important;
    color: #fff !important;
    opacity: 0.6;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

.btn:disabled:hover, button:disabled:hover, .btn-primary:disabled:hover, .btn-secondary:disabled:hover {
    background-color: #6c757d !important;
    color: #fff !important;
    transform: none !important;
    box-shadow: none !important;
}