/* Сброс и базовые стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --primary-dark: #5a67d8;
    --primary-light: #7c3aed;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --white: #ffffff;
    
    --border-color: #e2e8f0;
    --border-focus: #667eea;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    --transition: all 0.2s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: var(--white);
    padding: 2rem 0;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

header h1 a {
    text-decoration: none;
    color: inherit;
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Навигация */
nav {
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

nav .container {
    display: flex;
    gap: 2rem;
}

nav a {
    color: var(--text-primary);
    text-decoration: none;
    padding: 1rem 0;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

nav a:hover {
    color: var(--primary-color);
}

nav a.active {
    color: var(--primary-color);
    font-weight: 600;
}

nav a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

/* Основной контент */
main {
    min-height: calc(100vh - 200px);
    padding: 3rem 0;
}

/* Hero секция */
.hero {
    text-align: center;
    margin-bottom: 4rem;
}

.hero h2 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

/* Сетка конвертеров */
.converter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.converter-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-decoration: none;
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.converter-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.converter-card .icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
}

.converter-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

.converter-card p {
    color: var(--text-secondary);
}

/* Популярные конвертации */
.popular-conversions {
    margin-bottom: 4rem;
}

.popular-conversions h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: 600;
}

.conversion-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.conversion-links a {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    font-size: 0.875rem;
}

.conversion-links a:hover {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

/* СОВРЕМЕННАЯ ФОРМА КОНВЕРТЕРА */
.converter-form.modern-style {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    margin: 2rem auto;
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 500px;
    position: relative;
    overflow: hidden;
}

.converter-form.modern-style::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb, #f5576c);
    border-radius: 24px 24px 0 0;
}

.converter-form.modern-style h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.75rem;
    position: relative;
}

.converter-form.modern-style h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    border-radius: 2px;
}

/* Структура формы */
.converter-form.modern-style .converter-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Поля ввода в современном стиле */
.converter-form.modern-style .converter-field {
    position: relative;
}

.converter-form.modern-style .converter-field label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.converter-form.modern-style .converter-field input,
.converter-form.modern-style .converter-field select {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    font-size: 1rem;
    color: var(--text-primary);
    background: #f9fafb;
    transition: all 0.3s ease;
    appearance: none;
    outline: none;
    text-align: center;
    font-weight: 500;
}

.converter-form.modern-style .converter-field input:focus,
.converter-form.modern-style .converter-field select:focus {
    border-color: var(--primary-color);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.converter-form.modern-style .converter-field input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

.converter-form.modern-style .converter-field input[type="number"] {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Select dropdown в современном стиле */
.converter-form.modern-style .converter-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23667eea'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 20px;
    padding-right: 3rem;
    cursor: pointer;
}

/* Кнопка обмена в современном стиле */
.converter-form.modern-style .converter-swap {
    display: flex;
    justify-content: center;
    margin: 0.5rem 0;
}

.converter-form.modern-style .swap-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    color: var(--white);
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    cursor: pointer;
    font-size: 1.25rem;
    transition: all 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.converter-form.modern-style .swap-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
    border-radius: 50%;
    transition: all 0.3s ease;
    opacity: 0;
}

.converter-form.modern-style .swap-btn:hover {
    transform: rotate(180deg) scale(1.1);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4);
}

.converter-form.modern-style .swap-btn:hover::before {
    opacity: 1;
}

/* Градиентная кнопка конвертации в современном стиле */
.converter-form.modern-style .convert-btn,
.converter-form.modern-style button[type="submit"] {
    width: 100%;
    padding: 1.125rem 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    color: var(--white);
    border: none;
    border-radius: 16px;
    font-size: 1.125rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
    margin-top: 0.5rem;
}

.converter-form.modern-style .convert-btn:hover,
.converter-form.modern-style button[type="submit"]:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.4);
}

