@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;900&display=swap');

/* ===========================================
   CSS Variables - Your Color Scheme
   =========================================== */

:root {
    --primary-color: #fefffb;
    --secondary-color: #aac65d;
    --accent-color: #137980;
    --white: #ffffff;
    --light-gray: #f7f7f7;
    --dark-gray: #d5e0eb;
    --black: #000000;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --error-color: #dc3545;
    --danger-color: #dc3545;
    --border-radius: 12px;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
    --background-color: var(--white);
    --text-color: var(--accent-color);
    --border-color: #ddd;
    --input-bg: #fff;
    --text-muted: #666;
    --sidebar-width: 280px;
    --bg-secondary: #f2f5f0;

    --card-background: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --hover-bg: rgba(0, 0, 0, 0.05);
    --unread-bg: rgba(102, 126, 234, 0.08);

    /* Gradient for buttons and accents */
    --gradient-primary: linear-gradient(135deg, var(--secondary-color) 0%, var(--accent-color) 100%);
    --gradient-hover: linear-gradient(135deg, var(--accent-color) 0%, var(--secondary-color) 100%);
}

/* 🌙 Dark mode variables */
[data-theme="dark"] {
    --primary-color: #1a1a1a;
    --unread-bg: rgba(102, 126, 234, 0.12);
    --secondary-color: #8ba83f;
    --hover-bg: rgba(255, 255, 255, 0.05);
    --accent-color: #4a9ba5;
    --white: #2d2d2d;
    --light-gray: #2a2a2a;
    --dark-gray: #555555;
    --black: #000000;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    --background-color: #2d2d2d;
    --text-color: #e0e0e0;
    --border-color: #444;
    --input-bg: #2a2a2a;
    --text-muted: #aaa;

    --card-background: #2a2a2a;
    --text-primary: #e0e0e0;
    --text-secondary: #aaaaaa;
    --bg-secondary: #232323;

    --gradient-primary: linear-gradient(135deg, var(--secondary-color) 0%, var(--accent-color) 100%);
    --gradient-hover: linear-gradient(135deg, var(--accent-color) 0%, var(--secondary-color) 100%);
}

/* ===========================================
   Teacher Card - Consistent Design & Size
   =========================================== */

.teacher-card {
    background: var(--card-background);
    border-radius: var(--border-radius);
    padding: 28px 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    font-family: 'Tajawal', sans-serif;

    /* Fixed size for consistency */
    width: 100%;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.teacher-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.teacher-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(19, 121, 128, 0.2);
}

.teacher-card:hover::before {
    transform: scaleX(1);
}

/* Teacher Avatar */
.teacher-avatar {
    width: 120px;
    height: 120px;
    min-width: 120px;
    min-height: 120px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 20px;
    border: 4px solid var(--secondary-color);
    box-shadow: 0 4px 15px rgba(170, 198, 93, 0.3);
    transition: var(--transition);
    flex-shrink: 0;
}

.teacher-card:hover .teacher-avatar {
    transform: scale(1.05);
    border-color: var(--accent-color);
    box-shadow: 0 6px 20px rgba(19, 121, 128, 0.4);
}

.teacher-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.teacher-card:hover .teacher-avatar img {
    transform: scale(1.1);
}

/* Teacher Info */
.teacher-info {
    padding-top: 8px;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.teacher-name {
    margin: 0 0 10px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
    min-height: 28px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Tajawal', sans-serif;
}

.teacher-subject {
    color: var(--accent-color);
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 18px;
    display: inline-block;
    padding: 6px 16px;
    background: rgba(19, 121, 128, 0.1);
    border-radius: 20px;
    min-height: 32px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Empty subject placeholder */
.teacher-info:not(:has(.teacher-subject)) .teacher-name {
    margin-bottom: 28px;
}

/* Teacher Stats */
.teacher-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
    margin-top: auto;
    width: 100%;
}

.teacher-stats .stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 65px;
    flex: 1;
}

