@font-face {
    font-family: 'Vazir';
    src: url('../fonts/Vazir.ttf') format('truetype');
}

:root {
    --primary-color: #2c7be5;
    --primary-light: #e8f0fe;
    --secondary-color: #27ae60;
    --secondary-light: #e8f5e9;
    --accent-color: #3498db;
    --text-color: #2c3e50;
    --light-text: #7f8c8d;
    --border-color: #e0e0e0;
    --background-color: #e3f1ff;
    --card-background: #f7f7f7;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Vazir', Tahoma, Arial, sans-serif;
    margin: 0;
    padding: 0;
    direction: rtl;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* استایل جدید برای صفحه لاگین */
body.login-page {
    background-image: url('../images/backgrounds/dna-background.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    position: relative;
}

body.login-page::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-color);
    opacity: 0.7;
    z-index: 0;
}

h1, h2 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-weight: 600;
}

h1 {
    font-size: 2.2rem;
    margin-top: 1.5rem;
}

h2 {
    font-size: 1.8rem;
    margin-top: 2rem;
}

/* Header styles for consistency */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: var(--card-background);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    border-radius: 0 0 8px 8px;
}

/* Logo and title in center */
.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 2;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.logo-link:hover {
    opacity: 0.9;
}

.header-logo {
    height: 45px;
    margin-left: 15px;
    border-radius: 5px;
}

.header h1 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.8rem;
    text-align: center;
}

/* Quick access button on right */
.quick-access-container {
    display: flex;
    justify-content: flex-start;
    flex: 1;
}

#quickAccessBtn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

#quickAccessBtn:hover {
    background-color: #1a68d1;
}

#quickAccessBtn i {
    margin-left: 6px;
}

/* User info and exit button on left */
.user-info {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
    flex-direction: row;
    flex-wrap: nowrap;
}

.user-details {
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    margin-left: 10px;
}

.exit-btn {
    background-color: var(--primary-color) !important;
    color: white !important;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    margin-right: 5px;
    white-space: nowrap;
}

.exit-btn:hover {
    background-color: #1a68d1 !important;
}

.exit-btn i {
    margin-left: 6px;
}

/* Header bottom row for mobile */
.header-bottom-row {
    display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
    }
    
    /* Hide desktop elements in mobile */
    .quick-access-container:not(.header-bottom-row .quick-access-container),
    .user-info:not(.header-bottom-row .user-info) {
        display: none;
    }
    
    .logo-container {
        width: 100%;
        justify-content: center;
        margin-bottom: 0;
    }
    
    /* Show and style mobile bottom row */
    .header-bottom-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        gap: 1rem;
    }
    
    .header-bottom-row .quick-access-container,
    .header-bottom-row .user-info {
        width: auto;
        justify-content: flex-start;
    }
    
    .header-bottom-row .user-info {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: flex-end;
        gap: 0.5rem;
    }
    
    .header h1 {
        font-size: 1.3rem;
        margin: 0.5rem 0;
    }
    
    #quickAccessBtn span, .exit-btn span {
        font-size: 0.8rem;
    }
    
    .user-details {
        font-size: 0.8rem;
        max-width: 60%;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Hide mobile elements in desktop */
@media (min-width: 769px) {
    .header-bottom-row {
        display: none;
    }
}

.header-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.header-buttons button {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    font-size: 0.85rem;
    background-color: var(--primary-color);
    color: var(--primary-light);
    border: none;
    border-radius: 4px;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-buttons button:hover {
    background-color: #1a68d1;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header-buttons button i {
    margin-left: 6px;
}

.table-container {
    overflow-x: auto;
    max-width: 100%;
    margin: 0.75rem auto;
    background-color: var(--card-background);
    border-radius: 8px;
    /* box-shadow: var(--shadow); */
    padding: 1rem;
}

table {
    width: 100%;
    min-width: 4000px;
    border-collapse: separate;
    border-spacing: 0;
    background-color: var(--card-background);
}

/* Add minimum height to table body for consistency */
#patientsBody {
    min-height: 500px; /* Height for approximately 10 rows */
}

/* Fixed row height to calculate total height properly */
#patientsBody tr {
    height: 45px; /* Standard height for each row */
}

/* Empty row style for filling space */
#patientsBody tr.empty-row td {
    border: none;
    background-color: transparent;
}

