/* ==========================================
 * SaralSamachar Frontend Styles
 * ==========================================
 * Modern, responsive news portal design
 * Author: SaralSamachar Team
 */

/* * ==========================================
 * CORE VARIABLES (Light/Dark Theme)
 * ==========================================
 */
:root {
    --primary-color: #D32F2F;
    --primary-dark: #b71c1c;
    --bg-body: #f4f4f4;
    --bg-card: #ffffff;
    --text-main: #212121;
    --text-muted: #666666;
    --border-color: #e0e0e0;
    --nav-bg: #ffffff;
    --nav-text: #212121;
    --hero-overlay: rgba(0, 0, 0, 0.8);
    --container-width: 1200px;
    --transition-speed: 0.3s;
    --dropdown-bg: #ffffff;
    --dropdown-hover: #f5f5f5;
}

/* Dark Theme Variables */
[data-theme="dark"] {
    --bg-body: #121212;
    --bg-card: #1e1e1e;
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --border-color: #333333;
    --nav-bg: #1e1e1e;
    --nav-text: #e0e0e0;
    --hero-overlay: rgba(0, 0, 0, 0.9);
    --dropdown-bg: #2d2d2d;
    --dropdown-hover: #3d3d3d;
}

/* ==========================================
 * GLOBAL RESETS & BASE STYLES
 * ==========================================
 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    width: 100%;
}

body {
    /* font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif; */
    font-family: sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color var(--transition-speed), color var(--transition-speed);
    width: 100%;
    min-width: 0;
    /* Prevents overflow */
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.2s;
}

a:hover {
    color: var(--primary-color);
}

ul {
    list-style: none;
}

/* Layout Shift Prevention: Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    /* padding: 0 15px; */
    width: 100%;
}

/* =======================================
 * HEADER & TOP BAR
 * ========================================
 */
.top-bar {
    background: #222;
    color: #ccc;
    font-size: 0.85rem;
    padding: 8px 0;
    min-height: 30px;
    width: 100%;
}

.top-bar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header {
    background: var(--nav-bg);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    width: 100%;
}

.header-main {
    padding: 12px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
}

.site-logo {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary-color);
    text-transform: uppercase;
    /* font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; */
    letter-spacing: -1px;
    margin-right: 30px;
}

/* ==========================================
 * NAVIGATION
 * ==========================================
 */
.main-nav {
    flex-grow: 1;
    /* Takes available space */
    transition: max-height 0.3s ease-out;
    overflow: hidden;
}

.main-nav ul {
    display: flex;
    gap: 25px;
    padding: 10px 0;
}

.main-nav a {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.95rem;
    color: var(--nav-text);
    padding: 5px 0;
    border-bottom: 2px solid transparent;
}

.main-nav a:hover {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* ==========================================
 * ACCOUNT DROPDOWN
 * ==========================================
 */
.account-wrapper {
    position: relative;
    margin-left: 20px;
}

.account-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.account-btn:hover {
    background: var(--dropdown-hover);
    border-color: var(--primary-color);
}

.account-dropdown {
    position: absolute;
    top: 120%;
    right: 0;
    width: 220px;
    background: var(--dropdown-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    display: none;
    /* Hidden by default */
    flex-direction: column;
    z-index: 1100;
    overflow: hidden;
}

.account-dropdown.show {
    display: flex;
    animation: fadeIn 0.2s;
}

.dropdown-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-main);
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: var(--dropdown-hover);
    color: var(--primary-color);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0;
}

.theme-label {
    flex-grow: 1;
}

.theme-status {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Mobile Nav Toggle */
.mobile-toggle-btn {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-main);
    margin-right: 15px;
}

/* ==========================================
 * ACTION BUTTONS (Bookmark & Share)
 * ==========================================
 */
.card-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.action-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    color: #555;
    transition: transform 0.2s;
}

.action-btn:hover {
    transform: scale(1.1);
    color: var(--primary-color);
}