.teacher-stats .stat i {
    font-size: 18px;
    color: var(--secondary-color);
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.teacher-stats .stat span:not(.stat-label) {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.teacher-stats .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

/* ===========================================
   Teachers Carousel Section (Home Page)
   =========================================== */

.our-teachers {
    padding: 80px 0;
    background: var(--bg-secondary);
    font-family: 'Tajawal', sans-serif;
}

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

.our-teachers .section-header {
    text-align: center;
    margin-bottom: 50px;
}

.our-teachers .section-title {
    font-size: 38px;
    font-weight: 900;
    color: var(--accent-color);
    margin-bottom: 14px;
    font-family: 'Tajawal', sans-serif;
}

.our-teachers .section-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.7;
}

/* Teachers Carousel */
.teachers-carousel {
    position: relative;
    padding: 20px 70px;
}

.carousel-wrapper {
    position: relative;
    overflow: hidden;
}

/* Teachers Container */
#teachersContainer {
    position: relative;
    min-height: 380px;
}

/* Teachers Page */
.teachers-page {
    display: none;
    gap: 24px;
    justify-content: center;
    align-items: stretch;
    flex-wrap: nowrap;
    padding: 10px 0;
}

.teachers-page.active {
    display: flex;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Carousel Teacher Card - LARGER SIZE for index page */
.teachers-page .teacher-card {
    flex: 0 0 260px;
    width: 260px;
    max-width: 260px;
    min-height: 340px;
    padding: 28px 20px;
}

.teachers-page .teacher-avatar {
    width: 110px;
    height: 110px;
    min-width: 110px;
    min-height: 110px;
}

.teachers-page .teacher-name {
    font-size: 18px;
    min-height: 25px;
}

.teachers-page .teacher-subject {
    font-size: 14px;
    padding: 5px 14px;
    min-height: 30px;
}

.teachers-page .teacher-stats {
    gap: 16px;
    padding-top: 16px;
}

.teachers-page .teacher-stats .stat {
    min-width: 60px;
}

.teachers-page .teacher-stats .stat i {
    font-size: 16px;
}

.teachers-page .teacher-stats .stat span:not(.stat-label) {
    font-size: 18px;
}

.teachers-page .teacher-stats .stat-label {
    font-size: 11px;
}

/* Carousel Navigation Buttons */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--card-background);
    border: 2px solid var(--secondary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    z-index: 10;
    color: var(--accent-color);
    font-size: 20px;
}

.carousel-btn:hover {
    background: var(--gradient-primary);
    color: var(--white);
    border-color: transparent;
    transform: translateY(-50%) scale(1.1);
}

.carousel-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.carousel-btn:disabled:hover {
    background: var(--card-background);
    color: var(--accent-color);
    border-color: var(--secondary-color);
    transform: translateY(-50%);
}

/* RTL Layout */
.carousel-btn.prev-btn {
    right: 0;
}

.carousel-btn.next-btn {
    left: 0;
}

/* LTR Layout */
[dir="ltr"] .carousel-btn.prev-btn {
    left: 0;
    right: auto;
}

[dir="ltr"] .carousel-btn.next-btn {
    right: 0;
    left: auto;
}

/* Carousel Dots */
.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 35px;
}

.dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--dark-gray);
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.dot:hover {
    background: var(--secondary-color);
    opacity: 0.7;
}

.dot.active {
    background: var(--gradient-primary);
    transform: scale(1.3);
}

/* Show All Teachers Button */
#showAllTeachers {
    display: none;
    margin: 35px auto 0;
    padding: 16px 40px;
    background: var(--gradient-primary);
    color: var(--white);
    border: none;
    border-radius: 30px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: 'Tajawal', sans-serif;
}

#showAllTeachers:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(19, 121, 128, 0.4);
    background: var(--gradient-hover);
}

#showAllTeachers i {
    font-size: 16px;
}

