/* ========== БАЗОВЫЕ СТИЛИ ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #fafafa;
    --text-primary: #000000;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --accent-color: #000000;
    --hover-bg: #f5f5f5;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --header-height: 70px;
    --mobile-padding: 16px;
    --touch-target: 44px;
}

/* Улучшенная поддержка тач-устройств */
@media (hover: none) and (pointer: coarse) {
    * {
        -webkit-tap-highlight-color: transparent;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========== HEADER ========== */
.header {
    position: sticky;
    top: 0;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.5px;
    transition: var(--transition);
}

.logo:hover {
    opacity: 0.7;
    transform: translateY(-2px);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 40px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 15px;
    position: relative;
    transition: var(--transition);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--text-primary);
    transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* ========== ВЫПАДАЮЩЕЕ МЕНЮ "ВСЕ СТРАНИЦЫ" ========== */

.all-pages-dropdown {
    position: relative;
}

.all-pages-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.all-pages-btn svg {
    transition: transform 0.3s ease;
}

.all-pages-dropdown.active .all-pages-btn svg {
    transform: rotate(180deg);
}

.all-pages-menu {
    position: absolute;
    top: calc(100% + 20px);
    right: 0;
    width: 280px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    max-height: 70vh;
    overflow-y: auto;
}

.all-pages-dropdown.active .all-pages-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.pages-menu-section {
    padding: 16px;
}

.pages-menu-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.pages-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
    margin-bottom: 4px;
}

.pages-menu-item:hover {
    background-color: var(--hover-bg);
    transform: translateX(4px);
}

.pages-menu-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 8px 16px;
}

.burger-menu {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    position: relative;
    z-index: 1001;
    min-width: var(--touch-target);
    min-height: var(--touch-target);
    justify-content: center;
    align-items: center;
}

.burger-menu span {
    width: 25px;
    height: 2px;
    background-color: var(--text-primary);
    transition: var(--transition);
    transform-origin: center;
}

.burger-menu.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.burger-menu.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.burger-menu.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ========== MAIN CONTENT ========== */
.main {
    min-height: calc(100vh - 200px);
}

.hero {
    padding: 60px 0 100px;
}

.hero-content {
    text-align: center;
    margin-bottom: 50px;
    animation: fadeInUp 0.8s ease-out;
}

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

.hero-title {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 15px;
    letter-spacing: -1px;
}

.hero-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
}

/* ========== EXCHANGE CARD ========== */
.exchange-card {
    max-width: 600px;
    margin: 0 auto 60px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 40px;
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
    transition: var(--transition);
}

.exchange-card:hover {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
    transform: translateY(-5px);
}

.exchange-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.exchange-header h2 {
    font-size: 24px;
    font-weight: 600;
}

.rate-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.rate-label {
    color: var(--text-secondary);
}

.rate-value {
    font-weight: 600;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* ========== FORM STYLES ========== */
.exchange-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-group {
    position: relative;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: var(--transition);
}

.input-wrapper:focus-within {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.form-input {
    flex: 1;
    padding: 16px;
    border: none;
    outline: none;
    font-size: 16px;
    background-color: transparent;
    font-family: inherit;
}

.form-input::placeholder {
    color: #cccccc;
}

.currency-select {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
}

.currency-select:hover {
    opacity: 0.7;
}

.currency-icon {
    font-size: 20px;
    font-weight: 600;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.currency-icon-lg {
    font-size: 24px;
    font-weight: 600;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: var(--hover-bg);
}

.currency-code {
    font-weight: 600;
    font-size: 14px;
}

.dropdown-icon {
    transition: var(--transition);
}

.currency-select.active .dropdown-icon {
    transform: rotate(180deg);
}

.currency-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 250px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    z-index: 100;
    overflow: hidden;
}

.currency-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.currency-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: var(--transition);
}

.currency-option:hover {
    background-color: var(--hover-bg);
}

.currency-option img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.currency-option span {
    font-size: 14px;
}

/* ========== SWAP BUTTON ========== */
.swap-button {
    align-self: center;
    width: 48px;
    height: 48px;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background-color: var(--bg-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    margin: -8px 0;
}

.swap-button:hover {
    background-color: var(--text-primary);
    border-color: var(--text-primary);
    transform: rotate(180deg);
}

.swap-button:hover svg {
    color: var(--bg-primary);
}

.swap-button svg {
    transition: var(--transition);
}

/* ========== SUBMIT BUTTON ========== */
.submit-button {
    padding: 16px 32px;
    background-color: var(--text-primary);
    color: var(--bg-primary);
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    margin-top: 8px;
}

.submit-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.submit-button:active {
    transform: translateY(0);
}

/* ========== FEATURES ========== */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    max-width: 900px;
    margin: 0 auto;
}

.feature-card {
    text-align: center;
    padding: 30px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: var(--transition);
    animation: fadeInUp 0.8s ease-out backwards;
}

.feature-card:nth-child(1) {
    animation-delay: 0.3s;
}

.feature-card:nth-child(2) {
    animation-delay: 0.4s;
}

.feature-card:nth-child(3) {
    animation-delay: 0.5s;
}

@media (min-width: 769px) {
    .feature-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    }
}

.feature-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.feature-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.feature-text {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ========== FOOTER ========== */
.footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 60px 0 30px;
    margin-top: 100px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 10px;
}

.footer-text {
    color: var(--text-secondary);
    font-size: 14px;
}

.footer-heading {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--text-primary);
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}

.footer-bottom p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ========== RESPONSIVE ========== */

