:root {
--primary-color: #3498db;
--primary-hover: #2980b9;
--secondary-color: #95a5a6;
--danger-color: #e74c3c;
--warning-color: #f39c12;
--text-color: #333;
--bg-color: #f5f5f5;
--font-family-ltr: 'Arial', sans-serif;
--font-family-rtl: 'Tahoma', 'Arial', sans-serif;
--standard-gap: 15px;
--small-gap: 8px;
}

/* ===== BASE STYLES ===== */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

body {
font-family: var(--font-family-ltr);
background-color: var(--bg-color);
color: var(--text-color);
line-height: 1.6;
}

[dir="rtl"] body {
font-family: var(--font-family-rtl);
}

.container {
max-width: 1400px;
margin: 0 auto;
padding: 20px;
}

/* ===== NAVIGATION ===== */
.navbar {
display: flex;
align-items: center;
justify-content: space-between;
background-color: var(--primary-color);
padding: 12px 24px;
color: white;
flex-wrap: wrap;
}

.navbar-brand {
font-size: 1.5rem;
font-weight: bold;
color: white;
text-decoration: none;
margin-right: 30px;
}

[dir="rtl"] .navbar-brand {
margin-left: 30px;
margin-right: 0;
}

.navbar-left {
flex: 1 1 0%;
display: flex;
justify-content: center;
gap: 18px;
}

.navbar-left a,
.navbar-right a {
color: white;
text-decoration: none;
font-weight: 100;
}

.navbar-left a:hover,
.navbar-right a:hover {
text-decoration: underline;
}

.navbar-right {
display: flex;
align-items: center;
gap: var(--standard-gap);
}

.nav-user {
font-weight: bold;
}

/* Language Switcher */
.language-switcher-navbar {
display: flex;
gap: 5px;
}

.language-switcher-navbar a {
padding: 5px 12px;
background: transparent;
border-radius: 20px;
font-weight: bold;
color: white;
text-decoration: none;
border: 1px solid white;
transition: background-color 0.3s;
}

.language-switcher-navbar a.active {
background-color: #ffffff;
color: var(--primary-color);
border: 1px solid white;
}

.language-switcher-navbar a:hover {
background-color: rgba(255, 255, 255, 0.1);
}

/* ===== HEADER ===== */
header {
margin: 30px auto 20px auto;
padding: 0 20px;
max-width: 1200px;
}

header h1 {
text-align: center;
font-size: 2.2rem;
margin-bottom: 20px;
}

/* ===== DASHBOARD ===== */
.dashboard {
text-align: center;
margin-top: 50px;
padding-bottom: 30px;
}

.dashboard h2 {
font-size: 2rem;
color: #2c3e50;
margin-bottom: 10px;
}

.dashboard p {
font-size: 1.1rem;
color: #555;
}

.dashboard-cards {
display: flex;
justify-content: center;
gap: 30px;
flex-wrap: wrap;
margin-top: 40px;
}

.dashboard-card {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 200px;
min-height: 140px;
padding: 24px 12px;
background: #fff;
border-radius: 12px;
border: 1px solid #ddd;
box-shadow: 0 2px 10px rgba(0,0,0,0.08);
text-decoration: none;
color: var(--primary-color);
font-size: 1.1rem;
font-weight: 600;
transition: all 0.25s ease-in-out;
text-align: center;
}

.dashboard-card i {
font-size: 32px;
margin-bottom: 10px;
color: var(--primary-color);
}

.dashboard-card:hover {
background-color: #f0f8ff;
box-shadow: 0 6px 18px rgba(0,0,0,0.15);
transform: translateY(-2px);
}

/* ===== BUTTONS ===== */
.btn {
display: flex;
align-items: center;
gap: var(--small-gap);
padding: 10px 20px;
border-radius: 5px;
color: #fff;
font-weight: 500;
border: none;
cursor: pointer;
text-decoration: none;
font-size: 14px;
white-space: nowrap;
}

.btn-primary {
background-color: var(--primary-color);
}