th, td {
    border: 1px solid var(--border-color);
    padding: 2px 15px;
    text-align: center;
    white-space: nowrap;
}

th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 500;
    position: sticky;
    top: 0;
    z-index: 10;
}

td {
    background-color: var(--card-background);
    transition: var(--transition);
}

tr:hover td {
    background-color: var(--primary-light);
}

input[type="text"], input[type="password"], select {
    padding: 10px 12px;
    margin: 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: 'Vazir', Tahoma, sans-serif;
    width: 100%;
    box-sizing: border-box;
    transition: var(--transition);
}

input[type="text"]:focus, input[type="password"]:focus, select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
    outline: none;
}

.filter-input {
    padding: 8px 10px;
    margin: 0;
    font-size: 0.9rem;
    border-radius: 4px;
}

button {
    padding: 10px 18px;
    margin: 5px;
    cursor: pointer;
    border: none;
    border-radius: 6px;
    background-color: var(--primary-color);
    color: white;
    font-family: 'Vazir', Tahoma, sans-serif;
    font-weight: 500;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

button:hover {
    background-color: #1a68d1;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.actions {
    margin: 2rem auto;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

#pagination {
    text-align: center;
    margin: 1rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

#pagination button {
    min-width: 100px;
}

#pageInfo {
    font-size: 0.9rem;
    color: var(--light-text);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--card-background);
    margin: 5% auto;
    padding: 2rem;
    border-radius: 8px;
    width: 80%;
    max-width: 800px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.close {
    position: absolute;
    top: 15px;
    left: 20px;
    color: var(--light-text);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.close:hover,
.close:focus {
    color: var(--text-color);
    text-decoration: none;
}

#addTable input {
    padding: 10px;
    border-radius: 6px;
}

.login-container, .account-container {
    max-width: 560px;
    width: 90%;
    margin: 50px auto;
    padding: 2rem;
    background-color: var(--card-background);
    box-shadow: var(--shadow);
    border-radius: 8px;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    backdrop-filter: blur(5px);
    position: relative;
    z-index: 1;
}

.login-container form, .account-container form {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.login-container label, .account-container label {
    margin: 0 0 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.account-container p {
    margin: 1rem 0;
    color: var(--light-text);
}

/* استایل دکمه لاگین */
.login-container form button[type="submit"] {
    width: auto;
    min-width: 120px;
    margin: 0 auto;
}

/* Specific styles for login input fields */
.login-container input[type="text"], 
.login-container input[type="password"] {
    width: calc(100% - 20px);
    margin: 0 auto;
}

/* استایل لوگوی مؤسسه */
.institute-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}

.institute-logo img {
    max-width: 100%;
    height: auto;
    max-height: 150px;
}

/* استایل های مربوط به پیام ها */
.flash-message {
    text-align: center;
    padding: 1rem;
    margin: 1rem 0;
    background-color: #f8f9fa;
    border-radius: 6px;
    border-right: 4px solid var(--primary-color);
}

.flash-message.error {
    color: #e74c3c;
    background-color: #fde8e8;
    border-right: 4px solid #e74c3c;
}

.flash-message.success {
    color: #27ae60;
    background-color: #e8f5e9;
    border-right: 4px solid #27ae60;
}

.users-table {
    min-width: unset;
    width: 100%;
}

/* Excel Upload Zone Styles */
.excel-upload-zone {
    border: 2px dashed var(--primary-color);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    background-color: var(--primary-light);
    transition: var(--transition);
    cursor: pointer;
    margin-bottom: 1.5rem;
    position: relative;
    width: 300px;
    margin: 0 auto 1.5rem;
}

.excel-upload-zone.drag-over {
    border-color: var(--secondary-color);
    background-color: var(--secondary-light);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.excel-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
}

.upload-text {
    font-size: 1rem;
    color: var(--text-color);
    margin: 0;
    font-weight: 500;
}

.upload-hint {
    font-size: 0.9rem;
    color: var(--light-text);
    margin: 0;
}

.selected-file-name {
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin: 0.5rem 0;
    font-weight: 500;
}

.file-input {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-btn {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    min-width: 150px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.upload-btn:hover {
    background-color: #219653;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.upload-btn i {
    font-size: 1.1rem;
}

/* Input Grid Styles */
.input-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.input-field {
    width: 100%;
}

.input-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    transition: var(--transition);
}

.input-field input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
    outline: none;
}

/* Section Styles */
.section-container {
    background-color: var(--card-background);
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin: 2rem auto;
    padding: 1.5rem;
    max-width: 1400px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.section-header h2 i {
    margin-left: 0.5rem;
    color: var(--accent-color);
}

/* Search Styles */
.search-container {
    position: relative;
    width: auto;
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    justify-content: space-between;
    align-items: center;
}

.global-search-wrapper {
    position: relative;
    flex-grow: 1;
    width: 200px;
}

.search-container input {
    width: 100%;
    padding: 10px 12px 10px 35px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--light-text);
    pointer-events: none;
}

/* Barcode Button */
.barcode-btn {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    white-space: nowrap;
    /* order: -1; */ /*uncomment to make it always be the first in a row */
}

.barcode-btn:hover {
    background-color: #219653;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.barcode-btn i {
    font-size: 1rem;
}

/* Form Actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Form action buttons with higher specificity */
button.cancel-btn {
    background-color: #e74c3c;
}

button.cancel-btn:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

button.save-btn {
    background-color: var(--secondary-color);
}

button.save-btn:hover {
    background-color: #219653;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

/* Footer */
.footer {
    text-align: center;
    padding: 0.5rem;
    background-color: var(--card-background);
    color: var(--light-text);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-color);
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: auto;
}

/* Remove the fixed positioning and main-content padding */
.main-content {
    padding-bottom: 0;
}

/* استایل دکمه‌های عملیات انتخاب بیماران */
.selection-actions {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-start;
    align-items: center;
    margin: 0.5rem;
    gap: 0.75rem;
    background-color: var(--card-background);
    padding: 0.75rem;
    border-radius: 8px;
    box-shadow: none;
}

.selection-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.selection-btn:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.selection-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
    pointer-events: none;
}