/* Анимация блеска кнопки в современном стиле */
.converter-form.modern-style .convert-btn::before,
.converter-form.modern-style button[type="submit"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.converter-form.modern-style .convert-btn:hover::before,
.converter-form.modern-style button[type="submit"]:hover::before {
    left: 100%;
}

/* СОХРАНЯЕМ СТАРЫЕ СТИЛИ ДЛЯ СОВМЕСТИМОСТИ */
.converter-form:not(.modern-style) {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.converter-form:not(.modern-style) h2 {
    color: var(--text-primary);
    margin-bottom: 2rem;
    text-align: center;
    font-weight: 600;
    font-size: 1.5rem;
}

/* Старая сетка для обратной совместимости */
.converter-form:not(.modern-style) .input-group {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1.5rem;
    align-items: center;
    margin-bottom: 2rem;
}

.converter-form:not(.modern-style) .input-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.converter-form:not(.modern-style) .input-section input,
.converter-form:not(.modern-style) .input-section select {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    color: var(--text-primary);
    transition: var(--transition);
    background: var(--white);
    text-align: center;
}

.converter-form:not(.modern-style) .input-section input:focus,
.converter-form:not(.modern-style) .input-section select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.converter-form:not(.modern-style) .input-section input[type="number"] {
    font-size: 1.25rem;
    font-weight: 600;
}

.converter-form:not(.modern-style) .input-section select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%232563eb'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px;
    padding-right: 3rem;
    cursor: pointer;
}

.converter-form:not(.modern-style) .swap-btn {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    cursor: pointer;
    font-size: 1.25rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.converter-form:not(.modern-style) .swap-btn:hover {
    background: var(--primary-dark);
    transform: rotate(180deg);
}

.converter-form:not(.modern-style) button[type="submit"] {
    width: 100%;
    padding: 1rem 1.5rem;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.converter-form:not(.modern-style) button[type="submit"]:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Виджет конвертера */
.converter-widget {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.converter-widget h2 {
    color: var(--text-primary);
    margin-bottom: 2rem;
    text-align: center;
    font-weight: 600;
    font-size: 1.5rem;
}

.input-wrapper {
    position: relative;
}

.input-wrapper label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
}

.input-wrapper input,
.input-wrapper select {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: var(--transition);
    background: var(--white);
    color: var(--text-primary);
}

.input-wrapper input:focus,
.input-wrapper select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-wrapper input::placeholder {
    color: var(--text-light);
}

.swap-button {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    margin: 1rem auto;
}

.swap-button:hover {
    background: var(--primary-dark);
    transform: rotate(180deg);
}

.convert-button {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.convert-button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* Результат конвертации */
.conversion-result, .result-display {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.conversion-result h1, .result-display h2 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-weight: 600;
}

.conversion-result .result-number, .result-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.conversion-result .result-words, .result-text {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Информационные секции */
.info-section, .conversion-details, .related-conversions {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.info-section h2, .conversion-details h3, .related-conversions h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-weight: 600;
}

.info-section h3, .conversion-details h4 {
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    margin-top: 1rem;
    font-weight: 600;
}

.formula-box {
    background: var(--bg-secondary);
    border-left: 4px solid var(--primary-color);
    padding: 1rem;
    margin: 1rem 0;
    font-family: 'Monaco', 'Consolas', monospace;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

/* Таблицы */
.conversion-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.conversion-table th {
    background: var(--primary-color);
    color: var(--white);
    font-weight: 600;
    padding: 0.75rem;
    text-align: left;
}

.conversion-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.conversion-table tr:hover {
    background: var(--bg-secondary);
}

.conversion-table tr:last-child td {
    border-bottom: none;
}

/* Сетки карточек */
.features-grid, .units-grid, .systems-grid, .facts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.feature, .unit-card, .system-card, .fact-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.feature:hover, .unit-card:hover, .system-card:hover, .fact-card:hover {
    box-shadow: var(--shadow-md);
}

.feature h3, .unit-card h3, .system-card h3, .fact-card h3 {
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

/* Footer */
footer {
    background: var(--text-primary);
    color: var(--white);
    padding: 2rem 0;
    margin-top: 3rem;
}

footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--white);
}

/* Адаптивный дизайн */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    header {
        padding: 1.5rem 0;
    }
    
    header h1 {
        font-size: 1.75rem;
    }
    
    .tagline {
        font-size: 1rem;
    }
    
    nav .container {
        gap: 1rem;
        overflow-x: auto;
    }
    
    nav a {
        white-space: nowrap;
        padding: 1rem 0.5rem;
    }
    
    main {
        padding: 2rem 0;
    }
    
    .hero h2 {
        font-size: 1.5rem;
    }
    
    .converter-grid {
        grid-template-columns: 1fr;
    }
    
    /* Мобильные стили для современного дизайна */
    .converter-form.modern-style {
        padding: 2rem 1.5rem;
        margin: 1rem;
        max-width: 100%;
    }
    
    .converter-form.modern-style .converter-layout {
        gap: 1.25rem;
    }
    
    .converter-form.modern-style .swap-btn {
        width: 48px;
        height: 48px;
        font-size: 1.1rem;
    }
    
    .converter-form.modern-style .convert-btn,
    .converter-form.modern-style button[type="submit"] {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
    
    /* Мобильные стили для старого дизайна */
    .converter-form:not(.modern-style) {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .converter-form:not(.modern-style) .input-group {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .converter-form:not(.modern-style) .swap-btn {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
        margin: 0.5rem auto;
    }
    
    .conversion-result .result-number, .result-value {
        font-size: 1.5rem;
    }
    
    footer .container {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .footer-links {
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .converter-card, .converter-form, .info-section {
        padding: 1.25rem;
    }
    
    .conversion-links a {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .hero h2 {
        font-size: 1.25rem;
    }
}