.btn-primary:hover {
background-color: var(--primary-hover);
}

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

.btn-secondary:hover {
background-color: #7f8c8d;
}

.btn-danger {
background-color: var(--danger-color);
}

.btn-danger:hover {
background-color: #c0392b;
}

.btn-warning {
background-color: var(--warning-color);
}

.btn-warning:hover {
background-color: #e67e22;
}

/* Icon Buttons */
.btn-icon {
border: none;
cursor: pointer;
border-radius: 50%;
width: 32px;
height: 32px;
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0;
}

.btn-icon i {
font-size: 14px;
}

.btn-icon.btn-transfer {
background: #28a745;
color: white;
}

.btn-icon.btn-transfer:hover {
background: #218838;
}

.btn-icon.btn-transfer:disabled {
background: #6c757d;
cursor: not-allowed;
}

.btn-icon.btn-history {
background: #fd7e14;
color: white;
}

.btn-icon.btn-history:hover {
background: #e8610e;
}

.btn-icon.btn-permissions {
background: #17a2b8;
color: white;
}

.btn-icon.btn-permissions:hover {
background: #138496;
}

.btn-icon.btn-edit {
background: #ffc107;
color: #856404;
}

.btn-icon.btn-edit:hover {
background: #e0a800;
}

.btn-icon.btn-delete {
background: #dc3545;
color: white;
}

.btn-icon.btn-delete:hover {
background: #c82333;
}

.btn-icon.btn-enable {
background: #28a745;
color: white;
}

.btn-icon.btn-enable:hover {
background: #218838;
}

.btn-icon.btn-disable {
background: #6c757d;
color: white;
}

.btn-icon.btn-disable:hover {
background: #5a6268;
}

.btn-icon.btn-view {
background: #6f42c1;
color: white;
}

.btn-icon.btn-view:hover {
background: #5a32a3;
}

.btn-icon.btn-print {
background: #20c997;
color: white;
}

.btn-icon.btn-print:hover {
background: #1aa085;
}

/* ===== FORMS ===== */
.main-form,
.form-container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}

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

.form-group label {
font-weight: bold;
display: block;
margin-bottom: 5px;
text-align: left;
}

[dir="rtl"] .form-group label {
text-align: right;
}

.form-group input,
.form-group select {
width: 100%;
max-width: 1200px;
padding: 10px;
font-size: 15px;
border: 1px solid #ccc;
border-radius: 5px;
}

.form-group select[multiple] {
min-height: 120px;
padding: 8px;
}

.form-group select[multiple] option {
padding: 4px 8px;
margin: 1px 0;
}

.form-group select[multiple] option:checked {
background-color: #007bff;
color: white;
}

.form-group small {
display: block;
margin-top: 5px;
color: #666;
font-style: italic;
}

textarea {
width: 100%;
height: 150px;
padding: 12px 20px;
box-sizing: border-box;
border: 2px solid #ccc;
border-radius: 4px;
background-color: white;
font-size: 16px;
resize: none;
}

.readonly-field {
background-color: #f8f9fa !important;
cursor: not-allowed;
}

/* Form Actions */
.form-actions {
display: flex;
justify-content: center;
gap: var(--standard-gap);
flex-wrap: wrap;
}

.actions-row {
display: flex;
justify-content: space-between;
align-items: center;
gap: var(--standard-gap);
margin-bottom: 22px;
flex-wrap: wrap;
}

.actions-row .btn {
flex-shrink: 0;
}

/* Search Forms */
.search-form-inline {
display: flex;
align-items: center;
gap: 10px;
margin: 0;
}

.search-input {
min-width: 220px;
padding: 9px;
border-radius: 5px;
border: 1.5px solid #ccc;
font-size: 15px;
}

/* Filter Forms */
.filter-section {
flex: 1;
display: flex;
justify-content: flex-end;
}

.filter-form-inline {
display: flex;
align-items: center;
gap: 10px;
flex-wrap: nowrap;
margin: 0;
}

