/* ============================================
   Калькулятор асфальта — Main Stylesheet
   ============================================ */

/* Variables */
:root {
    --primary: #1a6b3c;
    --primary-dark: #124d2b;
    --primary-light: #e8f5e9;
    --accent: #f59e0b;
    --accent-dark: #d97706;
    --text: #1f2937;
    --text-light: #6b7280;
    --bg: #ffffff;
    --bg-alt: #f3f7f4;
    --border: #d1d5db;
    --danger: #ef4444;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --max-width: 1100px;
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

/* Container */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #fff;
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.header__logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header__logo-icon {
    font-size: 2rem;
    line-height: 1;
}

.header__title {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
}

.header__subtitle {
    font-size: 0.8rem;
    opacity: 0.85;
    line-height: 1.2;
}

.header__nav {
    display: flex;
    gap: 8px;
}

.header__nav-link {
    color: rgba(255,255,255,0.9);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.header__nav-link:hover {
    background: rgba(255,255,255,0.15);
    text-decoration: none;
    color: #fff;
}

/* Hero */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, #1a8c4e 50%, var(--primary) 100%);
    color: #fff;
    padding: 64px 0 48px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.05) 0%, transparent 50%);
    pointer-events: none;
}

.hero__content {
    max-width: 720px;
    margin: 0 auto 32px;
    position: relative;
}

.hero__title {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.hero__text {
    font-size: 1.1rem;
    opacity: 0.9;
    line-height: 1.7;
    margin-bottom: 24px;
}

.hero__btn {
    display: inline-block;
    background: var(--accent);
    color: #1f2937;
    font-weight: 700;
    font-size: 1.05rem;
    padding: 14px 36px;
    border-radius: var(--radius);
    transition: all 0.3s;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
}

.hero__btn:hover {
    background: var(--accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(245, 158, 11, 0.5);
    text-decoration: none;
    color: #1f2937;
}

.hero__stats {
    display: flex;
    justify-content: center;
    gap: 48px;
    position: relative;
}

.hero__stat {
    text-align: center;
}

.hero__stat-num {
    display: block;
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1;
}

.hero__stat-label {
    font-size: 0.85rem;
    opacity: 0.85;
}

/* Sections */
.section {
    padding: 60px 0;
}

.section--alt {
    background: var(--bg-alt);
}

.section--results {
    background: linear-gradient(135deg, var(--primary-light), #fff);
    border-top: 3px solid var(--primary);
}

.section--results.hidden {
    display: none;
}

.section__title {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 12px;
    color: var(--text);
}

.section__desc {
    text-align: center;
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto 36px;
    font-size: 1.05rem;
}

/* Tabs */
.tabs {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.tabs__btn {
    padding: 12px 28px;
    border: 2px solid var(--border);
    background: #fff;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-light);
    transition: all 0.25s;
    font-family: inherit;
}

.tabs__btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.tabs__btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Forms */
.calc-form {
    background: #fff;
    padding: 36px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.calc-form__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group.hidden {
    display: none;
}

.form-label {
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.95rem;
    color: var(--text);
}

.form-input,
.form-select {
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
    background: #fff;
    color: var(--text);
    width: 100%;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 107, 60, 0.15);
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 4px;
}

/* Radio Buttons */
.radio-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.radio {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.95rem;
}

.radio input {
    display: none;
}

.radio__mark {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.radio input:checked + .radio__mark {
    border-color: var(--primary);
}

.radio input:checked + .radio__mark::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
}

.radio__text {
    line-height: 1;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
    font-family: inherit;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(26, 107, 60, 0.3);
}

.btn-secondary {
    background: #fff;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-secondary:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.results__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.results__header .section__title {
    margin-bottom: 0;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    font-size: 0.9rem;
    padding: 10px 20px;
}

.btn-danger:hover {
    background: #dc2626;
}

.calc-form__btn {
    width: 100%;
    font-size: 1.1rem;
    padding: 16px;
}

/* Results */
.results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 8px;
}

.result-card {
    background: #fff;
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    border: 1px solid var(--border);
    transition: transform 0.2s;
}

.result-card:hover {
    transform: translateY(-2px);
}

.result-card--primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.result-card--primary .result-card__value {
    color: #fff;
}

.result-card--primary .result-card__label {
    color: rgba(255,255,255,0.85);
}

.result-card__value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
    display: block;
    margin-bottom: 4px;
    line-height: 1.2;
}

.result-card__value small {
    font-size: 0.7em;
    font-weight: 400;
    color: var(--text-light);
}

.result-card--primary .result-card__value small {
    color: rgba(255,255,255,0.7);
}

.result-card__label {
    font-size: 0.9rem;
    color: var(--text-light);
}

.result-card__sublabel {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.result-details {
    grid-column: 1 / -1;
    background: #fff;
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.result-details__title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text);
}

.result-details__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.result-details__table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

.result-details__table td:last-child {
    text-align: right;
    font-weight: 600;
}

.result-details__table tr:last-child td {
    border-bottom: none;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--primary);
}

/* History */
.history__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.history__title {
    font-size: 1.2rem;
    font-weight: 700;
}

.history__list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history__empty {
    text-align: center;
    color: var(--text-light);
    padding: 40px 20px;
    background: #fff;
    border-radius: var(--radius);
    border: 2px dashed var(--border);
}

.history-item {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    cursor: pointer;
    transition: all 0.2s;
}

.history-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.history-item__info {
    flex: 1;
    min-width: 200px;
}

.history-item__title {
    font-weight: 600;
    margin-bottom: 2px;
}

.history-item__meta {
    font-size: 0.85rem;
    color: var(--text-light);
}

.history-item__weight {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--primary);
    white-space: nowrap;
}