/* ===========================================
   Teachers Grid Section (our-teachers.html)
   =========================================== */

.teachers-section {
    padding: 60px 0;
    background: var(--bg-secondary);
    min-height: 100vh;
    font-family: 'Tajawal', sans-serif;
}

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

.teachers-section .section-header {
    text-align: center;
    margin-bottom: 45px;
}

.teachers-section .section-title {
    font-size: 34px;
    font-weight: 900;
    color: var(--accent-color);
    margin-bottom: 12px;
}

.teachers-section .section-subtitle {
    font-size: 17px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Teachers Grid - Equal Card Sizes */
.teachers-section .teachers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 28px;
    min-height: 300px;
}

/* Grid Teacher Card - Consistent size */
.teachers-section .teacher-card {
    width: 100%;
    min-height: 340px;
    max-width: none;
}

.teachers-section .teacher-avatar {
    width: 120px;
    height: 120px;
    min-width: 120px;
    min-height: 120px;
}

.teachers-section .teacher-name {
    font-size: 20px;
}

.teachers-section .teacher-subject {
    font-size: 15px;
}

/* ===========================================
   Loading & Error States
   =========================================== */

/* Loading Spinner */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    width: 100%;
}

.spinner {
    width: 55px;
    height: 55px;
    border: 4px solid rgba(170, 198, 93, 0.3);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner p {
    margin-top: 18px;
    color: var(--text-secondary);
    font-size: 17px;
    font-family: 'Tajawal', sans-serif;
}

/* Teachers Loading (Carousel) */
.teachers-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    z-index: 5;
    border-radius: var(--border-radius);
}

[data-theme="dark"] .teachers-loading {
    background: rgba(42, 42, 42, 0.95);
}

/* Grid Loader */
.grid-loader {
    grid-column: 1 / -1;
}

/* Error Message */
.teachers-error,
.error-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    width: 100%;
}

.teachers-error {
    grid-column: 1 / -1;
    min-height: 280px;
}

.teachers-error i,
.error-message i {
    font-size: 52px;
    color: var(--error-color);
    margin-bottom: 18px;
}

.teachers-error p,
.error-message p {
    font-size: 19px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-family: 'Tajawal', sans-serif;
}

/* Retry Button */
.retry-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 32px;
    background: var(--gradient-primary);
    color: var(--white);
    border: none;
    border-radius: 30px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Tajawal', sans-serif;
}

.retry-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(19, 121, 128, 0.4);
    background: var(--gradient-hover);
}

.retry-btn i {
    font-size: 15px;
}

/* No Teachers Message */
.no-teachers {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    grid-column: 1 / -1;
    width: 100%;
}

.no-teachers i {
    font-size: 52px;
    color: var(--dark-gray);
    margin-bottom: 18px;
}

.no-teachers p {
    font-size: 19px;
    color: var(--text-secondary);
    font-family: 'Tajawal', sans-serif;
}

/* ===========================================
   Pagination Controls
   =========================================== */

.pagination-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 45px 0 20px;
    gap: 18px;
}

.pagination {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 48px;
    height: 48px;
    padding: 0 18px;
    border: 2px solid var(--border-color);
    background-color: var(--card-background);
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 12px;
    transition: var(--transition);
    font-size: 16px;
    font-weight: 700;
    font-family: 'Tajawal', sans-serif;
}

.page-btn:hover {
    background: var(--secondary-color);
    color: var(--white);
    border-color: var(--secondary-color);
    transform: translateY(-2px);
}

.page-btn.active {
    background: var(--gradient-primary);
    color: var(--white);
    border-color: transparent;
}

.page-btn i {
    font-size: 13px;
}

.page-dots {
    padding: 0 10px;
    color: var(--text-secondary);
    font-weight: 700;
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    font-family: 'Tajawal', sans-serif;
}

/* ===========================================
   Responsive Design
   =========================================== */

