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

:root {
    --primary-blue: #0d3b66;
    --secondary-blue: #1a5490;
    --accent-blue: #4a90e2;
    --light-gray: #e8e8ed;
    --text-gray: #6c757d;
}

body {
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background:
        url("./assets/bg-triangles.webp"),
        linear-gradient(
            135deg,
            var(--primary-blue) 0%,
            var(--secondary-blue) 100%
        );
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    height: 100vh;
    margin: 0;
}

.search-section {
    padding: 2rem 1.5rem;
    position: relative;
    z-index: 1;
}

.search-container {
    max-width: 50rem;
    margin: 0 auto;
}

.search-title {
    color: white;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    margin-bottom: 1.25rem;
    text-align: center;
}

.search-box {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 1rem 3.5rem 1rem 1.25rem;
    border: none;
    border-radius: 0.75rem;
    font-size: 1rem;
    background: white;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.15);
    transition: box-shadow 0.2s ease;
}

.search-input:focus {
    outline: none;
    box-shadow: 0 0.375rem 1.25rem rgba(0, 0, 0, 0.2);
}

.search-icon {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    pointer-events: none;
}

.search-icon::before {
    content: '';
    position: absolute;
    width: 0.75rem;
    height: 0.75rem;
    border: 0.125rem solid var(--primary-blue);
    border-radius: 50%;
    top: 0;
    left: 0;
}

.search-icon::after {
    content: '';
    position: absolute;
    width: 0.375rem;
    height: 0.125rem;
    background: var(--primary-blue);
    transform: rotate(-45deg);
    bottom: 0.125rem;
    right: 0;
}

.results-count {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    margin-top: 0.75rem;
    text-align: center;
}

.container {
    width: 100%;
    height: calc(100vh - 12.5rem);
    overflow-x: scroll;
    overflow-y: hidden;
    padding: 1.25rem 0 0 0;
    position: relative;
    scroll-behavior: smooth;
    overscroll-behavior-x: contain;
    z-index: 1;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.container::-webkit-scrollbar {
    display: none;
}

.scroll-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    color: var(--primary-blue);
}

.scroll-btn:hover {
    background: white;
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.25);
    transform: translateY(-50%) scale(1.1);
}

.scroll-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.scroll-btn-left {
    left: 1.5rem;
}

.scroll-btn-right {
    right: 1.5rem;
}

.scroll-btn svg {
    width: 1.5rem;
    height: 1.5rem;
}

.scroll-btn.hidden {
    opacity: 0;
    pointer-events: none;
}

.grid-wrapper {
    display: inline-grid;
    grid-template-rows: repeat(auto-fill, 14rem);
    grid-auto-flow: column;
    grid-auto-columns: 16rem;
    gap: 1.25rem;
    padding: 0 1.25rem 2rem 1.25rem;
    height: calc(100% - 2.5rem);
    width: fit-content;
}

.teacher-card {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    border-left: 0.25rem solid var(--accent-blue);
}

.teacher-card:hover {
    transform: translateY(-0.375rem);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.15);
}

.teacher-avatar {
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
    border: 0.1875rem solid var(--light-gray);
    transition: border-color 0.2s ease;
}

.teacher-card:hover .teacher-avatar {
    border-color: var(--accent-blue);
}

.teacher-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-blue);
    margin-bottom: 0.375rem;
    line-height: 1.3;
}

.teacher-email {
    font-size: 0.75rem;
    color: var(--text-gray);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.hidden {
    display: none !important;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 59, 102, 0.85);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(0.5rem);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 1.25rem;
    padding: 2.5rem;
    max-width: 28rem;
    width: 90%;
    box-shadow: 0 1.25rem 3.75rem rgba(0, 0, 0, 0.3);
    position: relative;
    animation: modalSlideIn 0.3s ease;
    border-left: 0.3125rem solid var(--accent-blue);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(1.25rem);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: var(--light-gray);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--text-gray);
    transition: all 0.2s ease;
    font-weight: 300;
}