.selection-btn i {
    font-size: 0.9rem;
}

/* Specific button styles with higher specificity selectors */
button.selection-btn.delete-btn {
    background-color: #e74c3c;
}

button.selection-btn.delete-btn:hover:not(:disabled) {
    background-color: #c0392b; /* Darker red */
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

/* Add specific rule to ensure disabled delete button is gray */
button.selection-btn.delete-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

/* Clear Filters Button Styles */
button.selection-btn.clear-filters-btn {
    background-color: #3498db;
}

button.selection-btn.clear-filters-btn:hover {
    background-color: #2980b9; /* Darker blue */
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

/* Add specific rule to ensure disabled clear filters button is gray, just like other disabled buttons */
button.selection-btn.clear-filters-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
    /* Override any hover styles when disabled */
    pointer-events: none;
}

button.selection-btn.generate-btn {
    background-color: var(--secondary-color);
}

button.selection-btn.generate-btn:hover:not(:disabled) {
    background-color: #219653; /* Darker green */
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

/* Add specific rule to ensure disabled generate button is gray */
button.selection-btn.generate-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

.selection-counter {
    margin: 0 auto;
    padding: 0.6rem 1rem;
    background-color: var(--primary-light);
    color: var(--text-color);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* استایل برای ردیف‌های انتخاب شده */
tr.selected td {
    background-color: var(--primary-light);
}

/* Barcode Scanner Styles */
#quagga-scanner {
    position: relative;
    border: 3px dashed var(--secondary-color);
    border-radius: 8px;
    background-color: rgba(39, 174, 96, 0.1);
    margin-top: 1rem;
    margin-bottom: 1rem;
}

#quagga-scanner .drawingBuffer {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scanner-guide {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 4px;
    background-color: rgba(255, 0, 0, 0.7);
    z-index: 1000;
}

.scanner-message {
    margin: 1rem 0;
    font-size: 1rem;
    color: var(--text-color);
}

.scanner-error {
    color: #e74c3c;
    margin: 1rem 0;
    font-size: 0.9rem;
}

/* Specific styles for barcode scanner modal */
.barcode-scanner-modal .modal-content {
    max-height: 90vh;
    overflow-y: auto;
}

/* Mobile styles for the barcode scanner modal */
@media (max-width: 768px) {
    .barcode-scanner-modal .modal-content {
        width: 92%;
        padding: 0.75rem;
        margin: 10% auto;
        max-height: 80vh;
    }
    
    #quagga-scanner {
        border-width: 2px;
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    .scanner-message {
        margin: 0.5rem 0;
        font-size: 0.9rem;
    }
    
    .scanner-guide {
        height: 3px;
    }
}

/* All mobile styles are now consolidated in the main @media query above */

/* Dashboard Styles */
.dashboard-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.dashboard-stats {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    width: 100%;
    justify-content: center;
}

.stat-card {
    background-color: var(--card-background);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    width: 200px;
    text-align: center;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.stat-card .icon {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.stat-card .number {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.stat-card .label {
    font-size: 0.9rem;
    color: var(--light-text);
}

.dashboard-menu {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    width: 100%;
    margin-top: 2rem;
    justify-items: center;
}

.menu-card {
    background-color: var(--card-background);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 2rem;
    text-align: center;
    transition: var(--transition);
    color: var(--text-color);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    width: 100%;
    max-width: 300px;
}

.menu-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.1);
}

.menu-card .icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background-color: var(--primary-light);
    border-radius: 50%;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.menu-card:nth-child(1) .icon {
    color: #2c7be5; /* Blue */
    background-color: rgba(44, 123, 229, 0.1);
}

.menu-card:nth-child(2) .icon {
    color: #27ae60; /* Green */
    background-color: rgba(39, 174, 96, 0.1);
}

.menu-card:nth-child(3) .icon {
    color: #f39c12; /* Orange */
    background-color: rgba(243, 156, 18, 0.1);
}

.menu-card:nth-child(4) .icon {
    color: #8e44ad; /* Purple */
    background-color: rgba(142, 68, 173, 0.1);
}

.menu-card:nth-child(5) .icon {
    color: #e74c3c; /* Red */
    background-color: rgba(231, 76, 60, 0.1);
}

.menu-card .title {
    font-size: 1.4rem;
    font-weight: bold;
    margin-bottom: 0.8rem;
}

.menu-card .description {
    font-size: 0.9rem;
    color: var(--light-text);
}

.last-update {
    margin-top: 2rem;
    text-align: center;
    color: var(--light-text);
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .dashboard-stats {
        flex-direction: column;
        align-items: center;
    }
    
    .stat-card {
        width: 80%;
    }
    
    .dashboard-menu {
        grid-template-columns: 1fr;
    }
}

/* Backup button styles */
.backup-btn {
    background-color: #3498db;
    text-decoration: none !important;
}

.backup-btn:hover:not(:disabled) {
    background-color: #2980b9;
    text-decoration: none !important;
}

/* Selection actions container */
.selection-actions {
    flex-wrap: wrap;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .selection-btn span {
        display: none;
    }
    
    .selection-btn {
        padding: 8px;
    }
}

/* Mobile adjustments for login container */
@media (max-width: 768px) {
    .login-container, .account-container {
        min-height: 450px;
        margin: 30px auto;
    }
}

/* Empty table message styling */
.empty-table-message {
    text-align: right;
    padding: 30px 20px;
}

.no-data-message {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    color: #495057;
    font-size: 16px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    display: inline-block;
    max-width: 80%;
}

.no-data-message i {
    color: #17a2b8;
    margin-left: 8px;
    font-size: 18px;
}

/* Style for empty rows */
tr.empty-row td {
    height: 41px; /* Match the height of data rows */
    background-color: #ffffff;
    border-bottom: 1px solid #e9ecef;
}

/* Toast Notification Styles */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
}

.toast {
    min-width: 250px;
    margin-top: 10px;
    background-color: #333;
    color: white;
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s, fadeOut 0.5s 3.5s forwards;
    direction: rtl;
    text-align: right;
}

.toast.success {
    background-color: #4CAF50;
}

.toast.error {
    background-color: #f44336;
}

.toast.info {
    background-color: #2196F3;
}

.toast .close-toast {
    background: transparent;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    margin-right: 10px;
    display: inline-block;
    padding: 0 5px;
    line-height: 1;
}

@keyframes slideIn {
    from {transform: translateX(100%); opacity: 0;}
    to {transform: translateX(0); opacity: 1;}
}

@keyframes fadeOut {
    from {opacity: 1;}
    to {opacity: 0; display: none;}
}

/* Landscape mode for mobile devices */
@media (max-width: 1320px) and (orientation: landscape) {
    .dashboard-menu {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
        margin-top: 1rem;
    }
    
    .menu-card {
        padding: 1rem;
        max-width: 220px;
    }
    
    .menu-card .icon {
        font-size: 2rem;
        margin-bottom: 0.8rem;
        padding: 0.8rem;
        width: 50px;
        height: 50px;
    }
    
    .menu-card .title {
        font-size: 1rem;
        margin-bottom: 0.4rem;
    }
    
    .menu-card .description {
        font-size: 0.75rem;
    }
    
    /* Make header text smaller in landscape mode */
    .header h1 {
        font-size: 20px;
        white-space: nowrap;
    }
}

/* Label Generator Modal Styles */
.radio-options {
    display: flex;
    flex-direction: column;
    margin: 15px 0;
    text-align: right;
}

.radio-container {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    cursor: pointer;
}

.radio-container input[type="radio"] {
    margin-left: 10px;
}

.radio-label {
    font-size: 0.95rem;
}

.warning-message {
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 5px;
    padding: 10px;
    margin: 10px 0;
}

.warning-message p {
    color: #856404;
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Labels Preview Modal Styles */
.labels-preview-content {
    max-width: 800px;
    width: 90%;
}

#labelsPreviewContainer {
    margin: 20px 0;
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    padding: 10px;
    background-color: #fff;
}

/* Label Styles */
.label-sheet {
    width: 210mm; /* A4 width */
    margin: 0 auto;
    background: white;
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap;
    page-break-after: always;
}

.patient-label {
    width: 3cm;
    height: 0.5cm;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    font-family: 'Vazir', sans-serif;
    border: 1px dashed #ddd;
}

.label-section {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 7pt;
    border-left: 1px solid #000;
    overflow: hidden;
    text-align: center;
}

.label-section:first-child {
    border-left: none;
}

.barcode-section {
    width: 33%;
}

.file-number-section {
    width: 33%;
}

.sequence-section {
    width: 33%;
}

/* Styles for print mode */
@media print {
    body * {
        visibility: hidden;
    }
    
    #labelsPrintPage, #labelsPrintPage * {
        visibility: visible;
    }
    
    #labelsPrintPage {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
    
    .label-sheet {
        box-shadow: none;
        margin: 0;
    }
    
    .patient-label {
        break-inside: avoid;
        border: none;
    }
    
    @page {
        size: A4;
        margin: 0;
    }
}

