:root {
    --primary: #1b755b;
    --primary-hover: #145b47;
    --primary-light: #e7f2ed;
    --secondary: #203b31;
    --secondary-hover: #315448;
    --bg-page: #f6f8f5;
    --bg-card: #ffffff;
    --bg-subtle: #f0f4f0;
    --bg-input: #fbfcfa;
    --bg-section-alt: #edf3ee;
    --bg-footer: #18372d;
    --bg-overlay: rgba(255, 255, 255, 0.92);
    --border-color: #dce6de;
    --text-color: #33443b;
    --text-muted: #718078;
    --header-shadow: 0 5px 24px rgba(31, 59, 48, 0.07);
    --card-shadow: 0 12px 32px rgba(31, 59, 48, 0.07);
    --transition-speed: 0.22s;
}

:root[data-theme="dark"] {
    --primary: #73c7a6;
    --primary-hover: #92d9ba;
    --primary-light: #203b32;
    --secondary: #e7f1eb;
    --secondary-hover: #d1e3d8;
    --bg-page: #111b17;
    --bg-card: #192720;
    --bg-subtle: #22332a;
    --bg-input: #15211b;
    --bg-section-alt: #16231c;
    --bg-footer: #0d1712;
    --bg-overlay: rgba(17, 27, 23, 0.94);
    --border-color: #2d4236;
    --text-color: #d8e5dc;
    --text-muted: #a1b2a7;
    --header-shadow: 0 8px 26px rgba(0, 0, 0, 0.2);
    --card-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Aptos", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
    letter-spacing: 0.005em;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--secondary);
    letter-spacing: -0.025em;
    line-height: 1.22;
}

h1 {
    font-size: clamp(1.8rem, 3vw, 2.35rem);
    font-weight: 750;
}

h2 {
    font-size: clamp(1.4rem, 2.4vw, 1.85rem);
    font-weight: 720;
}

p {
    line-height: 1.75;
}

a {
    color: var(--primary);
    font-size: inherit;
    font-weight: 550;
}

a:hover {
    color: var(--primary-hover);
}

button,
input,
select,
textarea {
    font-family: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--primary) 42%, transparent);
    outline-offset: 3px;
}

header {
    border-bottom-color: color-mix(in srgb, var(--border-color) 78%, transparent);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

.nav-container {
    min-height: 78px;
}

.logo {
    color: var(--secondary);
    min-width: 70px;
    min-height: 64px;
    font-weight: 800;
}

.logo span {
    color: var(--primary);
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 64px;
}

.logo-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

nav ul {
    gap: clamp(0.8rem, 1.8vw, 1.65rem);
}

nav ul li a {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 650;
    transition: color var(--transition-speed), border-color var(--transition-speed);
}

.nav-collapse nav ul li a,
.nav-collapse .btn-nav,
.nav-profile-toggle,
.nav-profile-dropdown a,
.nav-profile-theme-toggle {
    font-family: "Manrope", "Aptos", "Segoe UI", sans-serif;
    letter-spacing: 0.015em;
}

nav ul li a:hover,
nav ul li a.active {
    color: var(--primary);
}

.btn-nav {
    padding: 0.62rem 1.15rem;
    border-radius: 10px;
    font-size: 0.78rem;
    letter-spacing: 0.035em;
}

.btn-nav-outline {
    border-color: var(--border-color);
    color: var(--secondary);
}

.btn-nav-outline:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-hover);
}

.btn-nav-solid,
.btn-pill,
.btn-carousel-primary,
.btn-search,
.admin-export-button {
    background: var(--primary);
    box-shadow: 0 7px 18px rgba(27, 117, 91, 0.16);
}

.btn-nav-solid:hover,
.btn-pill:hover,
.btn-carousel-primary:hover,
.btn-search:hover,
.admin-export-button:hover {
    background: var(--primary-hover);
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 12px;
}

.nav-profile-toggle {
    color: var(--secondary);
    font-size: 0.9rem;
}

.nav-profile-avatar,
.nav-profile-avatar-fallback {
    border-color: var(--border-color);
}

.hero-carousel {
    height: min(620px, 68vw);
    min-height: 470px;
    background-color: #17372d;
}

.carousel-slide {
    background-position: center 35%;
}

.carousel-overlay {
    background: linear-gradient(90deg, rgba(15, 43, 34, 0.9) 0%, rgba(15, 43, 34, 0.76) 43%, rgba(15, 43, 34, 0.18) 100%);
}

.carousel-content {
    max-width: 760px;
    padding: 0 clamp(1.5rem, 7vw, 6.5rem);
}