.modal-close:hover {
    background: var(--primary-blue);
    color: white;
}

.modal-avatar {
    width: 9rem;
    height: 9rem;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 1.5rem;
    display: block;
    border: 0.25rem solid var(--accent-blue);
}

.modal-name {
    font-size: clamp(1.25rem, 4vw, 1.75rem);
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 0.5rem;
    text-align: center;
}

.modal-email {
    font-size: 1rem;
    color: var(--text-gray);
    text-align: center;
    word-break: break-all;
    margin-bottom: 1.75rem;
    font-weight: 400;
}

.modal-email-link {
    display: inline-block;
    background: var(--accent-blue);
    color: white;
    padding: 0.875rem 2.25rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    margin: 0 auto;
    display: block;
    text-align: center;
    width: fit-content;
    box-shadow: 0 0.25rem 0.75rem rgba(74, 144, 226, 0.3);
}

.modal-email-link:hover {
    background: var(--secondary-blue);
    transform: translateY(-0.125rem);
    box-shadow: 0 0.375rem 1rem rgba(74, 144, 226, 0.4);
}

@media (max-width: 1024px) {
    .grid-wrapper {
        grid-template-rows: repeat(2, 14rem);
        grid-auto-columns: calc(48% - 0.5rem);
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .search-section {
        padding: 1.25rem 1rem;
    }
    
    .search-title {
        font-size: 1.5rem;
    }
    
    .search-input {
        padding: 0.875rem 3rem 0.875rem 1rem;
        font-size: 0.9375rem;
        border-radius: 0.625rem;
    }
    
    .container {
        height: calc(100vh - 11rem);
        padding: 1rem 0 0 0;
    }
    
    .scroll-btn {
        width: 2.5rem;
        height: 2.5rem;
    }
    
    .scroll-btn svg {
        width: 1.25rem;
        height: 1.25rem;
    }
    
    .scroll-btn-left {
        left: 0.5rem;
    }
    
    .scroll-btn-right {
        right: 0.5rem;
    }
    
    .grid-wrapper {
        grid-template-rows: repeat(2, 13rem);
        grid-auto-columns: 45vw;
        gap: 0.75rem;
        padding: 0 0.75rem 1.5rem 0.75rem;
        height: auto;
        min-height: calc(100% - 1.5rem);
    }
    
    .teacher-card {
        padding: 1rem;
        border-radius: 0.75rem;
        width: 100%;
        min-width: 0;
    }
    
    .teacher-avatar {
        width: 4rem;
        height: 4rem;
        margin-bottom: 0.75rem;
    }
    
    .teacher-name {
        font-size: 0.75rem;
    }
    
    .teacher-email {
        font-size: 0.625rem;
    }
    
    .modal-content {
        padding: 2rem 1.5rem;
        border-radius: 1rem;
        max-width: 90%;
    }
    
    .modal-avatar {
        width: 7rem;
        height: 7rem;
    }
    
    .modal-name {
        font-size: 1.25rem;
    }
    
    .modal-email {
        font-size: 0.875rem;
    }
    
    .modal-email-link {
        padding: 0.75rem 1.5rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .search-title {
        font-size: 1.25rem;
    }
    
    .container {
        height: calc(100vh - 10.5rem);
    }
    
    .grid-wrapper {
        grid-auto-columns: 44vw;
        grid-template-rows: repeat(2, 12rem);
        gap: 0.625rem;
        height: auto;
        min-height: calc(100% - 1.5rem);
    }
    
    .teacher-card {
        padding: 0.875rem;
        width: 100%;
        min-width: 0;
    }
    
    .teacher-avatar {
        width: 3.5rem;
        height: 3.5rem;
    }
    
    .teacher-name {
        font-size: 0.6875rem;
    }
    
    .teacher-email {
        font-size: 0.5625rem;
    }
    
    .scroll-btn {
        width: 2.25rem;
        height: 2.25rem;
    }
    
    .scroll-btn svg {
        width: 1rem;
        height: 1rem;
    }
}
