/* ==========================================
   CSS CUSTOM PROPERTIES
   ========================================== */
:root {
    --text-color: #111517;
    --header-bg-color: #ffffff;
    --input-search-color: #848484;
    --main-bg-color: #fafafa;
    --card-shadow: 0px 2px 9px 0px rgba(0, 0, 0, 0.05);
    --select-text-color: #111517;
}

.dark-mode {
    --text-color: #ffffff;
    --header-bg-color: #2B3844;
    --input-search-color: #ffffff;
    --main-bg-color: #202C36;
    --select-text-color: #ffffff;
}

/* ==========================================
   GLOBAL
   ========================================== */
html {
    box-sizing: border-box;
    height: 100%;
    scroll-behavior: smooth;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

*:focus {
    outline: 2px dashed #1e90ff;
    outline-offset: 3px;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    text-decoration: none;
    color: var(--text-color);
}

h2, h3, p {
    margin: 0;
}

body {
    font-size: 14px;
    font-weight: 300;
    line-height: 16px;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: 0;
    margin: 0;
    font-family: "Nunito Sans", "Arial", sans-serif;
    background-color: var(--main-bg-color);
    color: var(--text-color);
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* ==========================================
   VISUALLY HIDDEN
   ========================================== */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    border: 0;
    padding: 0;
    clip: rect(0 0 0 0);
    overflow: hidden;
}

/* ==========================================
   CONTAINER
   ========================================== */
.container {
    width: 100%;
    max-width: 1320px;
    padding-left: 20px;
    padding-right: 20px;
    margin-left: auto;
    margin-right: auto;
}

/* ==========================================
   LOADER
   ========================================== */
.loader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--main-bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader-wrapper.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--header-bg-color);
    border-top-color: #1e90ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================
   HEADER
   ========================================== */
.site-header {
    box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06);
    margin-bottom: 48px;
    background-color: var(--header-bg-color);
    transition: background-color 0.4s ease;
}

.site-header-container {
    padding: 23px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-header-logo {
    text-decoration: none;
    font-size: 24px;
    font-weight: 800;
    line-height: 33px;
    transition: opacity 0.3s ease;
}

.site-header-logo:hover {
    opacity: 0.8;
}

.site-header-logo:active {
    opacity: 0.6;
}

.dark-mode-bottom-wrapper {
    display: flex;
}

.dark-mode-bottom-link {
    display: flex;
    cursor: pointer;
    background-color: transparent;
    border: 0;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    line-height: 22px;
    color: var(--text-color);
    transition: opacity 0.3s ease;
}

.dark-mode-bottom-link:hover {
    opacity: 0.8;
}

.dark-mode-bottom-link:active {
    opacity: 0.6;
}

.moon-icon {
    width: 20px;
    height: 20px;
}

/* ==========================================
   HERO SECTION (Search + Filter)
   ========================================== */
.hero-section-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 48px;
}

.hero-section-search-form-wrapper {
    flex: 0 1 480px;
}

.hero-section-search-form-wrapper input {
    color: var(--input-search-color);
    font-weight: 400;
    font-size: 14px;
    line-height: 20px;
    border: none;
    width: 100%;
    padding: 18px 20px 18px 74px;
    background-image: url(../img/search-icon.svg);
    background-repeat: no-repeat;
    background-position: 28px center;
    background-color: var(--header-bg-color);
    border-radius: 5px;
    box-shadow: var(--card-shadow);
    transition: background-color 0.4s ease, color 0.4s ease, box-shadow 0.3s ease;
}

.hero-section-search-form-wrapper input:focus {
    box-shadow: 0px 2px 12px 0px rgba(30, 144, 255, 0.25);
    outline: none;
}

.hero-section-search-form-wrapper input::placeholder {
    color: var(--input-search-color);
}