.history-item__delete {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.history-item__delete:hover {
    color: var(--danger);
    background: #fee2e2;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
    margin-bottom: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: 0.95rem;
}

.table th,
.table td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background: var(--primary-light);
}

/* Reference Cards */
.ref-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.ref-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.ref-card__icon {
    font-size: 2.2rem;
    margin-bottom: 12px;
}

.ref-card__title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text);
}

.ref-card__list {
    list-style: none;
    font-size: 0.95rem;
}

.ref-card__list li {
    padding: 6px 0;
    border-bottom: 1px solid var(--bg-alt);
}

.ref-card__list li:last-child {
    border-bottom: none;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.info-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.info-card__title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--text);
}

.info-card__list {
    padding-left: 20px;
    font-size: 0.95rem;
}

.info-card__list li {
    padding: 5px 0;
}

.info-card__list strong {
    color: var(--text);
}

/* FAQ */
.faq {
    max-width: 720px;
    margin: 0 auto;
}

.faq__item {
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: #fff;
}

.faq__question {
    width: 100%;
    padding: 18px 24px;
    background: #fff;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    text-align: left;
    transition: background 0.2s;
}

.faq__question:hover {
    background: var(--bg-alt);
}

.faq__icon {
    font-size: 0.8rem;
    transition: transform 0.3s;
    flex-shrink: 0;
    color: var(--text-light);
}

.faq__question[aria-expanded="true"] .faq__icon {
    transform: rotate(180deg);
}

.faq__answer {
    display: none;
    padding: 0 24px 18px;
    font-size: 0.95rem;
    color: var(--text);
    line-height: 1.7;
}

.faq__answer p {
    margin-bottom: 8px;
}

.faq__answer ul,
.faq__answer ol {
    padding-left: 20px;
    margin-bottom: 8px;
}

.faq__answer li {
    padding: 3px 0;
}

.faq__answer strong {
    color: var(--primary);
}

/* Footer */
.footer {
    background: var(--primary-dark);
    color: rgba(255,255,255,0.8);
    padding: 28px 0;
    text-align: center;
    font-size: 0.9rem;
}

.footer__copy {
    margin-bottom: 6px;
}

.footer__info {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Print */
@media print {
    .header,
    .hero,
    .footer,
    .tabs,
    .calc-form__btn,
    .history__header {
        display: none !important;
    }
    .section--results {
        border: none;
        background: none;
    }
    .section--results.hidden {
        display: block !important;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .header__inner {
        flex-direction: column;
        text-align: center;
    }

    .header__logo {
        justify-content: center;
    }

    .header__nav {
        justify-content: center;
        flex-wrap: wrap;
    }

    .hero__title {
        font-size: 1.75rem;
    }

    .hero__text {
        font-size: 1rem;
    }

    .hero__stats {
        gap: 24px;
        flex-wrap: wrap;
    }

    .hero__stat-num {
        font-size: 1.6rem;
    }

    .section {
        padding: 40px 0;
    }

    .section__title {
        font-size: 1.5rem;
    }

    .calc-form {
        padding: 20px;
    }

    .calc-form__grid {
        grid-template-columns: 1fr;
    }

    .results {
        grid-template-columns: 1fr 1fr;
    }

    .result-card__value {
        font-size: 1.4rem;
    }

    .tabs__btn {
        padding: 10px 18px;
        font-size: 0.9rem;
    }

    .ref-cards,
    .info-grid {
        grid-template-columns: 1fr;
    }

    .history-item {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 40px 0 32px;
    }

    .hero__title {
        font-size: 1.4rem;
    }

    .results {
        grid-template-columns: 1fr;
    }

    .tabs {
        flex-direction: column;
    }

    .tabs__btn {
        width: 100%;
    }

    .table th,
    .table td {
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    .form-input,
    .form-select {
        font-size: 16px; /* Prevent zoom on mobile */
    }
}
