/* =========================================================
   STYLES.CSS
   Структура, розміри, відступи, сітки, форма елементів
========================================================= */

/* ================= БАЗОВА СТРУКТУРА ================= */

html,
body {
    min-height: 100%;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: "Roboto", Arial, sans-serif;
    padding-top: 96px;
}

main {
    flex: 1;
}

.main-content {
    margin-top: 10px;
    margin-bottom: 10px;
}

/* ================= НАВІГАЦІЯ ТА ЛОГО ================= */

.custom-nav {
    min-height: 86px;
    padding-top: 8px;
    padding-bottom: 8px;
}

    .custom-nav .container {
        display: flex;
        align-items: center;
    }

    .custom-nav .navbar-brand.brand-block {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 16px !important;
        min-height: 76px;
        margin: 0 !important;
        padding: 0 !important;
        text-decoration: none;
    }

    .custom-nav .brand-logo {
        width: 72px !important;
        height: 72px !important;
        max-width: 72px !important;
        max-height: 72px !important;
        object-fit: contain !important;
        display: block !important;
        flex-shrink: 0 !important;
    }

    .custom-nav .brand-text {
        display: inline-flex !important;
        align-items: center !important;
        font-size: 1.6rem !important;
        font-weight: 700 !important;
        line-height: 1 !important;
        white-space: nowrap !important;
        margin: 0 !important;
        padding: 0 !important;
        transform: translateY(1px);
    }

.nav-custom {
    align-items: center;
    gap: 4px;
}

.custom-nav .nav-link {
    border-radius: 8px;
    padding: 8px 10px !important;
    font-weight: 500;
}

    .custom-nav .nav-link.active {
        font-weight: 700;
    }

/* ================= HERO ТА ОСНОВНІ СЕКЦІЇ ================= */

.hero-section {
    padding: 58px 15px;
    margin-bottom: 10px;
}

    .hero-section h1 {
        font-size: clamp(2rem, 4vw, 3.2rem);
        font-weight: 700;
        margin-bottom: 14px;
    }

.hero-subtitle {
    max-width: 900px;
    margin: 0 auto;
    font-size: 1.15rem;
    line-height: 1.6;
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 22px;
    padding-bottom: 8px;
    border-bottom: 2px solid;
}

/* ================= ЗАГАЛЬНІ КАРТКИ ТА КНОПКИ ================= */

.card,
.feature-card,
.contact-card,
.project-card,
.admin-stat-card,
.auth-card {
    border-style: solid;
    border-width: 1px;
}

.card {
    border-radius: 12px;
}

.feature-card {
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

    .feature-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
    }

    .feature-card h4 {
        font-weight: 700;
    }

    .feature-card a {
        font-weight: 600;
        text-decoration: none;
    }

        .feature-card a:hover {
            text-decoration: underline;
        }

.contact-card {
    border-left-width: 5px;
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

.info-list {
    padding-left: 20px;
}

    .info-list li {
        margin-bottom: 8px;
    }

.btn-main {
    min-height: 42px;
    border: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
}

/* ================= ТАБЛИЦІ ================= */

.table-custom {
    width: 100%;
    vertical-align: middle;
}

    .table-custom th,
    .table-custom td {
        padding: 12px;
        vertical-align: middle;
    }

.table-responsive {
    border-radius: 8px;
}

/* ================= ФОРМИ ================= */

.form-control,
.form-select {
    min-height: 44px;
}

textarea.form-control {
    min-height: 110px;
}

/* ================= КАЛЬКУЛЯТОРИ ================= */

.calculator-section-card {
    width: 100%;
    min-height: 150px;
    border-width: 2px;
    border-style: solid;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
}

    .calculator-section-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
    }

    .calculator-section-card img {
        width: 54px;
        height: 54px;
        object-fit: contain;
        margin-bottom: 12px;
    }

    .calculator-section-card span {
        display: block;
        font-weight: 600;
    }

.formula-info h3 {
    font-size: 1.3rem;
    font-weight: 700;
}

.formula-box,
.calculation-result {
    border-left-width: 5px;
    border-left-style: solid;
    padding: 16px;
    border-radius: 8px;
}

.formula-box {
    font-size: 1.3rem;
    font-weight: 700;
}

.calculation-result {
    padding: 18px;
}

.result-value {
    font-size: 1.4rem;
    font-weight: 700;
}

.chart-wrapper {
    position: relative;
    width: 100%;
    min-height: 320px;
}

#formulaChart {
    max-height: 420px;
}

.chart-empty-message {
    padding: 16px 20px;
    border-radius: 8px;
}

/* ================= МІЙ КАБІНЕТ ================= */

.nav-tabs .nav-link {
    font-weight: 500;
}

.project-card {
    border-width: 2px;
    border-style: solid;
    border-radius: 12px;
    padding: 18px;
    height: 100%;
}

    .project-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
    }

.project-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

    .project-card-header img {
        width: 42px;
        height: 42px;
        object-fit: contain;
    }

.project-card-title {
    font-weight: 700;
    margin: 0;
}

.project-card-description {
    min-height: 48px;
}

.project-items-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.project-item {
    border-width: 1px;
    border-style: solid;
    border-left-width: 5px;
    border-radius: 8px;
    padding: 14px;
}

.project-item-title {
    font-weight: 700;
    margin-bottom: 6px;
}