.filter-form-inline select {
min-width: 180px;
padding: 8px 12px;
border: 1px solid #ddd;
border-radius: 4px;
height: 40px;
font-size: 14px;
}

.filter-form-inline .search-input {
min-width: 200px;
padding: 8px 12px;
border: 1px solid #ddd;
border-radius: 4px;
height: 40px;
box-sizing: border-box;
font-size: 14px;
}

.filter-form-inline .btn {
height: 40px;
padding: 8px 16px;
display: flex;
align-items: center;
white-space: nowrap;
}

/* ===== MESSAGES ===== */
.message {
padding: 12px;
border-radius: 5px;
margin-bottom: 20px;
font-weight: 500;
max-width: 1150px;
margin-left: auto;
margin-right: auto;
}

.message.success {
background: #d4edda;
color: #155724;
}

.message.error {
background: #f8d7da;
color: #721c24;
}

.message.info {
background: #d1ecf1;
color: #0c5460;
}

/* ===== TABLES ===== */
.table-container {
background: white;
overflow-x: auto;
border-radius: 10px;
}

.main-table,
.doctors-table {
width: 100%;
border-collapse: collapse;
}

.main-table th,
.main-table td,
.doctors-table th,
.doctors-table td {
padding: 12px;
border-bottom: 1px solid #ddd;
text-align: center;
}

.main-table th,
.doctors-table th {
background-color: #34495e;
color: white;
}

.doctors-table th.text-center,
.doctors-table td.text-center {
text-align: center !important;
}

/* ===== BADGES ===== */
.badge {
background-color: #007bff;
color: white;
padding: 2px 8px;
border-radius: 12px;
font-size: 0.85em;
font-weight: bold;
}

.age-badge {
background-color: #e7f3ff;
color: #0056b3;
padding: 2px 8px;
border-radius: 12px;
font-size: 0.9em;
font-weight: bold;
}

.visit-type-badge {
padding: 4px 8px;
border-radius: 12px;
font-size: 0.85em;
font-weight: bold;
text-transform: uppercase;
}

.visit-type-badge.contract {
background-color: #e3f2fd;
color: #1976d2;
}

.visit-type-badge.cash {
background-color: #f3e5f5;
color: #7b1fa2;
}

/* User Management Badges */
.admin-badge {
background: #dc3545;
color: white;
padding: 2px 6px;
border-radius: 8px;
font-size: 0.7em;
margin-left: 5px;
}

.role-badge {
padding: 4px 8px;
border-radius: 12px;
font-size: 0.85em;
font-weight: bold;
text-transform: uppercase;
}

.role-badge.role-admin {
background: #dc3545;
color: white;
}

.role-badge.role-manager {
background: #ffc107;
color: #856404;
}

.role-badge.role-user {
background: #17a2b8;
color: white;
}

/* Store and Patient Badges */
.store-badge {
background: #f3e5f5;
color: #7b1fa2;
padding: 4px 8px;
border-radius: 12px;
font-size: 0.9em;
font-weight: 500;
}

.patient-badge {
background: #e8f5e8;
color: #2e7d32;
padding: 4px 8px;
border-radius: 12px;
font-size: 0.9em;
font-weight: 500;
}

/* Distribution Specific Badges */
.info-badge,
.stats-badge {
background: #f8f9fa;
border: 1px solid #dee2e6;
padding: 8px 12px;
border-radius: 6px;
color: #495057;
font-size: 0.9em;
font-weight: 500;
}

.info-badge i,
.stats-badge i {
margin-right: 5px;
color: #007bff;
}

.product-badge {
background: #e3f2fd;
color: #1976d2;
padding: 4px 8px;
border-radius: 12px;
font-size: 0.9em;
font-weight: 500;
}

.quantity-badge {
background: #f3e5f5;
color: #7b1fa2;
padding: 4px 8px;
border-radius: 12px;
font-weight: bold;
}