/* Barcode Scanner Modal Styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgb(0,0,0); /* Fallback color */
    background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}

.barcode-modal-content { /* Renamed and adjusted for barcode scanner */
    background-color: #fefefe;
    margin: 10% auto; /* Adjusted margin */
    padding: 15px;
    border: 1px solid #888;
    width: 60%; /* Made smaller */
    max-width: 400px; /* Max width */
    border-radius: 8px;
    text-align: center;
    overflow: hidden; /* Prevent content from overflowing */
}

.barcode-modal-header { /* New style for modal header */
    display: flex;
    justify-content: space-between; /* Puts title and close button on opposite ends */
    align-items: baseline; /* Vertically aligns them */
    margin-bottom: 15px; /* Space below the header */
}

.barcode-modal-header h2 {
    margin: 0; /* Remove default h2 margin */
    font-size: 1.5rem; /* Adjust font size as needed */
    text-align: right; /* Ensure title is right-aligned if it was centered before */
}

.barcode-modal-content #barcodeVideo { /* Ensure video fits */
    width: 90%; /* Responsive width */
    max-width: 300px; /* Max width for video */
    height: auto;
    border-radius: 5px; /* Slightly smaller border radius */
    margin-bottom: 10px;
}

.barcode-modal-content p {
    margin-bottom: 15px;
}

.barcode-modal-actions { /* New style for button container */
    display: flex;
    justify-content: center; /* Center buttons */
    gap: 10px; /* Space between buttons */
    margin-top: 15px; /* Space above the buttons */
}

.barcode-modal-actions button { /* Style for buttons inside the new container */
    width: auto; /* Make buttons not full-width */
    padding: 8px 15px; /* Adjust padding as needed */
    margin-top: 0; /* Remove previous margin-top if any */
}

.close-btn { /* Kept original close button style name for now */
    color: #aaa;
    /* float: right; */ /* Removed float, positioning now handled by flex container */
    font-size: 28px;
    font-weight: bold;
    /* Add some padding or margin if needed for spacing from edge */
    padding: 0 5px; /* Example padding */
}

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

.patient-arch-table-messages {
    text-align: right;
    color: var(--light-text);
    padding: 10px;
}

.patient-arch-table-messages-link {
    color: var(--primary-color);
}