/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans Khmer', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.header {
    background-color: #2c2c2c;
    color: white;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    justify-content: start;
    align-items: center;
    padding: 12px 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-img {
    width: 180px;
    height: 40px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 0;
    margin: 0;
}

.nav-menu li:last-child {
    border-right: none;
}

.nav-menu a {
    display: block;
    color: white;
    text-decoration: none;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 400;
    transition: background-color 0.3s;
}

.mobile-menu-toggle {
    display: none;
}

/* Main Content */
.main {
    background-color: #f5f5f5;
    padding: 20px 0;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    align-items: start;
}

/* Article Styles */
.article {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.article-header {
    margin-bottom: 25px;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}

.article-title {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin-bottom: 15px;
    line-height: 1.4;
}

.article-meta {
    display: flex;
    gap: 20px;
    color: #666;
    font-size: 14px;
}

.article-content {
    font-size: 16px;
    line-height: 1.8;
}

.article-image {
    margin: 20px 0;
    text-align: center;
}

.main-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.article-text {
    margin: 20px 0;
    font-size: 16px;
    color: #333;
}

.tesla-features {
    margin: 30px 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.feature-image {
    text-align: center;
}

.feature-img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.features-text {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.features-text p {
    margin-bottom: 15px;
    font-size: 16px;
    line-height: 1.7;
}

.features-text p:last-child {
    margin-bottom: 0;
}

.product-showcase {
    margin: 30px 0;
    text-align: center;
}

.product-images {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.product-img {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-width: 100%;
    height: auto;
}

.product-img.wide {
    flex: 1;
    min-width: 300px;
}

.source-info {
    margin-top: 30px;
    padding: 15px;
    background-color: #e8f5e8;
    border-radius: 6px;
    font-style: italic;
    color: #2e7d32;
}

/* Sidebar Styles */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.sidebar-section {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sidebar-title {
    background-color: #ff0000;
    color: white;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.related-articles,
.popular-articles {
    padding: 0;
}

.related-item,
.popular-item {
    display: flex;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    gap: 12px;
    align-items: flex-start;
    transition: background-color 0.3s;
}

.related-item:last-child,
.popular-item:last-child {
    border-bottom: none;
}

.related-item:hover,
.popular-item:hover {
    background-color: #f8f9fa;
}

.related-img,
.popular-img {
    width: 100px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.popular-img {
    width: 120px;
    height: 80px;
}

.related-content {
    flex: 1;
}

.related-title,
.popular-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 5px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.popular-title {
    font-size: 15px;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

.related-date {
    font-size: 12px;
    color: #666;
}

/* News Grid Section */
.news-grid-section {
    background-color: #f5f5f5;
    padding: 30px 0;
    margin-top: 30px;
}

.news-grid-header {
    background-color: #ff0000;
    color: white;
    padding: 15px 20px;
    margin-bottom: 0;
    border-radius: 8px 8px 0 0;
}

.news-grid-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    text-align: left;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    background-color: white;
    padding: 20px;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.news-card {
    display: flex;
    flex-direction: column;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.news-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.news-card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px 8px 0 0;
}

.news-card-content {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.news-card-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Footer Styles */
.footer {
    background-color: #2c2c2c;
    color: white;
    padding: 40px 0 20px;
    margin-top: 40px;
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 30px;
}

.footer-logo {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.footer-logo-img {
    width: 150px;
    height: 60px;
    border-radius: 4px;
    padding: 8px;
}

.footer-info h3 {
    color: white;
    font-size: 18px;
    margin: 0;
    font-weight: bold;
}

.footer-info p {
    color: #ccc;
    font-size: 14px;
    margin: 5px 0 0 0;
}

.contact-info p {
    color: white;
    font-size: 14px;
    margin-bottom: 8px;
    line-height: 1.5;
}

.footer-section h4 {
    color: #ff0000;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: bold;
}

.category-list {
    display: flex;
    flex-direction: column;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
}

.category-name {
    color: white;
    font-size: 14px;
    flex: 1;
}

.category-count {
    color: #ccc;
    font-size: 14px;
    font-weight: bold;
    min-width: 50px;
    text-align: right;
}

.footer-bottom {
    border-top: 1px solid #444;
    padding-top: 20px;
    text-align: start;
    font-size: 14px;
    color: #ccc;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .content-wrapper {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .article {
        padding: 20px;
    }
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }
    
    .news-card-image {
        height: 160px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }
    
    .header {
        position: sticky;
        top: 0;
        z-index: 100;
    }
    
    .header-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 10px 0;
        position: relative;
    }
    
    .logo-img {
        width: 120px;
        height: 28px;
    }
    
    .nav {
        position: relative;
    }
    
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        right: 0;
        background-color: #2c2c2c;
        min-width: 200px;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        border-radius: 4px;
        overflow: hidden;
        transform: translateY(-10px);
        opacity: 0;
        transition: all 0.3s ease;
    }
    
    .nav-menu.active {
        display: block;
        transform: translateY(0);
        opacity: 1;
    }
    
    .nav-menu li {
        border-right: none;
        border-bottom: 1px solid #444;
    }
    
    .nav-menu li:last-child {
        border-bottom: none;
    }
    
    .nav-menu a {
        padding: 12px 16px;
        display: block;
        transition: background-color 0.3s;
    }
    
    .nav-menu a:hover {
        background-color: #444;
    }
    
    .mobile-menu-toggle {
        display: block;
        background: none;
        border: none;
        color: white;
        font-size: 18px;
        cursor: pointer;
        padding: 8px;
        border-radius: 4px;
        transition: background-color 0.3s;
    }
    
    .mobile-menu-toggle:hover {
        background-color: rgba(255,255,255,0.1);
    }
    
    .main {
        padding: 15px 0;
    }
    
    .content-wrapper {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .article {
        padding: 20px 15px;
        margin-bottom: 15px;
    }
    
    .article-title {
        font-size: 20px;
        line-height: 1.3;
        margin-bottom: 12px;
    }
    
    .article-meta {
        flex-direction: column;
        gap: 5px;
        margin-bottom: 15px;
    }
    
    .article-content {
        font-size: 15px;
        line-height: 1.5;
    }
    
    .tesla-features {
        margin: 15px 0;
    }
    
    .product-images {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .product-images img {
        width: 100%;
        max-width: 300px;
        height: auto;
    }

    /* ✅ Sidebar for tablets/phones */
    .sidebar {
        width: 100%;
        display: block;
        margin: 0;
        padding: 0 10px;
    }

    .sidebar-section {
        margin-bottom: 20px;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        border-bottom: none;
    }

    .related-articles,
    .popular-articles {
        display: grid;
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 15px;
        width: 100%;
        margin: 0;
    }

    .related-item,
    .popular-item {
        background-color: white;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        margin-bottom: 0;
        width: 100%;
        padding: 15px;
        display: flex;
        align-items: center;
        gap: 12px;
    }
    
    .news-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 15px;
    }
    
    .news-card-image {
        height: 200px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 8px;
    }
    
    .header-content {
        padding: 8px 0;
    }
    
    .logo-img {
        width: 100px;
        height: 24px;
    }
    
    .article {
        padding: 15px 12px;
        margin-bottom: 12px;
    }
    
    .article-title {
        font-size: 18px;
        line-height: 1.3;
        margin-bottom: 10px;
    }
    
    .article-meta {
        margin-bottom: 12px;
    }
    
    .article-content {
        font-size: 14px;
        line-height: 1.5;
    }
    
    .tesla-features {
        margin: 12px 0;
    }
    
    .product-images {
        gap: 8px;
    }
    
    .product-images img {
        max-width: 280px;
    }

    /* ✅ Sidebar for small phones */
    .sidebar {
        width: 100%;
        display: block;
        margin: 0;
        padding: 0 8px;
    }

    .sidebar-section {
        margin-bottom: 15px;
    }

    .related-articles,
    .popular-articles {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 12px;
        width: 100%;
        margin: 0;
    }

    .related-item,
    .popular-item {
        background-color: white;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        margin-bottom: 0;
        padding: 12px 15px;
        gap: 10px;
        width: 100%;
        display: flex;
        align-items: center;
    }

    .sidebar-title {
        padding: 10px 15px;
        font-size: 15px;
    }

    .related-img {
        width: 60px;
        height: 45px;
    }

    .popular-img {
        width: 100px;
        height: 67px;
    }

    .related-title,
    .popular-title {
        font-size: 13px;
    }

    .related-date {
        font-size: 11px;
    }

    .footer-bottom {
        text-align: center;
    }
}
