/* Global Styles */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #333;
}

img {
    max-width: 100%;
    height: auto;
}

/* Navbar */
.navbar-brand img {
    max-height: 40px;
}

/* Banner */
.banner-section {
    margin-top: 56px;
}

.carousel-item {
    height: 400px;
}

.carousel-item img {
    width: 100%;
    height: 400px;
    object-fit: cover;
}

/* Cards */
.card {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
}

.card-header {
    border-radius: 8px 8px 0 0 !important;
}

.card-body {
    padding: 1rem;
}

.card-body p {
    line-height: 1.65;
}

.card-title,
.card-header h5,
.card-body h5,
.card-body h6,
.list-group-item,
p,
a {
    overflow-wrap: anywhere;
    word-break: normal;
}

.card-img-top {
    width: 100%;
    object-fit: cover;
}

/* Buttons */
.btn-success {
    background-color: #28a745;
    border-color: #28a745;
}

.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

.btn-outline-success {
    color: #28a745;
    border-color: #28a745;
}

.btn-outline-success:hover {
    color: #fff;
    background-color: #28a745;
    border-color: #28a745;
}

.btn-sm {
    white-space: normal;
}

/* Share Buttons */
.d-flex.gap-2 {
    flex-wrap: wrap;
}

.d-flex.gap-2 .btn {
    flex: 1 1 auto;
    min-width: 105px;
}

/* Footer */
footer {
    margin-top: auto;
}

footer a {
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Gallery */
.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 20px;
}

.gallery-item img {
    transition: transform 0.3s ease;
    width: 100%;
    height: auto;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

/* Forms */
.form-control:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

/* Homepage responsive layout */
@media (max-width: 1199.98px) {
    .homepage-layout > [class*="col-"] {
        width: 100%;
        max-width: 100%;
        flex: 0 0 100%;
    }

    .homepage-layout .container {
        padding-left: 0;
        padding-right: 0;
    }

    .homepage-layout .card {
        width: 100%;
    }
}

/* Tablet and mobile */
@media (max-width: 991.98px) {
    body {
        font-size: 15px;
    }

    .container {
        max-width: 100%;
        padding-left: 12px;
        padding-right: 12px;
    }

    .row {
        margin-left: -6px;
        margin-right: -6px;
    }

    .row > [class*="col-"] {
        padding-left: 6px;
        padding-right: 6px;
        margin-bottom: 14px;
    }

    .navbar-brand img {
        max-height: 34px;
    }

    .navbar-toggler {
        padding: 0.25rem 0.55rem;
    }

    .navbar-nav .nav-link {
        padding: 10px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    }

    .banner-section {
        margin-top: 0;
    }

    .carousel-item,
    .carousel-item img {
        height: 250px;
    }

    .card {
        margin-bottom: 14px;
        border-radius: 6px;
        box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
    }

    .card:hover,
    .gallery-item:hover img {
        transform: none;
    }

    .card-header h5 {
        font-size: 1rem;
        line-height: 1.35;
    }

    .card-body {
        padding: 12px;
    }

    .card-body h6,
    .card-title {
        font-size: 0.95rem;
        line-height: 1.35;
    }

    .card-img-top {
        height: auto;
        max-height: 320px;
        object-fit: cover;
    }

    .card-body > img.img-fluid {
        width: 100%;
        max-height: 420px;
        object-fit: contain;
        background: #f3f5f4;
        border-radius: 6px;
    }

    .card-body .d-flex.mb-3 {
        gap: 10px;
        align-items: flex-start;
    }

    .card-body .d-flex.mb-3 .me-2,
    .card-body .d-flex.mb-3 .me-3 {
        flex: 0 0 86px;
        margin-right: 0 !important;
    }

    .card-body .d-flex.mb-3 img.img-thumbnail {
        width: 86px !important;
        height: 64px !important;
        object-fit: cover;
    }

    .card-body .d-flex.mb-3 > div:last-child {
        min-width: 0;
        flex: 1;
    }

    .card-body .d-flex.mb-3 p {
        margin-bottom: 6px;
    }

    .news-slider {
        font-size: 12px;
        height: auto;
        min-height: 32px;
        line-height: 1.35;
    }

    .btn-sm {
        padding: 0.45rem 0.65rem;
        font-size: 0.85rem;
    }

    footer .col-md-4 {
        margin-bottom: 18px;
    }
    
    .popular-news-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.popular-news-thumb {
    flex: 0 0 60px;
    display: block;
}

.popular-news-thumb img {
    width: 60px;
    height: 46px;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid #dee2e6;
    background: #f8f9fa;
}

.popular-news-content {
    min-width: 0;
    flex: 1;
}

.popular-news-content h6 {
    margin-bottom: 4px;
    font-size: 0.88rem;
    line-height: 1.3;
}

.popular-news-content h6 a {
    color: #212529;
    text-decoration: none;
}

.popular-news-content h6 a:hover {
    color: #198754;
}

.popular-news-content p {
    margin-bottom: 6px;
    font-size: 0.82rem;
    line-height: 1.35;
}

.popular-news-content .btn {
    padding: 0.3rem 0.5rem;
    font-size: 0.78rem;
}
}