.action-btn.active {
    color: var(--primary-color);
}

.action-btn.book marked {
    color: #FFD700;
}

/* Share Popup */
.share-popup {
    position: absolute;
    top: 45px;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    padding: 10px;
    border-radius: 4px;
    display: none;
    flex-direction: column;
    gap: 8px;
    z-index: 20;
    min-width: 150px;
}

.share-popup.show {
    display: flex;
    animation: fadeIn 0.2s;
}

.share-link {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-main);
    padding: 5px;
    border-radius: 3px;
}

.share-link:hover {
    background: var(--bg-body);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
 * BREAKING NEWS TICKER
 * ==========================================
 */
.breaking-wrapper {
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    min-height: 40px;
    height: auto;
}

.breaking-label {
    background: var(--primary-dark);
    padding: 10px 15px;
    height: 100%;
    display: flex;
    align-items: center;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
    font-size: 0.9rem;
}

.breaking-content {
    flex-grow: 1;
    /* padding: 10px 15px;  */
    overflow: hidden;
}

/* ==========================================
 * HERO SECTION & CARDS
 * ==========================================
 */
.main-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-top: 30px;
    margin-bottom: 50px;
    padding: 0 15px;
    min-width: 0;
    /* Prevents grid overflow */
}

.hero-section {
    margin-bottom: 40px;
}

.big-story {
    position: relative;
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
}

.big-story-img-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    height: 400px;
    background-color: #eee;
}

.big-story img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

/* .big-story:hover img { 
    transform: scale(1.02); 
} */

.big-story-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, var(--hero-overlay), transparent);
    padding: 20px;
    color: white;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    pointer-events: none;
}

.big-story-overlay h2 {
    font-size: 2rem;
    line-height: 1.2;
    margin-bottom: 10px;
    font-family: 'Mukta', sans-serif;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}



/* ==========================================
 * HERO CAROUSEL STYLES
 * ==========================================
 */
.hero-carousel-container {
    position: relative;
}

.hero-carousel-slides {
    position: relative;
    width: 100%;
    height: 100%;
}

.hero-carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease-in-out;
}

.hero-carousel-slide.active {
    position: relative;
    opacity: 1;
    visibility: visible;
}

/* Carousel Indicators (Dots) */
.carousel-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    backdrop-filter: blur(5px);
}

.carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.carousel-dot:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.2);
}

.carousel-dot.active {
    background: white;
    width: 24px;
    border-radius: 5px;
}


.sub-stories {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.badge {
    background: var(--primary-color);
    padding: 3px 8px;
    font-size: 0.8rem;
    border-radius: 3px;
}

/* ==========================================
 * NEWS CARDS
 * ==========================================
 */
.news-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: visible;
    position: relative;
    transition: box-shadow 0.2s;
}