/* Large Desktop */
@media (min-width: 1400px) {
    .teachers-page .teacher-card {
        flex: 0 0 280px;
        width: 280px;
        max-width: 280px;
        min-height: 360px;
    }

    .teachers-page .teacher-avatar {
        width: 120px;
        height: 120px;
        min-width: 120px;
        min-height: 120px;
    }

    .teachers-page .teacher-name {
        font-size: 20px;
    }
}

/* Large Tablets */
@media (max-width: 1200px) {
    .teachers-carousel {
        padding: 20px 60px;
    }

    .teachers-page .teacher-card {
        flex: 0 0 240px;
        width: 240px;
        max-width: 240px;
        min-height: 320px;
        padding: 24px 18px;
    }

    .teachers-page .teacher-avatar {
        width: 100px;
        height: 100px;
        min-width: 100px;
        min-height: 100px;
    }

    .teachers-page .teacher-name {
        font-size: 17px;
    }

    .teachers-page .teacher-stats .stat span:not(.stat-label) {
        font-size: 17px;
    }
}

/* Tablets */
@media (max-width: 992px) {
    .our-teachers {
        padding: 60px 0;
    }

    .our-teachers .section-title {
        font-size: 32px;
    }

    .our-teachers .section-subtitle {
        font-size: 16px;
    }

    .teachers-carousel {
        padding: 20px 50px;
    }

    .carousel-btn {
        width: 46px;
        height: 46px;
        font-size: 18px;
    }

    .teachers-page {
        gap: 20px;
    }

    .teachers-page .teacher-card {
        flex: 0 0 220px;
        width: 220px;
        max-width: 220px;
        min-height: 300px;
        padding: 22px 16px;
    }

    .teachers-page .teacher-avatar {
        width: 90px;
        height: 90px;
        min-width: 90px;
        min-height: 90px;
        border-width: 3px;
    }

    .teachers-page .teacher-name {
        font-size: 16px;
        min-height: 22px;
    }

    .teachers-page .teacher-subject {
        font-size: 13px;
        padding: 4px 12px;
        min-height: 26px;
    }

    .teachers-page .teacher-stats {
        gap: 12px;
        padding-top: 14px;
    }

    .teachers-page .teacher-stats .stat {
        min-width: 55px;
    }

    .teachers-page .teacher-stats .stat i {
        font-size: 14px;
    }

    .teachers-page .teacher-stats .stat span:not(.stat-label) {
        font-size: 16px;
    }

    .teachers-page .teacher-stats .stat-label {
        font-size: 10px;
    }

    /* Grid Section */
    .teachers-section {
        padding: 50px 0;
    }

    .teachers-section .section-title {
        font-size: 28px;
    }

    .teachers-section .teachers-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 24px;
    }

    .teachers-section .teacher-card {
        min-height: 320px;
    }

    .teachers-section .teacher-avatar {
        width: 110px;
        height: 110px;
        min-width: 110px;
        min-height: 110px;
    }
}