.carousel-content .hero-title {
    max-width: 650px;
    margin-bottom: 1.1rem;
    color: #fff;
    font-family: "Manrope", "Aptos", "Segoe UI", sans-serif;
    font-size: clamp(4rem, 9vw, 6rem);
    font-weight: 700;
    letter-spacing: -0.06em;
    line-height: 1.04;
    text-shadow: 0 3px 22px rgba(0, 0, 0, 0.18);
}

.hero-title span + span {
    color: #c8ead9;
}

.carousel-content p {
    max-width: 590px;
    color: rgba(255, 255, 255, 0.86);
    font-size: clamp(1rem, 1.5vw, 1.12rem);
    line-height: 1.75;
    text-shadow: none;
}

.carousel-actions {
    gap: 0.8rem;
}

.btn-carousel-primary,
.btn-carousel-secondary {
    display: inline-flex;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.35rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
}

.btn-carousel-primary {
    background: #e8f4ed;
    color: #173c2e;
    box-shadow: none;
}

.btn-carousel-primary:hover {
    background: #fff;
    color: #173c2e;
}

.btn-carousel-secondary {
    border: 1px solid rgba(255, 255, 255, 0.65);
    color: #fff;
}

.btn-carousel-secondary:hover {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.pillars-section {
    padding: clamp(3.5rem, 7vw, 6rem) 0;
}

.section-subtitle {
    display: inline-block;
    margin-bottom: 0.7rem;
    color: var(--primary);
    font-size: 0.76rem;
    font-weight: 750;
    letter-spacing: 0.14em;
}

.section-title {
    max-width: 760px;
    margin-bottom: 2.5rem;
    font-size: clamp(1.8rem, 3.4vw, 2.55rem);
}

.pillars-grid {
    gap: 1.25rem;
}

.pillar-card,
.article-card,
.post-block,
.reply-block,
.reply-form-box,
.profile-edit-card,
.profile-specialties,
.stat-card,
.admin-export-section,
.admin-table-container {
    border-color: var(--border-color);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
}

.pillar-card {
    align-items: flex-start;
    min-height: 270px;
    padding: 1.8rem;
    text-align: left;
    box-shadow: 0 4px 18px rgba(31, 59, 48, 0.035);
}

.pillar-card:hover,
.article-card:hover,
.profile-card-hover:hover {
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border-color));
    box-shadow: var(--card-shadow);
    transform: translateY(-3px);
}

.pillar-icon {
    display: grid;
    width: 58px;
    height: 58px;
    place-items: center;
    margin-bottom: 1.25rem;
    border-radius: 17px;
    background: var(--primary-light);
}

.pillar-icon img {
    width: 31px;
    height: 31px;
}

.pillar-card h3 {
    font-size: 1.16rem;
    font-weight: 720;
}

.pillar-card p {
    margin-bottom: 0;
    color: var(--text-muted);
    font-size: 0.93rem;
}

.section-alt {
    background-image: linear-gradient(180deg, var(--bg-section-alt), var(--bg-page));
}

.section-alt .stat-card {
    padding: 1.5rem 1.25rem;
    text-align: left;
    box-shadow: 0 4px 16px rgba(31, 59, 48, 0.04);
}

.stat-number {
    font-size: 2.15rem;
    letter-spacing: -0.04em;
}

.stat-label {
    color: var(--secondary);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
}

.grid-container {
    padding-top: clamp(2.25rem, 5vw, 3.5rem);
    padding-bottom: clamp(3rem, 6vw, 5rem);
}

.view-header {
    margin-bottom: 1.75rem;
}

.view-header h1 {
    margin-bottom: 0.45rem;
}

.view-header p {
    max-width: 700px;
    margin: 0;
}

.news-grid {
    gap: 1.5rem 1.25rem;
}

.news-grid .article-card {
    padding: 0.75rem 1rem 1.4rem;
    border: 0;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    transition: background-color var(--transition-speed), border-radius var(--transition-speed), transform var(--transition-speed), box-shadow var(--transition-speed);
}

.news-grid .article-card:hover {
    border-color: var(--border-color);
    border-radius: 10px;
    background: var(--bg-card);
    box-shadow: var(--card-shadow);
    transform: scale(1.02);
    z-index: 1;
}

.article-body {
    padding: 0;
}

.article-body > img {
    margin-top: 0.25rem;
    border-radius: 6px !important;
}

.article-body h3,
.topic-info h3 {
    color: var(--secondary);
    font-size: 1.18rem;
    font-weight: 720;
}

.article-meta {
    font-size: 0.7rem;
    letter-spacing: 0.045em;
}

.article-link {
    color: var(--primary);
}

.article-rating-card {
    border: 1px solid color-mix(in srgb, var(--border-color) 65%, transparent);
    border-radius: 12px;
    background: color-mix(in srgb, var(--bg-card) 72%, var(--bg-page));
    box-shadow: none;
}

.btn-rate-dog {
    background: transparent;
}