.receipts-count {
background: #fff3e0;
color: #e65100;
padding: 4px 8px;
border-radius: 12px;
font-size: 0.9em;
}

/* Quantity Badges */
.qty-badge {
padding: 4px 8px;
border-radius: 12px;
font-size: 0.9em;
font-weight: bold;
}

.qty-badge.original {
background: #e3f2fd;
color: #1976d2;
}

.qty-badge.current {
background: #e8f5e8;
color: #2e7d32;
}

.qty-badge.distributed {
background: #fff3e0;
color: #e65100;
}

.qty-badge.threshold-warning {
background: #fff3cd !important;
color: #856404 !important;
border: 2px solid #ffc107;
}

/* Threshold Badges */
.threshold-badge {
background: #ffc107;
color: #856404;
padding: 4px 8px;
border-radius: 12px;
font-size: 0.9em;
font-weight: bold;
}

.no-threshold {
color: #6c757d;
font-style: italic;
font-size: 0.9em;
}

.threshold-icon {
margin-left: 5px;
color: #ff6b35;
font-size: 0.8em;
}

/* Status Badges */
.status,
.status-badge {
padding: 4px 8px;
border-radius: 4px;
font-size: 0.8em;
font-weight: 500;
text-transform: uppercase;
}

.status.available,
.status-badge.available {
background: #d4edda;
color: #155724;
}

.status.warning,
.status-badge.warning {
background: #fff3cd;
color: #856404;
}

.status.expired,
.status-badge.expired {
background: #f8d7da;
color: #721c24;
}

.status.depleted {
background: #f8d7da;
color: #721c24;
}

.status.below-threshold {
background: #fff3cd;
color: #856404;
}

/* ===== EXPIRY HANDLING ===== */
.expiry-cell,
.expiry-info {
display: flex;
flex-direction: column;
align-items: center;
}

.expiry-date {
font-weight: 500;
margin-bottom: 2px;
}

.expiry-note,
.days-info {
font-size: 0.8em;
}

.expiry-note.expired,
.days-info.expired {
color: #dc3545;
font-weight: bold;
}

.expiry-note.warning,
.days-info.warning {
color: #fd7e14;
font-weight: bold;
}

.expiry-note.normal,
.days-info.normal {
color: #28a745;
}

.no-expiry {
color: #6c757d;
font-style: italic;
}

/* ===== ROW HIGHLIGHTING ===== */
.row-expired,
.expired-item {
background-color: #f8d7da !important;
}

.row-below-threshold {
background-color: #fff3cd !important;
}

.row-warning,
.warning-item {
background-color: #fff8e1 !important;
}

/* ===== UTILITY CLASSES ===== */
.info-stats {
display: flex;
align-items: center;
}

.item-description {
display: block;
font-size: 0.85em;
color: #6c757d;
margin-top: 3px;
text-align: center;
}

.no-results {
text-align: center;
padding: 60px 20px;
color: #666;
}

.no-results i {
font-size: 3em;
margin-bottom: 20px;
color: #ccc;
}

.no-results h3 {
margin-bottom: 10px;
color: #333;
}

/* ===== PAGINATION ===== */
.pagination {
display: flex;
justify-content: center;
align-items: center;
gap: 10px;
margin: 20px 0;
flex-wrap: wrap;
}

.pagination .btn {
display: inline-flex !important;
align-items: center;
justify-content: center;
min-width: 40px;
height: 40px;
padding: 8px 12px;
flex-shrink: 0;
border-radius: 5px;
color: #fff;
font-weight: 500;
border: none;
cursor: pointer;
text-decoration: none;
font-size: 14px;
white-space: nowrap;
}

.pagination .btn-primary {
background-color: var(--primary-color);
}

.pagination .btn-primary:hover {
background-color: var(--primary-hover);
}

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

.pagination .btn-secondary:hover {
background-color: #7f8c8d;
}

/* ===== MODALS ===== */
.modal {
display: none;
position: fixed;
z-index: 1000;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,0.5);
}