/* Small Tablets */
@media (max-width: 768px) {
    .our-teachers {
        padding: 50px 0;
    }

    .our-teachers .section-title {
        font-size: 28px;
    }

    .our-teachers .section-subtitle {
        font-size: 15px;
        padding: 0 15px;
    }

    .teachers-carousel {
        padding: 15px 45px;
    }

    .carousel-btn {
        width: 42px;
        height: 42px;
        font-size: 16px;
    }

    .teachers-page {
        gap: 16px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .teachers-page .teacher-card {
        flex: 0 0 200px;
        width: 200px;
        max-width: 200px;
        min-height: 280px;
        padding: 20px 14px;
    }

    .teachers-page .teacher-avatar {
        width: 80px;
        height: 80px;
        min-width: 80px;
        min-height: 80px;
        margin-bottom: 14px;
    }

    .teachers-page .teacher-name {
        font-size: 15px;
        min-height: 21px;
        margin-bottom: 6px;
    }

    .teachers-page .teacher-subject {
        font-size: 12px;
        padding: 3px 10px;
        min-height: 24px;
        margin-bottom: 12px;
    }

    .teachers-page .teacher-stats {
        gap: 10px;
        padding-top: 12px;
    }

    .teachers-page .teacher-stats .stat {
        min-width: 50px;
        gap: 4px;
    }

    .teachers-page .teacher-stats .stat i {
        font-size: 13px;
        height: 18px;
    }

    .teachers-page .teacher-stats .stat span:not(.stat-label) {
        font-size: 15px;
    }

    .teachers-page .teacher-stats .stat-label {
        font-size: 9px;
    }

    /* Dots */
    .carousel-dots {
        margin-top: 25px;
        gap: 10px;
    }

    .dot {
        width: 12px;
        height: 12px;
    }

    /* Show All Button */
    #showAllTeachers {
        padding: 14px 30px;
        font-size: 15px;
    }

    /* Grid Section */
    .teachers-section {
        padding: 40px 0;
    }

    .teachers-section .container {
        padding: 0 15px;
    }

    .teachers-section .section-title {
        font-size: 26px;
    }

    .teachers-section .section-subtitle {
        font-size: 15px;
    }

    .teachers-section .teachers-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 20px;
    }

    .teachers-section .teacher-card {
        min-height: 300px;
        padding: 24px 20px;
    }

    .teachers-section .teacher-avatar {
        width: 100px;
        height: 100px;
        min-width: 100px;
        min-height: 100px;
    }

    .teachers-section .teacher-name {
        font-size: 18px;
    }

    .teachers-section .teacher-subject {
        font-size: 14px;
    }

    /* Pagination */
    .pagination-controls {
        padding: 35px 0 15px;
    }

    .pagination {
        gap: 8px;
    }

    .page-btn {
        min-width: 42px;
        height: 42px;
        padding: 0 14px;
        font-size: 15px;
        border-radius: 10px;
    }
}

