/* أساسيات التصميم */
:root {
  --primary-color: #3A5898;
  --secondary-color: #E2A232;
  --text-color: #333;
  --light-bg: #f8f9fa;
  --border-radius: 12px;
  --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
}

/* الإطار العام */
.ttu-schedule-wrapper {
  margin: 20px 0;
  font-family: inherit; /* سيستخدم خط الموقع الأساسي */
  color: var(--text-color);
}

/* تحسينات شريط اللغة */
.ttu-lang-container {
  display: flex;
  justify-content: flex-end; /* نقل الأزرار لليمين */
  margin-bottom: 20px;
}

.ttu-lang-switch {
  display: inline-flex;
  gap: 8px;
  background: rgba(58, 88, 152, 0.05);
  padding: 6px;
  border-radius: var(--border-radius);
}

.ttu-lang-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--primary-color);
  cursor: pointer;
  border-radius: calc(var(--border-radius) - 4px);
  font-weight: 600;
  transition: var(--transition);
  font-family: inherit; /* استخدام خط الموقع */
}

.ttu-lang-btn.active {
  background: var(--primary-color);
  color: white;
  box-shadow: 0 2px 8px rgba(58, 88, 152, 0.2);
}

.ttu-lang-btn:hover:not(.active) {
  background: rgba(58, 88, 152, 0.1);
}

/* تحسينات الجدول */
.ttu-table.dataTable {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--box-shadow);
  font-family: inherit; /* استخدام خط الموقع */
}

.ttu-table.dataTable thead th {
  background: linear-gradient(135deg, var(--primary-color), #2a4365);
  font-weight: 600;
  color: white;
  padding: 16px;
  text-align: center;
  position: relative;
  font-size: 0.95rem;
}

.ttu-table.dataTable thead th:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 20%;
  height: 60%;
  width: 1px;
  background: rgba(255, 255, 255, 0.3);
}

.ttu-table.dataTable tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  text-align: center;
  transition: var(--transition);
  font-size: 0.9rem;
}

.ttu-table.dataTable tbody tr {
  background: white;
}

.ttu-table.dataTable tbody tr:nth-child(even) {
  background: var(--light-bg);
}

.ttu-table.dataTable tbody tr:hover td {
  background: rgba(226, 162, 50, 0.05);
}

/* تحسينات حقل البحث */
.dataTables_wrapper .dataTables_filter {
  float: none;
  text-align: right;
  margin-bottom: 20px;
}

.dataTables_wrapper .dataTables_filter input {
  border-radius: var(--border-radius);
  border: 2px solid #ddd;
  padding: 10px 16px;
  transition: var(--transition);
  width: 300px;
  max-width: 100%;
  font-family: inherit; /* استخدام خط الموقع */
}

.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(58, 88, 152, 0.1);
  outline: none;
}

/* Modal Modern Design - Updated */
.ttu-modal {
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-out;
}

.ttu-modal.active {
    opacity: 1;
    visibility: visible;
}

.ttu-modal .ttu-modal-content {
    background: #fff;
    padding: 20px;
    border-radius: 16px;
    max-width: 720px;
    width: 90%;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    position: relative;
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    border: 1px solid rgba(255,255,255,0.2);
    overflow: hidden;
}

.ttu-modal.active .ttu-modal-content {
    transform: translateY(0);
}

.ttu-modal .ttu-modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 8px;
    background: linear-gradient(90deg, #3A5898 0%, #E2A232 100%);
}