.modal-content {
background-color: #fefefe;
margin: 5% auto;
padding: 0;
border-radius: 8px;
width: 90%;
max-width: 500px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px;
border-bottom: 1px solid #dee2e6;
background: #f8f9fa;
border-radius: 8px 8px 0 0;
}

.modal-header h3 {
margin: 0;
color: #495057;
}

.close {
color: #aaa;
font-size: 28px;
font-weight: bold;
cursor: pointer;
line-height: 1;
}

.close:hover {
color: #000;
}

.modal form {
padding: 20px;
}

.modal-actions {
display: flex;
gap: 10px;
justify-content: flex-end;
margin-top: 20px;
padding-top: 20px;
border-top: 1px solid #dee2e6;
}

/* ===== USER MANAGEMENT ===== */
.permissions-grid {
display: grid;
gap: 15px;
margin-bottom: 30px;
}

.permission-row {
display: flex;
justify-content: space-between;
align-items: center;
padding: 15px;
background: #f8f9fa;
border-radius: 6px;
border: 1px solid #dee2e6;
}

.module-info {
display: flex;
align-items: center;
gap: 10px;
flex: 1;
}

.module-info i {
width: 20px;
color: #495057;
}

.permission-options select {
min-width: 200px;
padding: 8px 12px;
border: 1px solid #ced4da;
border-radius: 4px;
}

/* ===== LOGIN FORM ===== */
.login-container {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-form {
background: white;
padding: 40px;
border-radius: 10px;
box-shadow: 0 10px 30px rgba(0,0,0,0.3);
width: 100%;
max-width: 400px;
}

.login-form h2 {
text-align: center;
margin-bottom: 30px;
color: #333;
}

/* ===== FOOTER ICON REFERENCE ===== */
.main-footer {
text-align: center;
font-size: 13px;
padding: 20px 15px 15px 15px;
margin-top: 40px;
border-top: 1px solid #ccc;
color: #777;
background: #f8f9fa;
}

.icon-reference {
margin-bottom: 20px;
padding: 15px;
background: white;
border-radius: 8px;
border: 1px solid #dee2e6;
}

.icon-reference h4 {
margin-bottom: 15px;
color: #495057;
font-size: 16px;
font-weight: 600;
}

.icon-grid {
display: flex;
justify-content: center;
flex-wrap: wrap;
gap: 15px;
max-width: 1200px;
margin: 0 auto;
}

.icon-item {
display: flex;
flex-direction: column;
align-items: center;
gap: 5px;
min-width: 90px;
}

.icon-item .btn-icon {
margin-bottom: 2px;
position: relative;
}

.icon-label {
font-size: 11px;
color: #6c757d;
text-align: center;
font-weight: 500;
line-height: 1.2;
}

.footer-text {
border-top: 1px solid #dee2e6;
padding-top: 15px;
font-size: 12px;
}

.footer-text p {
margin: 3px 0;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
.actions-row {
flex-direction: column;
align-items: stretch;
}

.filter-section {
justify-content: center;
}

.filter-form-inline {
flex-wrap: wrap;
justify-content: center;
}

.filter-form-inline select,
.filter-form-inline .search-input {
min-width: 150px;
flex: 1;
}

.navbar {
flex-direction: column;
gap: 10px;
text-align: center;
}

.navbar-left {
order: 2;
justify-content: center;
}

.navbar-right {
order: 3;
justify-content: center;
}

.navbar-brand {
order: 1;
}

.dashboard-cards {
gap: 15px;
}

.dashboard-card {
width: 100%;
min-width: 280px;
}

.icon-grid {
gap: 10px;
}

.icon-item {
min-width: 70px;
}

.icon-label {
font-size: 10px;
}
}

@media print {
  /* Hide header */
  header,
  /* Hide footer */
  .main-footer,
  /* Hide Actions Reference Guide inside footer */
  .icon-reference {
    display: none !important;
  }

  /* Optional: Expand table to full width */
  .container {
    margin: 0;
    padding: 0;
    width: 100vw;
  }
}