@media (min-width: 993px) {
    .grid-container > .search-container {
        padding: 0 0 1.5rem;
        border: 0;
        border-bottom: 1px solid var(--border-color);
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }
}

.forum-tag,
.profile-role-badge,
.badge-role-tutor,
.badge-role-vet {
    border-color: transparent;
    background: var(--primary-light);
    color: var(--primary-hover);
}

.post-block,
.reply-block,
.reply-form-box {
    padding: clamp(1.25rem, 3vw, 2rem);
}

.reply-block.vet-reply {
    border-left-color: var(--primary);
}

.auth-wrapper {
    background:
        radial-gradient(ellipse at 15% 15%, var(--primary-light), transparent 36%),
        var(--bg-page);
}

.auth-card {
    max-width: 470px;
    padding: clamp(1.6rem, 5vw, 2.65rem);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 18px 50px rgba(31, 59, 48, 0.1);
}

.auth-card h2 {
    margin-bottom: 1.5rem;
    font-size: 1.65rem;
}

.form-group label,
.form-group-label {
    font-size: 0.86rem;
    font-weight: 680;
}

.form-input,
select,
textarea,
.admin-search-input,
.forum-tag-select-toggle {
    min-height: 47px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background-color: var(--bg-input);
    font-size: 0.93rem;
}

textarea {
    min-height: 120px;
}

.form-input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    background-color: var(--bg-card);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.btn-pill {
    max-width: none;
    min-height: 48px;
    border-radius: 10px;
    font-size: 0.82rem;
    letter-spacing: 0.045em;
}

.crmv-box {
    border-color: var(--primary);
    border-radius: 0 12px 12px 0;
}

.search-container {
    border-radius: 14px;
    box-shadow: 0 5px 20px rgba(31, 59, 48, 0.04);
}

.search-input,
.btn-search,
.btn-search-clear {
    min-height: 44px;
    border-radius: 10px;
}

.profile-header-card {
    border-radius: 20px;
    background: linear-gradient(130deg, var(--bg-card), var(--bg-subtle));
}

.profile-edit-card {
    box-shadow: var(--card-shadow);
}

.admin-table-container,
.admin-export-section {
    box-shadow: 0 5px 20px rgba(31, 59, 48, 0.04);
}

table.admin-table th {
    background: var(--bg-subtle);
}

footer {
    margin-top: auto;
    padding: 3.25rem 0 2.5rem;
    background: var(--bg-footer);
}

footer .logo {
    color: #f2f8f4;
}

footer .logo span {
    color: #8bd0ae;
}

footer .logo-icon {
    width: 86px;
    height: 80px;
}

footer p {
    margin-bottom: 0.55rem;
    color: #b4c5bb;
    font-size: 0.85rem;
}

footer a {
    color: #a2d7b9;
}

@media (max-width: 992px) {
    .nav-container {
        min-height: 72px;
    }

    .nav-collapse {
        border-top-color: var(--border-color);
        box-shadow: 0 12px 24px rgba(31, 59, 48, 0.12);
    }

    .nav-collapse nav ul li a {
        padding-right: 1.25rem;
        padding-left: 1.25rem;
    }

    .navbar-toggler {
        border: 1px solid var(--border-color);
        border-radius: 10px;
        background: var(--bg-subtle);
    }
}

@media (max-width: 768px) {
    .hero-carousel {
        height: auto;
        min-height: 0;
    }

    .carousel-slide {
        height: auto;
        min-height: 440px;
    }

    .carousel-overlay {
        position: relative;
        height: auto;
        min-height: inherit;
        background: linear-gradient(90deg, rgba(15, 43, 34, 0.91), rgba(15, 43, 34, 0.58));
    }

    .carousel-content {
        padding: 3rem 1.5rem;
    }

    .carousel-content .hero-title {
        font-size: clamp(3.5rem, 14vw, 5rem);
    }

    .carousel-content p {
        font-size: 0.98rem;
    }

    .pillars-grid {
        grid-template-columns: 1fr;
    }

    .pillar-card {
        min-height: 0;
    }

    .stats-grid {
        gap: 0.85rem;
    }

    .stat-card {
        padding: 1.15rem;
    }
}

@media (max-width: 576px) {
    .grid-container {
        padding-right: 1rem;
        padding-left: 1rem;
    }

    .carousel-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .btn-carousel-primary,
    .btn-carousel-secondary {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .section-alt .stat-card {
        padding: 1rem 0.85rem;
    }

    .stat-number {
        font-size: 1.8rem;
    }

    .auth-wrapper {
        padding: 1.5rem 1rem;
    }

    .auth-card {
        border-radius: 16px;
    }

    .search-form {
        flex-wrap: wrap;
    }

    .search-input-wrapper {
        flex-basis: 100%;
    }

    .search-form .btn-search,
    .search-form .btn-search-clear {
        flex: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