.hero-section-select-wrapper {
    cursor: pointer;
    border: 0;
    padding: 18px 45px 18px 24px;
    border-radius: 5px;
    box-shadow: var(--card-shadow);
    background-color: var(--header-bg-color);
    width: 200px;
    appearance: none;
    background-image: url(../img/to-bottom-icon.svg);
    background-repeat: no-repeat;
    background-position: right 1rem top 50%;
    background-size: 0.65rem auto;
    color: var(--select-text-color);
    font-weight: 400;
    font-size: 14px;
    line-height: 20px;
    transition: background-color 0.4s ease, color 0.4s ease, box-shadow 0.3s ease;
}

.hero-section-select-wrapper:focus {
    box-shadow: 0px 2px 12px 0px rgba(30, 144, 255, 0.25);
    outline: none;
}

/* ==========================================
   CARDS GRID
   ========================================== */
.main-section-cards-wrapper {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 75px;
}

.main-section-card-wrapper {
    border-radius: 5px;
    box-shadow: 0px 0px 7px 2px rgba(0, 0, 0, 0.03);
    background-color: var(--header-bg-color);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.4s ease;
    display: block;
    color: var(--text-color);
}

.main-section-card-wrapper:hover {
    transform: translateY(-5px);
    box-shadow: 0px 8px 24px rgba(0, 0, 0, 0.1);
}

.main-section-card-wrapper:active {
    transform: translateY(-2px);
}

.main-section-card-wrapper.hidden-card {
    display: none;
}

.main-section-card-wrapper img {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.card-text-wrapper {
    padding: 24px 24px 38px;
}

.card-text-wrapper h3 {
    font-size: 18px;
    font-weight: 800;
    line-height: 26px;
    margin-bottom: 16px;
}

.card-text-wrapper p {
    color: var(--text-color);
    margin-bottom: 8px;
}

.card-text-wrapper p:last-child {
    margin-bottom: 0;
}

.card-text-wrapper p strong {
    font-weight: 600;
}

/* No results */
.no-results-message {
    display: none;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    padding: 60px 20px;
    color: var(--text-color);
}

.no-results-message.visible {
    display: block;
}

/* ==========================================
   CARD INNER PAGE
   ========================================== */
.card-inner-main-section-container {
    padding: 48px 20px 80px;
}

.back-button-wrapper {
    margin-bottom: 64px;
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background-color: var(--header-bg-color);
    color: var(--text-color);
    font-size: 16px;
    line-height: 20px;
    padding: 10px 32px;
    border: 0;
    border-radius: 6px;
    box-shadow: 0px 0px 7px 0px rgba(0, 0, 0, 0.29);
    text-decoration: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.4s ease;
}

.back-button:hover {
    transform: translateY(-2px);
    box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.15);
}

.back-button:active {
    transform: translateY(0);
}

.back-icon {
    width: 20px;
    height: 20px;
}

.big-card-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 80px;
}

.big-img {
    flex: 0 1 560px;
    max-width: 560px;
    height: auto;
    border-radius: 7px;
}

.big-card-info-wrapper {
    flex: 1;
    min-width: 300px;
}

.big-card-info-h2 {
    margin-bottom: 23px;
    font-size: 32px;
    font-weight: 800;
    line-height: 44px;
}

.about-section-wrapper {
    display: flex;
    justify-content: space-between;
    gap: 40px;
    margin-bottom: 48px;
}

.about-section-right-left p {
    font-size: 16px;
    line-height: 32px;
}

.about-section-right-left p:not(:last-child) {
    margin-bottom: 5px;
}

.about-section-right-left strong {
    font-size: 16px;
    font-weight: 600;
    line-height: 32px;
}

.border-countries-wrapper {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.border-countries-wrapper-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 24px;
    white-space: nowrap;
}

.border-countries-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.border-countries-wrapper-country-name {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 19px;
    padding: 5px 24px;
    border-radius: 2px;
    box-shadow: 0px 0px 4px 1px rgba(0, 0, 0, 0.1);
    background-color: var(--header-bg-color);
    font-size: 14px;
    transition: background-color 0.4s ease;
}

/* ==========================================
   DARK MODE SVG ADJUSTMENTS
   ========================================== */
