html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  white-space: nowrap;
  line-height: 60px;
}

/* RTL Support */
body[dir="rtl"] {
  text-align: right;
}

body[dir="rtl"] .navbar-nav {
  padding-right: 0;
}

body[dir="rtl"] .form-check {
  padding-right: 1.5em;
  padding-left: 0;
}

body[dir="rtl"] .form-check-input {
  margin-right: -1.5em;
  margin-left: 0;
}

/* Card styling */
.card {
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  border: 1px solid rgba(0, 0, 0, 0.125);
}

.card-header {
  background-color: rgba(0, 0, 0, 0.03);
  border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}

/* Table styling */
.table th {
  background-color: #f8f9fa;
  border-top: none;
}

/* Badge styling */
.badge {
  font-size: 0.75em;
}

/* Button styling */
.btn {
  border-radius: 0.375rem;
}

/* Form styling */
.form-control:focus {
  border-color: #86b7fe;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Alert styling */
.alert {
  border-radius: 0.375rem;
}

/* Responsive tables */
.table-responsive {
  border-radius: 0.375rem;
}

/* Custom colors for attendance status */
.bg-success {
  background-color: #198754 !important;
}

.bg-warning {
  background-color: #ffc107 !important;
  color: #000 !important;
}

.bg-info {
  background-color: #0dcaf0 !important;
  color: #000 !important;
}

.bg-danger {
  background-color: #dc3545 !important;
}

/* Dashboard cards */
.card.text-white {
  border: none;
}

.card.text-white .card-body {
  padding: 1.5rem;
}

.card.text-white h2 {
  margin-bottom: 0;
  font-weight: bold;
}

/* Navigation improvements */
.navbar-brand {
  font-weight: bold;
}

.nav-link {
  font-weight: 500;
}

/* Footer improvements */
.footer {
  background-color: #f8f9fa;
  border-top: 1px solid #dee2e6;
}

/* Attendance Matrix Styles */
#attendanceMatrix {
  font-size: 0.85rem;
}

#attendanceMatrix th {
  background-color: #343a40 !important;
  color: white !important;
  font-weight: bold;
  text-align: center;
  vertical-align: middle;
  border: 1px solid #495057 !important;
}

/* لون خط أسماء الأيام أبيض */
#attendanceMatrix th:not(:first-child):not(:nth-child(2)):not(:nth-child(3)) {
  color: white !important;
}

/* التأكد من أن جميع أسماء الأيام بيضاء */
#attendanceMatrix th {
  color: white !important;
}

/* قوة إضافية لجعل أسماء الأيام بيضاء */
#attendanceMatrix thead th {
  color: white !important;
}

#attendanceMatrix thead th small {
  color: white !important;
}

#attendanceMatrix td {
  text-align: center;
  vertical-align: middle;
  border: 1px solid #dee2e6;
  padding: 0.5rem 0.25rem;
}

#attendanceMatrix tbody tr:hover {
  background-color: #f8f9fa;
}

/* لون خط أسماء الطلاب أسود */
#attendanceMatrix td:first-child {
  color: black !important;
  font-weight: bold;
}

/* Attendance status colors */
.bg-light-success {
  background-color: #d1e7dd !important;
  color: #0f5132 !important;
}

.bg-light-warning {
  background-color: #fff3cd !important;
  color: #664d03 !important;
}

.bg-light-orange {
  background-color: #ffeaa7 !important;
  color: #6c5ce7 !important;
}

.bg-light-danger {
  background-color: #f8d7da !important;
  color: #721c24 !important;
}

/* Behavior indicators - small badges instead of full cell coloring */
.behavior-indicator {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: bold;
  margin-left: 4px;
  vertical-align: middle;
}

/* ألوان السلوك متوافقة مع صفحة أخذ الحضور */
.behavior-positive {
  background-color: #d4edda !important;
  border-color: #28a745 !important;
  color: #155724 !important;
  border: 1px solid #28a745;
  border-radius: 12px;
}

.behavior-violation1 {
  background-color: #fff3cd !important;
  border-color: #ffc107 !important;
  color: #856404 !important;
  border: 1px solid #ffc107;
  border-radius: 12px;
}

.behavior-violation2 {
  background-color: #f8d7da !important;
  border-color: #dc3545 !important;
  color: #721c24 !important;
  border: 1px solid #dc3545;
  border-radius: 12px;
}

.behavior-violation3 {
  background-color: #dc3545 !important;
  border-color: #dc3545 !important;
  color: white !important;
  border: 1px solid #dc3545;
  border-radius: 12px;
}

.behavior-violation4 {
  background-color: #721c24 !important;
  border-color: #721c24 !important;
  color: #ffffff !important;
  border: 1px solid #721c24;
  border-radius: 12px;
}

/* تحسين شريط التقدم لنسبة الحضور */
#attendanceMatrix .progress {
  background-color: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
}

#attendanceMatrix .progress-bar {
  transition: width 0.6s ease;
  border-radius: 4px;
}

#attendanceMatrix .progress-bar.bg-success {
  background-color: #28a745 !important;
}

#attendanceMatrix .progress-bar.bg-warning {
  background-color: #ffc107 !important;
}

#attendanceMatrix .progress-bar.bg-danger {
  background-color: #dc3545 !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  #attendanceMatrix {
    font-size: 0.75rem;
  }
  
  #attendanceMatrix th,
  #attendanceMatrix td {
    padding: 0.25rem;
  }


  /* تحسين النصوص في الجوال */
  #attendanceMatrix td:first-child {
    font-size: 0.7rem;
    line-height: 1.2;
    word-break: break-word;
  }

  #attendanceMatrix td:nth-child(2),
  #attendanceMatrix td:nth-child(3) {
    font-size: 0.65rem;
  }
}

/* تحسينات إضافية للشاشات الصغيرة جداً */
@media (max-width: 576px) {
  #attendanceMatrix {
    font-size: 0.6rem;
  }

  #attendanceMatrix th,
  #attendanceMatrix td {
    padding: 0.15rem;
  }

  /* تحسين التمرير الأفقي */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Country Code Selector Styles */
.country-code-select {
  border-right: none !important;
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
  font-size: 0.9rem;
  font-weight: 500;
  background-color: #f8f9fa;
  border: 2px solid #dee2e6;
  transition: all 0.3s ease;
  /* دعم عرض الإيموجي والأعلام بشكل صحيح */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif;
  line-height: 1.8;
}

.country-code-select:focus {
  border-color: #86b7fe;
  background-color: #fff;
  box-shadow: none;
}

.country-code-select option {
  padding: 8px;
  font-size: 0.9rem;
  /* دعم عرض الإيموجي والأعلام */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif;
  line-height: 1.8;
}

.input-group .country-code-select + .form-control {
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
  border-right: 2px solid #dee2e6;
}

.input-group:focus-within .country-code-select {
  border-color: #86b7fe;
}

.input-group:focus-within .form-control {
  border-color: #86b7fe;
}

/* تحسين مظهر حقل الهاتف */
input[type="tel"] {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  letter-spacing: 0.5px;
}

/* تحسين شكل input-group */
.input-group {
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  border-radius: 0.375rem;
  overflow: hidden;
}

/* Print styles */
@media print {
  .navbar, .footer, .btn {
    display: none !important;
  }
  
  .card {
    border: 1px solid #000 !important;
    box-shadow: none !important;
  }
  
  #attendanceMatrix {
    font-size: 0.7rem;
  }
  
  #attendanceMatrix th,
  #attendanceMatrix td {
    border: 1px solid #000 !important;
  }
}