/* Планшеты и ниже */
@media (max-width: 1024px) {
    .container {
        padding: 0 var(--mobile-padding);
    }
}

/* Мобильные устройства */
@media (max-width: 768px) {
    /* Улучшенное мобильное меню */
    .nav-menu {
        position: fixed;
        top: var(--header-height);
        left: 0;
        width: 100%;
        height: calc(100vh - var(--header-height));
        flex-direction: column;
        background-color: var(--bg-primary);
        padding: 20px var(--mobile-padding);
        gap: 0;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        z-index: 1002;
    }

    .nav-menu.active {
        transform: translateX(0);
    }

    .nav-menu li {
        display: block !important;
        border-bottom: 1px solid var(--border-color);
    }

    .nav-menu li:last-child {
        border-bottom: none;
    }

    .nav-link {
        display: block;
        padding: 20px 0;
        font-size: 18px;
        min-height: var(--touch-target);
        color: var(--text-primary);
    }

    .nav-link::after {
        display: none;
    }

    /* Выпадающее меню на мобильных */
    .all-pages-dropdown {
        border-bottom: 1px solid var(--border-color);
    }

    .all-pages-btn {
        width: 100%;
        justify-content: space-between;
        padding: 20px 0;
        font-size: 18px;
    }

    .all-pages-menu {
        position: static;
        width: 100%;
        border: none;
        border-radius: 0;
        box-shadow: none;
        transform: none;
        max-height: 0;
        overflow: hidden;
        background-color: var(--bg-secondary);
        margin-top: 0;
        z-index: 1003;
        opacity: 0;
        visibility: hidden;
        transition: max-height 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
    }

    .all-pages-dropdown.active .all-pages-menu {
        max-height: 500px;
        margin-top: 8px;
        opacity: 1;
        visibility: visible;
    }

    .pages-menu-section {
        padding: 12px;
    }

    .pages-menu-item {
        padding: 12px;
        min-height: var(--touch-target);
    }

    .burger-menu {
        display: flex;
        order: 3;
    }

    /* Оверлей при открытом меню */
    body.menu-open::after {
        content: '';
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 999;
        animation: fadeIn 0.3s ease-out;
    }

    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }

    /* Hero секция */
    .hero {
        padding: 40px 0 60px;
    }

    .hero-title {
        font-size: 36px;
        line-height: 1.2;
    }

    .hero-subtitle {
        font-size: 16px;
    }

    /* Карточка обмена */
    .exchange-card {
        padding: 24px var(--mobile-padding);
        margin-bottom: 40px;
    }

    .exchange-card:hover {
        transform: none;
    }

    .exchange-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .exchange-header h2 {
        font-size: 22px;
    }

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

    /* Форма */
    .form-input {
        padding: 14px;
        font-size: 16px; /* Предотвращает зум на iOS */
    }

    .currency-dropdown {
        width: 100%;
        left: 0;
        right: 0;
    }

    .currency-option {
        padding: 16px;
        min-height: var(--touch-target);
    }

    /* Кнопка swap */
    .swap-button {
        width: 44px;
        height: 44px;
        margin: -4px 0;
    }

    /* Кнопка отправки */
    .submit-button {
        padding: 16px;
        font-size: 16px;
        width: 100%;
    }

    /* Карточки преимуществ */
    .features {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .feature-card {
        padding: 24px;
    }

    /* Футер */
    .footer {
        padding: 40px 0 20px;
        margin-top: 60px;
    }

    .footer-content {
        gap: 30px;
    }
}

/* Маленькие мобильные устройства */
@media (max-width: 480px) {
    .hero-title {
        font-size: 28px;
    }

    .hero-subtitle {
        font-size: 15px;
    }

    .exchange-card {
        border-radius: 0;
        border-left: none;
        border-right: none;
        padding: 20px var(--mobile-padding);
    }

    .exchange-header h2 {
        font-size: 20px;
    }

    .form-label {
        font-size: 13px;
    }

    .currency-code {
        font-size: 13px;
    }

    .feature-card {
        padding: 20px;
    }

    .feature-icon {
        font-size: 36px;
    }

    .feature-title {
        font-size: 18px;
    }
}

/* Ландшафтная ориентация на мобильных */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        padding: 30px 0 40px;
    }

    .hero-title {
        font-size: 28px;
    }
}

/* Очень большие экраны */
@media (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }

    .hero-title {
        font-size: 56px;
    }

    .hero-subtitle {
        font-size: 20px;
    }
}

/* Поддержка темной темы системы (опционально) */
@media (prefers-color-scheme: dark) {
    /* Можно добавить темную тему */
}

/* Улучшение производительности анимаций */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========== FOOTER PARTNERS SECTION ========== */
.footer-partners-section {
    padding: 20px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 20px;
}

.footer-partners-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.footer-partners-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.footer-partner-card {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: all 0.3s ease;
    min-width: 100px;
    min-height: 40px;
}

.footer-partner-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.footer-partner-logo {
    max-width: 100px;
    max-height: 32px;
    object-fit: contain;
    filter: brightness(0.9) grayscale(30%);
    transition: filter 0.3s ease;
}

.footer-partner-card:hover .footer-partner-logo {
    filter: brightness(1) grayscale(0%);
}

@media (max-width: 768px) {
    .footer-partners-section {
        padding: 16px 0;
    }

    .footer-partners-grid {
        gap: 12px;
    }

    .footer-partner-card {
        padding: 6px 12px;
        min-width: 80px;
        min-height: 32px;
    }

    .footer-partner-logo {
        max-width: 80px;
        max-height: 24px;
    }
}