.project-item-meta,
.history-input-json {
    font-size: 0.9rem;
}

.history-input-json {
    font-size: 0.85rem;
}

.project-card-theme {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    border-radius: 999px;
    padding: 4px 10px;
    margin-bottom: 10px;
    font-size: 0.85rem;
    font-weight: 600;
}

.project-hint {
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.site-modal-body {
    white-space: pre-line;
}

/* ================= ДОВІДНИК ================= */

.directory-link-card {
    display: block;
    text-decoration: none;
    border-width: 2px;
    border-style: solid;
    border-radius: 12px;
    padding: 18px;
    text-align: center;
    font-weight: 600;
}

    .directory-link-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
    }

.accordion-button {
    font-weight: 600;
}

/* ================= АДМІН-ПАНЕЛЬ ================= */

.admin-stat-card {
    border-width: 2px;
    border-style: solid;
    border-left-width: 6px;
    border-radius: 12px;
    padding: 22px;
    height: 100%;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

    .admin-stat-card h3 {
        font-size: 2rem;
        font-weight: 700;
        margin-bottom: 5px;
    }

    .admin-stat-card p {
        margin: 0;
    }

.admin-role-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ================= НАЛАШТУВАННЯ ================= */

.settings-avatar {
    width: 110px;
    height: 110px;
    object-fit: contain;
    border-width: 3px;
    border-style: solid;
    border-radius: 50%;
    padding: 8px;
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 16px;
}

.avatar-option {
    border-width: 2px;
    border-style: solid;
    border-radius: 12px;
    padding: 10px;
    cursor: pointer;
}

    .avatar-option:hover {
        transform: translateY(-2px);
    }

    .avatar-option img {
        width: 100%;
        height: 64px;
        object-fit: contain;
    }

/* ================= КНОПКА ДЛЯ АВАТАРОК НА МОБІЛКАХ ================= */

@media (max-width: 767.98px) {
    .avatar-grid.avatar-collapsed .avatar-option:nth-child(n + 7) {
        display: none;
    }

    .avatar-toggle-btn,
    #showAllAvatarsBtn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

@media (min-width: 768px) {
    #showAllAvatarsBtn {
        display: none !important;
    }
}

/* ================= СТОРІНКИ ВХОДУ ТА РЕЄСТРАЦІЇ ================= */

.auth-body {
    padding-top: 0;
}

.auth-page {
    min-height: calc(100vh - 64px);
    padding: 50px 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    width: 100%;
    max-width: 520px;
    border-radius: 18px;
    padding: 34px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.auth-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    text-decoration: none;
    margin-bottom: 22px;
}

    .auth-back-link:hover {
        transform: translateX(-3px);
    }

.auth-header h1 {
    font-weight: 700;
    margin-bottom: 10px;
}

.auth-header p {
    margin-bottom: 24px;
}

.auth-logo {
    width: 78px;
    height: 78px;
    object-fit: contain;
    margin-bottom: 14px;
}

.auth-switch {
    border-top-width: 1px;
    border-top-style: solid;
    padding-top: 20px;
}

.auth-card .form-control,
.auth-card .btn {
    min-height: 46px;
}

.auth-card .btn {
    font-weight: 600;
}

/* ================= ВІДНОВЛЕННЯ ПАРОЛЮ ================= */

.auth-helper-link {
    font-size: 0.95rem;
    line-height: 1.3;
}

    .auth-helper-link a {
        font-weight: 600;
        text-decoration: none;
    }

        .auth-helper-link a:hover {
            text-decoration: underline;
        }

/* ================= АДАПТИВНІСТЬ ================= */

@media (max-width: 991px) {
    body {
        padding-top: 86px;
    }

    .custom-nav .brand-logo {
        width: 58px !important;
        height: 58px !important;
        max-width: 58px !important;
        max-height: 58px !important;
    }

    .custom-nav .brand-text {
        font-size: 1.35rem !important;
    }
}

@media (max-width: 576px) {
    .hero-section {
        padding: 42px 12px;
    }

    .section-title {
        font-size: 1.6rem;
    }

    .auth-card {
        padding: 24px;
        border-radius: 14px;
    }

    .auth-page {
        padding: 45px 12px;
    }
}

/* ================= ФУТЕР ================= */

.footer {
    width: 100%;
    min-height: 64px;
    padding: 18px 15px;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.4;
}

/* ================= КНОПКА НА СТОРІНЦІ АВТОРИЗАЦІЇ ================= */

.auth-switch .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.auth-switch a.btn {
    width: 100%;
}

.site-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

    .site-modal.d-none {
        display: none !important;
    }

.site-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.site-modal-dialog {
    position: relative;
    width: 100%;
    max-width: 560px;
    border-radius: 20px;
    padding: 28px 28px 22px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    z-index: 1;
    animation: modalFadeIn 0.18s ease;
}

.site-modal-title {
    margin: 0 0 18px;
    font-size: 2rem;
    font-weight: 700;
}

.site-modal-body {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 24px;
    white-space: pre-line;
}

.site-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

    .site-modal-actions .btn {
        min-width: 140px;
    }


.btn-cancel-modal {
    min-height: 42px;
    border-width: 2px;
    border-style: solid;
    border-radius: 14px;
    padding: 10px 22px;
    font-weight: 600;
}

.site-modal-close {
    position: absolute;
    top: 16px;
    right: 18px;
    border: none;
    background: transparent;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