/* Mobile */
@media (max-width: 576px) {
    .our-teachers {
        padding: 40px 0;
    }

    .our-teachers .section-title {
        font-size: 24px;
    }

    .our-teachers .section-subtitle {
        font-size: 14px;
        padding: 0 10px;
    }

    .teachers-carousel {
        padding: 15px 15px;
    }

    .carousel-btn {
        width: 38px;
        height: 38px;
        font-size: 14px;
    }

    .carousel-btn.prev-btn {
        right: 0;
    }

    .carousel-btn.next-btn {
        left: 0;
    }

    [dir="ltr"] .carousel-btn.prev-btn {
        left: 0;
    }

    [dir="ltr"] .carousel-btn.next-btn {
        right: 0;
    }

    .teachers-page {
        gap: 14px;
    }

    .teachers-page .teacher-card {
        flex: 0 0 170px;
        width: 170px;
        max-width: 170px;
        min-height: 250px;
        padding: 18px 12px;
    }

    .teachers-page .teacher-avatar {
        width: 70px;
        height: 70px;
        min-width: 70px;
        min-height: 70px;
        border-width: 3px;
        margin-bottom: 12px;
    }

    .teachers-page .teacher-name {
        font-size: 14px;
        min-height: 19px;
        margin-bottom: 5px;
    }

    .teachers-page .teacher-subject {
        font-size: 11px;
        padding: 3px 8px;
        min-height: 22px;
        margin-bottom: 10px;
    }

    .teachers-page .teacher-stats {
        gap: 8px;
        padding-top: 10px;
    }

    .teachers-page .teacher-stats .stat {
        min-width: 45px;
        gap: 3px;
    }

    .teachers-page .teacher-stats .stat i {
        font-size: 12px;
        height: 16px;
    }

    .teachers-page .teacher-stats .stat span:not(.stat-label) {
        font-size: 14px;
    }

    .teachers-page .teacher-stats .stat-label {
        font-size: 8px;
    }

    /* Dots */
    .carousel-dots {
        margin-top: 20px;
        gap: 8px;
    }

    .dot {
        width: 10px;
        height: 10px;
    }

    /* Show All Button */
    #showAllTeachers {
        padding: 12px 24px;
        font-size: 14px;
        margin-top: 25px;
    }

    /* Grid Section */
    .teachers-section {
        padding: 30px 0;
    }

    .teachers-section .container {
        padding: 0 12px;
    }

    .teachers-section .section-title {
        font-size: 22px;
    }

    .teachers-section .section-subtitle {
        font-size: 14px;
    }

    .teachers-section .teachers-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 16px;
    }

    .teachers-section .teacher-card {
        min-height: 280px;
        padding: 20px 14px;
    }

    .teachers-section .teacher-avatar {
        width: 85px;
        height: 85px;
        min-width: 85px;
        min-height: 85px;
    }

    .teachers-section .teacher-name {
        font-size: 16px;
    }

    .teachers-section .teacher-subject {
        font-size: 12px;
    }

    .teachers-section .teacher-stats .stat span:not(.stat-label) {
        font-size: 16px;
    }

    .teachers-section .teacher-stats .stat-label {
        font-size: 10px;
    }

    /* Pagination */
    .pagination-controls {
        padding: 30px 0 15px;
    }

    .pagination {
        gap: 5px;
    }

    .page-btn {
        min-width: 38px;
        height: 38px;
        padding: 0 10px;
        font-size: 14px;
        border-radius: 8px;
    }

    .pagination-info {
        font-size: 13px;
    }

    /* Loading & Error */
    .loading-spinner {
        padding: 40px 20px;
    }

    .spinner {
        width: 45px;
        height: 45px;
    }

    .loading-spinner p {
        font-size: 15px;
    }

    .teachers-error i,
    .error-message i,
    .no-teachers i {
        font-size: 40px;
    }

    .teachers-error p,
    .error-message p,
    .no-teachers p {
        font-size: 16px;
    }

    .retry-btn {
        padding: 12px 26px;
        font-size: 15px;
    }
}

/* Extra Small Mobile */
@media (max-width: 400px) {
    .teachers-carousel {
        padding: 10px 10px;
    }

    .carousel-btn {
        width: 34px;
        height: 34px;
        font-size: 12px;
    }

    .teachers-page .teacher-card {
        flex: 0 0 150px;
        width: 150px;
        max-width: 150px;
        min-height: 230px;
        padding: 14px 10px;
    }

    .teachers-page .teacher-avatar {
        width: 60px;
        height: 60px;
        min-width: 60px;
        min-height: 60px;
        border-width: 2px;
    }

    .teachers-page .teacher-name {
        font-size: 13px;
    }

    .teachers-page .teacher-subject {
        font-size: 10px;
    }

    .teachers-page .teacher-stats .stat span:not(.stat-label) {
        font-size: 13px;
    }

    .teachers-section .teachers-grid {
        grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
        gap: 12px;
    }

    .teachers-section .teacher-card {
        min-height: 260px;
        padding: 16px 12px;
    }

    .teachers-section .teacher-avatar {
        width: 75px;
        height: 75px;
        min-width: 75px;
        min-height: 75px;
    }

    .teachers-section .teacher-name {
        font-size: 15px;
    }
}

/* ===========================================
   Animation Classes
   =========================================== */

.fade-in {
    animation: fadeIn 0.4s ease forwards;
}

.slide-up {
    animation: slideUp 0.4s ease forwards;
}

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

.scale-in {
    animation: scaleIn 0.3s ease forwards;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===========================================
   Accessibility
   =========================================== */

/* Focus States */
.teacher-card:focus,
.teacher-card:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 3px;
}