.news-card:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.news-card-img-wrapper {
    height: 180px;
    overflow: hidden;
    position: relative;
    background-color: #eee;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

.news-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-card-body {
    padding: 15px;
}

.news-card h3,
.news-card h4 {
    font-family: 'Mukta', sans-serif;
    margin-bottom: 8px;
    color: var(--text-main);
}

/* ==========================================
 * SIDEBAR WIDGETS
 * ==========================================
 */
/* Make sidebar sticky */
aside {
    position: sticky;
    top: 80px;
    align-self: flex-start;
}

.sidebar-widget {
    background: var(--bg-card);
    padding: 20px;
    border: 1px solid var(--border-color);
    margin-bottom: 30px;
    border-top: 3px solid var(--primary-color);
}

.widget-title {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.popular-list li {
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

/* ==========================================
 * FOOTER
 * ==========================================
 */
footer {
    background: #111;
    color: #aaa;
    padding: 50px 0 20px;
    margin-top: 50px;
    width: 100%;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    padding: 0 15px;
}

/* ==========================================
 * RESPONSIVE DESIGN
 * ==========================================
 */
@media (max-width: 900px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .mobile-toggle-btn {
        display: block;
    }

    .main-nav {
        max-height: 0;
        background: var(--bg-card);
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        box-shadow: 0 4px 5px rgba(0, 0, 0, 0.1);
        z-index: 999;
    }

    .main-nav.open {
        max-height: 400px;
    }

    .main-nav ul {
        flex-direction: column;
        padding: 20px;
        text-align: center;
    }

    .header-main {
        position: relative;
        padding: 12px 15px;
    }

    .site-logo {
        font-size: 1.8rem;
    }

    /* Responsive top-bar */
    .top-bar {
        font-size: 0.75rem;
    }

    .top-bar .container span:first-child {
        font-size: 0.7rem;
    }

    /* Breaking news responsive */
    .breaking-label {
        font-size: 0.8rem;
        padding: 10px 12px;
    }

    /* On mobile, Account dropdown might need to be smaller or positioned differently */
    .account-text {
        display: none;
    }

    /* Hide text on small screens */

    .account-dropdown {
        width: 200px;
        right: -10px;
    }
}

@media (max-width: 600px) {

    html,
    body {
        width: 100%;
        min-width: 0;
        display: inline-table;
    }

    .container {
        /* padding: 0 12px; */
        width: 100%;
        max-width: 100%;
    }

    .main-layout {
        margin-top: 0;
        padding: 0;
    }

    /* Further reduce sizes for very small screens */
    .top-bar {
        font-size: 0.7rem;
        padding: 6px 0;
        width: 100%;
    }

    .top-bar .container {
        padding: 0 12px;
    }

    /* .top-bar .container span:last-child {
        display: none;
    } */

    header {
        width: 100%;
    }

    .header-main {
        padding: 10px 12px;
        width: 100%;
    }

    .site-logo {
        font-size: 1.5rem;
    }

    .site-logo img {
        height: 32px !important;
    }

    .breaking-wrapper {
        flex-wrap: nowrap;
        width: 100%;
    }

    .breaking-label {
        font-size: 0.75rem;
        padding: 8px 10px;
        min-width: 70px;
        flex-shrink: 0;
    }

    .sub-stories {
        grid-template-columns: 1fr;
    }

    .big-story-img-wrapper {
        height: 250px;
    }
    
    .big-story-overlay h2 {
    font-size: 1.1rem;
}

    .footer-grid {
        grid-template-columns: 1fr;
    }

    .cat-grid-wrapper {
        display: grid;
        grid-template-columns: repeat(1, 1fr);
        gap: 20px;
    }

    /* Article Page Specific - Remove Outer Container Padding */
    .article-page.container {
        padding: 0 !important;
        margin: 0 auto;
    }

    .article-page.main-layout {
        padding: 0 !important;
        margin-top: 0 !important;
    }

    /* Article Page - Add Padding to Inner Sections */
    .article-page .article-container {
        padding: 20px 15px !important;
        border-radius: 0 !important;
        border: none !important;
        border-left: none !important;
        border-right: none !important;
    }

    .article-page .post-navigation {
        padding: 0 15px;
    }

    .article-page .related-section {
        padding: 0 15px;
    }

    .article-page aside {
        padding: 0 15px;
    }

    /* Index Page - Add Padding to Posts and Sidebar */
    .main-layout-index {
        margin-top: 20px !important;
    }

    .main-layout-index .hero-section {
        padding: 0 15px;
    }

    .main-layout-index .category-section {
        padding: 0 15px;
    }

    .main-layout-index aside {
        padding: 0 15px;
    }

    /* Category Page - Add Padding to Posts and Sidebar */
    .category-page {
        margin-top: 20px !important;
    }

    .category-page .category-header {
        margin: 0 15px 30px 15px;
    }

    .category-page .posts-grid {
        padding: 0 15px;
    }

    .category-page .pagination {
        padding: 0 15px;
    }

    .category-page aside {
        padding: 0 15px;
    }

    /* Search Page - Add Padding to Posts and Sidebar */
    .search-page {
        margin-top: 20px !important;
    }

    .search-page .search-header {
        margin: 0 15px 30px 15px;
    }

    .search-page .posts-grid {
        padding: 0 15px;
    }

    .search-page .pagination {
        padding: 0 15px;
    }

    .search-page aside {
        padding: 0 15px;
    }

    /* Bookmark Page - Add Padding to Posts and Sidebar */
    .bookmark-page {
        margin-top: 20px !important;
    }

    .bookmark-page .page-header {
        margin: 0 15px 30px 15px;
    }

    .bookmark-page .posts-grid {
        padding: 0 15px;
    }

    .bookmark-page .pagination {
        padding: 0 15px;
    }

    .bookmark-page aside {
        padding: 0 15px;
    }

    /* author Page - Add Padding to Posts and Sidebar */
    .author-page {
        margin-top: 20px !important;
    }

    .author-page .author-header {
        margin: 0 15px 30px 15px;
    }

    .author-page .section-title {
        padding: 0 15px;
    }

    .author-page .posts-grid {
        padding: 0 15px;
    }

    .author-page .pagination {
        padding: 0 15px;
    }

    .author-page aside {
        padding: 0 15px;
    }

    /* contact Page - Add Padding to Posts and Sidebar */
    .contact-page {
        margin-top: 20px !important;
    }

    .contact-page .contact-header {
        margin: 0 15px 30px 15px;
    }

    .contact-page .contact-form {
        margin: 0 15px 30px 15px !important;
    }

    .contact-page .contact-info {
        margin: 0 15px 30px 15px !important;
    }

    .contact-page .pagination {
        padding: 0 15px;
    }

    .contact-page aside {
        padding: 0 15px;
    }


}

@media (min-width: 700px) {
    .cat-grid-wrapper {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

/* =========================================
   AUTHENTICATION PAGES (Login / Register)
   ========================================= */
.auth-wrapper {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 50px 15px;
    min-height: 60vh;
}

.auth-box {
    background: var(--bg-card);
    width: 100%;
    max-width: 400px;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-title {
    font-size: 1.8rem;
    font-family: 'Mukta', sans-serif;
    color: var(--text-main);
    font-weight: 700;
}

.auth-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-main);
}

.auth-form input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-body);
    color: var(--text-main);
    outline: none;
    font-size: 1rem;
}

.auth-form input:focus {
    border-color: var(--primary-color);
}

.btn-submit {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}

.btn-submit:hover {
    background: var(--primary-dark);
}

/* Google Button */
.auth-divider {
    text-align: center;
    margin: 25px 0;
    position: relative;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    border-top: 1px solid var(--border-color);
    z-index: 1;
}

.auth-divider span {
    background: var(--bg-card);
    padding: 0 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
    position: relative;
    z-index: 2;
    font-weight: 500;
}

.btn-google {
    width: 100%;
    padding: 10px 12px;
    background: #fff;
    color: #444;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: 0.2s;
    font-family: 'Roboto', sans-serif;
}

.btn-google:hover {
    background: #f8f8f8;
    border-color: #ccc;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-google img {
    width: 20px;
    height: 20px;
}

[data-theme="dark"] .btn-google {
    background: #2d2d2d;
    color: #fff;
    border-color: #444;
}

[data-theme="dark"] .btn-google:hover {
    background: #3d3d3d;
    border-color: #555;
}

/* Messages */
.error-msg {
    background: #ffebee;
    color: #c62828;
    padding: 10px;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-bottom: 20px;
    text-align: center;
    border: 1px solid #ef9a9a;
}

.success-msg {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 10px;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-bottom: 20px;
    text-align: center;
    border: 1px solid #a5d6a7;
}

.success-msg a {
    font-weight: bold;
    text-decoration: underline;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-footer a {
    font-weight: 600;
    color: var(--primary-color);
}