/* تصميم زر الإغلاق في سطر مستقل */
.ttu-modal .ttu-modal-header {
    display: flex;
    justify-content: flex-end;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.ttu-modal .ttu-modal-close {
    border: none;
    background: transparent;
    font-size: 24px;
    cursor: pointer;
    color: #777;
    transition: all 0.2s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-left: auto;
}

.ttu-modal .ttu-modal-close:hover {
    color: #E2A232;
    background: rgba(226, 162, 50, 0.1);
}

/* العنوان في المنتصف */
.ttu-modal .ttu-modal-title {
    text-align: center;
    color: #3A5898;
    font-size: 24px;
    margin: 0 0 20px 0;
    padding: 0 20px;
    width: 100%;
}

.ttu-today-item {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(58, 88, 152, 0.1);
    transition: all 0.3s ease;
    padding: 15px;
    border-radius: 8px;
    text-align: left;
}

.ttu-today-item:hover {
    background: rgba(58, 88, 152, 0.05);
    transform: translateX(5px);
}

.ttu-today-item strong {
    color: #3A5898;
    font-size: 18px;
    display: block;
    margin-bottom: 8px;
}

.ttu-today-item p {
    color: #666;
    margin: 0;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ttu-today-item p::before {
    content: "•";
    color: #E2A232;
    font-size: 24px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ttu-modal .ttu-modal-content {
        padding: 15px;
        width: 95%;
    }
    
    .ttu-modal .ttu-modal-title {
        font-size: 20px;
        margin-bottom: 15px;
    }
    
    .ttu-modal .ttu-modal-close {
        font-size: 20px;
        width: 30px;
        height: 30px;
    }
}
    .ttu-lang-btn {
        background-color: rgb(88,116,170);
        color: white;
        border: none;
        padding: 8px 15px;
        cursor: pointer;
        transition: background-color 0.3s;
        border-radius: 4px;
        margin-right: 5px;
    }
    .ttu-lang-btn:hover {
        background-color: #E2A232;
    }
    .ttu-lang-btn.active {
        background-color: #E2A232;
        font-weight: bold;
    }
    .ttu-toast {
        position: fixed;
        bottom: 20px;
        right: 20px;
        background-color: #333;
        color: white;
        padding: 15px;
        border-radius: 4px;
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        z-index: 1000;
        display: flex;
        flex-direction: column;
        max-width: 350px;
    }
    .ttu-toast-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 10px;
    }
    .ttu-toast-title {
        font-weight: bold;
        font-size: 1.1em;
    }
    .ttu-toast-close {
        background: none;
        border: none;
        color: white;
        font-size: 1.2em;
        cursor: pointer;
    }
    .ttu-today-item {
        margin-bottom: 10px;
        padding-bottom: 10px;
        border-bottom: 1px solid #555;
    }
    .ttu-today-item:last-child {
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: 0;
    }

/* تحسينات عناصر اليوم */
.ttu-today-item {
  padding: 16px;
  margin-bottom: 16px;
  border-radius: 8px;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: var(--transition);
  border-left: 4px solid var(--secondary-color);
}

.ttu-today-item:hover {
  transform: translateX(5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.ttu-today-item strong {
  color: var(--primary-color);
  font-size: 1.05rem;
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.ttu-today-item p {
  color: #555;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.ttu-today-item p::before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--secondary-color);
}

/* التصميم المتجاوب */
@media (max-width: 768px) {
  .ttu-lang-container {
    justify-content: center;
  }
  
  .ttu-table.dataTable thead th,
  .ttu-table.dataTable tbody td {
    padding: 12px 10px;
  }
  
  .dataTables_wrapper .dataTables_filter {
    text-align: center;
  }
  
  .dataTables_wrapper .dataTables_filter input {
    width: 100%;
  }
  
  .ttu-modal-content {
    width: 95%;
  }
  
  .ttu-modal-header {
    padding: 18px;
  }
  
  .ttu-modal-body {
    padding: 18px;
  }
}

/* دعم RTL */
[dir="rtl"] .ttu-lang-container {
  justify-content: flex-start;
}

[dir="rtl"] .ttu-lang-switch {
  flex-direction: row-reverse;
}

[dir="rtl"] .dataTables_wrapper .dataTables_filter {
  text-align: left;
}

[dir="rtl"] .ttu-today-item {
  border-left: none;
  border-right: 4px solid var(--secondary-color);
}

[dir="rtl"] .ttu-today-item:hover {
  transform: translateX(-5px);
}