.carousel-btn:focus,
.carousel-btn:focus-visible,
.page-btn:focus,
.page-btn:focus-visible,
.retry-btn:focus,
.retry-btn:focus-visible,
#showAllTeachers:focus,
#showAllTeachers:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

.dot:focus,
.dot:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .teacher-card,
    .teacher-avatar,
    .teacher-avatar img,
    .carousel-btn,
    .page-btn,
    .retry-btn,
    #showAllTeachers,
    .dot {
        transition: none;
    }

    .teachers-page.active {
        animation: none;
    }

    .spinner {
        animation: none;
        border-top-color: var(--accent-color);
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .teacher-card {
        border: 2px solid var(--black);
    }

    [data-theme="dark"] .teacher-card {
        border: 2px solid var(--text-primary);
    }

    .page-btn,
    .carousel-btn {
        border-width: 2px;
    }
}
/* ===========================================
   Pagination Controls - FIXED
   =========================================== */

.pagination-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 45px 0 20px;
    gap: 18px;
}

.pagination {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 48px;
    height: 48px;
    padding: 0 20px;
    border: 2px solid var(--border-color);
    background-color: var(--card-background);
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 10px;
    transition: var(--transition);
    font-size: 16px;
    font-weight: 700;
    font-family: 'Tajawal', sans-serif;
    white-space: nowrap;
}

/* Number buttons - square shape */
.page-btn:not(:has(i)) {
    min-width: 48px;
    width: 48px;
    padding: 0;
}

/* Navigation buttons (prev/next) with icons */
.page-btn:has(i) {
    min-width: auto;
    width: auto;
    padding: 0 18px;
}

.page-btn:hover {
    background: var(--secondary-color);
    color: var(--white);
    border-color: var(--secondary-color);
    transform: translateY(-2px);
}

.page-btn.active {
    background: var(--gradient-primary);
    color: var(--white);
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(19, 121, 128, 0.3);
}

.page-btn.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(19, 121, 128, 0.4);
}

.page-btn i {
    font-size: 12px;
}

.page-dots {
    padding: 0 8px;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 16px;
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    font-family: 'Tajawal', sans-serif;
}

/* ===========================================
   Pagination Responsive
   =========================================== */

@media (max-width: 768px) {
    .pagination-controls {
        padding: 35px 0 15px;
    }

    .pagination {
        gap: 8px;
    }

    .page-btn {
        min-width: 42px;
        height: 42px;
        padding: 0 16px;
        font-size: 15px;
        border-radius: 8px;
    }

    .page-btn:not(:has(i)) {
        min-width: 42px;
        width: 42px;
        padding: 0;
    }

    .page-btn:has(i) {
        padding: 0 14px;
    }

    .page-btn i {
        font-size: 11px;
    }
}

@media (max-width: 576px) {
    .pagination-controls {
        padding: 30px 0 15px;
    }

    .pagination {
        gap: 6px;
    }

    .page-btn {
        min-width: 38px;
        height: 38px;
        padding: 0 12px;
        font-size: 14px;
        border-radius: 8px;
    }

    .page-btn:not(:has(i)) {
        min-width: 38px;
        width: 38px;
        padding: 0;
    }

    .page-btn:has(i) {
        padding: 0 12px;
    }

    .page-btn i {
        font-size: 10px;
    }

    .pagination-info {
        font-size: 13px;
    }
}

@media (max-width: 400px) {
    .pagination {
        gap: 4px;
    }

    .page-btn {
        min-width: 34px;
        height: 34px;
        font-size: 13px;
        border-radius: 6px;
    }

    .page-btn:not(:has(i)) {
        min-width: 34px;
        width: 34px;
    }

    .page-btn:has(i) {
        padding: 0 10px;
    }
}

/* ===========================================
   FIX: Overflow & Responsive Adjustments
   Add this to the very end of your CSS file
   =========================================== */

/* 1. Global Overflow Fix */
body, html {
    overflow-x: hidden; /* Prevents the whole page from sliding left/right */
    width: 100%;
}

