* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    direction: rtl;
    color: var(--text-primary);
}

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

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-xl);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.header h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Week Navigation */
.week-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px 30px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-lg);
}

.week-nav button {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.week-nav button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.week-nav h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

/* Schedule Table */
.schedule-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow-xl);
    overflow-x: auto;
}

.schedule-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 20px;
}

.schedule-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    border: none;
}

.schedule-table th:first-child {
    border-top-right-radius: 12px;
}

.schedule-table th:last-child {
    border-top-left-radius: 12px;
}

.schedule-table td {
    padding: 15px;
    text-align: center;
    border: 1px solid var(--border-color);
    background: white;
    transition: all 0.3s ease;
}

.period-cell {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    font-weight: 600;
    color: var(--primary-dark);
}

.booking-cell {
    cursor: pointer;
    position: relative;
    min-height: 80px;
    vertical-align: middle;
}

.booking-cell:hover {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
}

.booking-cell.booked {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    cursor: default;
}

.booking-cell.booked:hover {
    transform: scale(1);
}

.booking-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.teacher-name {
    font-weight: 600;
    color: var(--secondary-color);
    font-size: 1.1rem;
}

.booking-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-edit {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
}

.btn-delete {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
    color: white;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
}

.btn-secondary {
    background: #94a3b8;
    color: white;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 20px;
    max-width: 420px;
    width: 95%;
    max-height: 85vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: var(--shadow-xl);
    animation: slideIn 0.3s ease;
    position: relative;
    z-index: 1001;
    padding-bottom: 30px;
}

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

.modal-content h2 {
    margin-bottom: 15px;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.form-group {
    margin-bottom: 12px;
    position: relative;
    z-index: auto;
}

.modal-content .form-group {
    overflow: visible;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-group select,
.form-group input {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    font-family: inherit;
    position: relative;
    z-index: 1001;
}

.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left 10px center;
    background-size: 20px;
    padding-right: 12px;
    padding-left: 40px;
}

.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* تحسين الـ small text داخل النماذج */
.form-group small {
    font-size: 0.8rem;
    display: block;
    margin-top: 3px;
}

/* تحسين ظهور القوائم المنسدلة في المتصفحات المختلفة */
select {
    cursor: pointer;
}

select option {
    padding: 10px;
    background: white;
    color: var(--text-primary);
    border: none;
}

select option:checked {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-primary {
    flex: 1;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    padding: 14px;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
}

.btn-secondary {
    flex: 1;
    background: var(--border-color);
    color: var(--text-primary);
    padding: 14px;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Admin Link */
.admin-link {
    position: fixed;
    bottom: 30px;
    left: 30px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-link:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
}

/* Loading Spinner */
.loading {
    text-align: center;
    padding: 40px;
    font-size: 1.2rem;
    color: var(--text-secondary);
}

/* Alert Messages */
.alert {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    animation: slideIn 0.3s ease;
}

.alert-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border-right: 4px solid var(--secondary-color);
}

.alert-error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border-right: 4px solid var(--danger-color);
}

/* Responsive */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .week-nav {
        flex-direction: column;
        gap: 15px;
    }
    
    .schedule-table {
        font-size: 0.9rem;
    }
    
    .schedule-table th,
    .schedule-table td {
        padding: 10px 5px;
    }
    
    .admin-link {
        bottom: 15px;
        left: 15px;
        padding: 12px 20px;
        font-size: 0.9rem;
    }
}

/* Empty State */
.empty-cell {
    color: var(--text-secondary);
    font-style: italic;
}

.empty-cell::before {
    content: "+";
    display: block;
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 5px;
}