.dark-mode .hero-section-search-form-wrapper input {
    background-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M12.5 11H11.7L11.4 10.7C12.4 9.6 13 8.1 13 6.5C13 2.9 10.1 0 6.5 0C2.9 0 0 2.9 0 6.5C0 10.1 2.9 13 6.5 13C8.1 13 9.6 12.4 10.7 11.4L11 11.7V12.5L16 17.5L17.5 16L12.5 11ZM6.5 11C4 11 2 9 2 6.5C2 4 4 2 6.5 2C9 2 11 4 11 6.5C11 9 9 11 6.5 11Z' fill='%23ffffff'/%3E%3C/svg%3E");
}

.dark-mode .hero-section-select-wrapper {
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M9.45 3.45L6 6.9L2.55 3.45L1.5 4.5L6 9L10.5 4.5L9.45 3.45Z' fill='%23ffffff'/%3E%3C/svg%3E");
}

/* ==========================================
   RESPONSIVE - TABLET (max-width: 992px)
   ========================================== */
@media (max-width: 992px) {
    .site-header-logo {
        font-size: 20px;
    }

    .main-section-cards-wrapper {
        grid-template-columns: repeat(3, 1fr);
        gap: 50px;
    }

    .big-card-wrapper {
        gap: 50px;
    }

    .big-img {
        flex: 0 1 100%;
        max-width: 100%;
    }

    .big-card-info-wrapper {
        min-width: 100%;
    }

    .about-section-wrapper {
        gap: 30px;
    }
}

/* ==========================================
   RESPONSIVE - SMALL TABLET (max-width: 768px)
   ========================================== */
@media (max-width: 768px) {
    .site-header {
        margin-bottom: 32px;
    }

    .hero-section-container {
        flex-direction: column;
        align-items: stretch;
        gap: 24px;
        margin-bottom: 32px;
    }

    .hero-section-search-form-wrapper {
        flex: 1;
    }

    .hero-section-search-form-wrapper input {
        width: 100%;
    }

    .hero-section-select-wrapper {
        width: 200px;
    }

    .main-section-cards-wrapper {
        grid-template-columns: repeat(2, 1fr);
        gap: 40px;
    }

    .big-card-info-h2 {
        font-size: 26px;
        line-height: 36px;
    }

    .about-section-wrapper {
        flex-direction: column;
        gap: 24px;
        margin-bottom: 36px;
    }

    .border-countries-wrapper {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-inner-main-section-container {
        padding: 32px 20px 60px;
    }

    .back-button-wrapper {
        margin-bottom: 48px;
    }
}

/* ==========================================
   RESPONSIVE - MOBILE (max-width: 480px)
   ========================================== */
@media (max-width: 480px) {
    .site-header-container {
        padding: 18px 16px;
    }

    .site-header-logo {
        font-size: 16px;
        line-height: 24px;
    }

    .dark-mode-bottom-link {
        font-size: 14px;
        gap: 6px;
    }

    .moon-icon {
        width: 16px;
        height: 16px;
    }

    .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    .hero-section-search-form-wrapper input {
        padding: 14px 16px 14px 52px;
        background-position: 16px center;
        font-size: 12px;
    }

    .hero-section-select-wrapper {
        width: 100%;
        padding: 14px 40px 14px 16px;
        font-size: 12px;
    }

    .main-section-cards-wrapper {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .main-section-card-wrapper img {
        height: 180px;
    }

    .card-text-wrapper {
        padding: 20px 20px 28px;
    }

    .card-text-wrapper h3 {
        font-size: 16px;
        line-height: 22px;
    }

    .big-card-info-h2 {
        font-size: 22px;
        line-height: 30px;
    }

    .about-section-right-left p,
    .about-section-right-left strong {
        font-size: 14px;
        line-height: 28px;
    }

    .border-countries-wrapper-title {
        font-size: 14px;
    }

    .back-button {
        padding: 8px 24px;
        font-size: 14px;
    }

    .card-inner-main-section-container {
        padding: 24px 16px 40px;
    }

    .back-button-wrapper {
        margin-bottom: 40px;
    }
}