.our-teachers,
.teachers-section {
    width: 100%;
    overflow: hidden; /* Ensures content stays inside the section */
}

/* 2. Grid Layout Improvements (Grid Page) */
/* Makes cards fill the width smoothly instead of jumping sizes */
.teachers-section .teachers-grid {
    /* Use a smaller min-width so 2 cards can fit on tablets, 1 on mobile */
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    padding-bottom: 20px;
}

/* 3. Mobile Layout Overrides (Max-width: 768px) */
@media (max-width: 768px) {

    /* CAROUSEL: Show fewer items, but make them bigger/readable */
    .teachers-page {
        flex-wrap: nowrap; /* Keep them in a line if it's a slide */
        justify-content: center;
    }

    /* Show only 1 or 2 cards prominently depending on container width */
    .teachers-page .teacher-card {
        flex: 0 0 240px; /* Fixed standard width for tablet/large phone */
        width: 240px;
        max-width: 90%; /* Prevents overflow if screen is tiny */
        margin: 0 auto;
    }
}

/* 4. Small Mobile Layout Overrides (Max-width: 576px) */
@media (max-width: 576px) {

    /* GRID: Force single column for better aesthetics */
    .teachers-section .teachers-grid {
        grid-template-columns: 1fr; /* 1 card per row */
        padding: 0 10px;
    }

    /* CAROUSEL: Stack items or Show 1 Card */
    /* If your JS handles slides, this makes the active slide take full width */
    .teachers-page {
        flex-direction: row;
        gap: 0; /* Remove gap, handle spacing via padding */
    }

    .teachers-page .teacher-card {
        flex: 0 0 100%; /* Card takes full width of the container */
        width: 100%;
        max-width: 320px; /* Cap width for aesthetics */
        min-height: 300px; /* Give it breathing room */
        margin: 0 5px; /* Add slight side spacing */
        box-shadow: 0 4px 10px rgba(0,0,0,0.05); /* Lighter shadow on mobile */
    }

    /* Adjust Navigation Buttons for Mobile */
    .carousel-btn {
        width: 40px;
        height: 40px;
        background: rgba(255, 255, 255, 0.9); /* See-through background */
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }

    /* Move buttons slightly inward so they don't get cut off */
    .carousel-btn.prev-btn { left: 10px; }
    .carousel-btn.next-btn { right: 10px; }
    [dir="ltr"] .carousel-btn.prev-btn { left: 10px; }
    [dir="ltr"] .carousel-btn.next-btn { right: 10px; }

    /* Shrink Avatar slightly to save vertical space */
    .teacher-avatar {
        width: 90px;
        height: 90px;
        min-width: 90px;
        min-height: 90px;
    }
}


/**/

.teacher-card {
    /* 1. Reduce padding to create more internal space */
    padding: 20px 15px;

    /* 2. Increase min-height to accommodate all content */
    min-height: 380px; /* Increased from 320px */

    /* 3. Ensure the card can grow if content is huge */
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* This pushes stats to bottom, info to top */
}
/* Reduce space below the image */
.teacher-avatar {
    /* ... existing styles ... */
    margin: 0 auto 12px; /* Reduced from 20px */
}

/* Fix the info container */
.teacher-info {
    /* Remove flex: 1 so it doesn't aggressively stretch */
    flex: initial;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-bottom: 15px; /* Add space between text and stats */
}

/* Reduce space below name */
.teacher-name {
    /* ... existing styles ... */
    margin: 0 0 6px; /* Reduced from 10px */
}

/* Reduce space below subject */
.teacher-subject {
    /* ... existing styles ... */
    margin: 0; /* Remove bottom margin, let the container handle spacing */
}
.teacher-stats {
    margin-top: auto; /* This creates the "spring" effect pushing it to bottom */
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    width: 100%;
    flex-shrink: 0; /* Never let this section shrink/collapse */
}
