/* Modern & Premium Design System */
:root {
    /* Color Palette */
    --primary-blue: #0f62fe;
    /* Vibrant, modern blue */
    --primary-dark: #0043ce;
    --secondary-blue: #398bf7;
    --accent-cyan: #1192e8;

    --text-main: #161616;
    --text-secondary: #525252;
    --text-light: #ffffff;

    --bg-body: #f4f7fb;
    /* Very subtle cool gray/blue tint */
    --bg-white: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.95);

    --border-light: #e0e0e0;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-hover: 0 12px 32px rgba(15, 98, 254, 0.2);

    /* Typography */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-serif: 'Merriweather', serif;

    /* Spacing & Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --container-max: 1200px;
}

/* Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

ul {
    list-style: none;
}

/* --- Header & Top Bar --- */
header {
    border-top: 3px solid var(--accent-cyan);
}

/* Header layout */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 5%;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(to right, #ffffff, #f8f9fa);
}

/* Left actions */
.left-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Social icons row in header */
.social-icons {
    display: flex;
    align-items: center;
    gap: 0.6rem; /* space between icons without affecting overall header layout */
}

/* Logo container (left‑aligned) */
.logo-container {
    /* no flex‑grow – keeps logo at start */
}

/* Site logo: "Codes4u" with blue 4 */
.logo {
    font-family: var(--font-serif);
    font-size: 2rem;
    font-weight: 900;
    color: var(--text-main);
}

.logo span {
    color: var(--primary-blue);
}

/* Right actions – profile inline */
.right-actions {
    display: flex;
    align-items: center;
}

/* Profile menu */
.profile-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Profile icon */
.profile-icon {
    width: 2.2rem;
    height: 2.2rem;
    background: var(--primary-blue);
    color: var(--text-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
}

.profile-name {
    font-size: 0.95rem;
    color: var(--text-main);
    margin-right: 5px;
}

/* Logout button */
.logout-btn {
    background: var(--primary-dark);
    color: var(--text-light);
    border: none;
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.logout-btn:hover {
    background: var(--primary-blue);
}

/* Main navigation bar below header */
.main-nav {
    background-color: var(--primary-blue);
    color: var(--text-light);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.main-nav .nav-links {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 5%;
    display: flex;
    align-items: center;
    gap: 3rem;
    height: 52px;
}

.main-nav .nav-links>li>a {
    color: var(--text-light);
    font-size: 0.98rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.main-nav .nav-links>li>a:hover {
    opacity: 0.9;
}

.hamburger-icon {
    display: none;
}

.hamburger-icon span {
    display: block;
    width: 22px;
    height: 2px;
    background-color: var(--text-light);
    margin: 4px 0;
}

.dropdown {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--bg-white);
    min-width: 220px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    border-radius: var(--radius-sm);
    top: 100%;
    left: 0;
    padding: 0.5rem 0;
    border-top: 3px solid var(--accent-cyan);
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content li {
    position: relative;
}

.dropdown-content a {
    color: var(--text-main);
    padding: 0.8rem 1.5rem;
    display: block;
    font-size: 0.95rem;
    border-radius: 0;
    transition: background 0.2s, color 0.2s;
}

.dropdown-content a:hover {
    background-color: var(--bg-body);
    color: var(--primary-blue);
    padding-left: 1.8rem;
    /* Subtle slide effect */
}

/* Nested Dropdown */
.sub-dropdown-content {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    background-color: var(--bg-white);
    min-width: 220px;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0;
    margin-left: 5px;
    /* Gap for mouse movement */
    border-left: 3px solid var(--accent-cyan);
}

.sub-dropdown:hover .sub-dropdown-content {
    display: block;
    animation: fadeInRight 0.2s ease-out;
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* --- Main Content --- */
.container {
    max-width: var(--container-max);
    margin: 3rem auto;
    padding: 0 2rem;
    min-height: 60vh;
}

.page-title {
    font-family: var(--font-main);
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 2rem;
    position: relative;
    display: inline-block;
}

.page-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 60px;
    height: 4px;
    background: linear-gradient(to right, var(--primary-blue), var(--accent-cyan));
    border-radius: 2px;
}

/* PDF Viewer Card */
.pdf-container {
    background: var(--bg-white);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    height: 850px;
    /* Taller for better viewing */
    transition: box-shadow 0.3s;
}

.pdf-container:hover {
    box-shadow: var(--shadow-lg);
}

.pdf-container p {
    text-align: center;
    margin-top: 1rem;
    color: var(--text-secondary);
}

.pdf-container a {
    color: var(--primary-blue);
    font-weight: 600;
    text-decoration: underline;
}

/* --- Footer --- */
footer {
    background-color: #111827;
    /* Very dark blue/gray */
    color: #d1d5db;
    padding: 4rem 5% 2rem;
    margin-top: 4rem;
}

.footer-content {
    max-width: var(--container-max);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 4rem;
    margin-bottom: 3rem;
}

.footer-col h4 {
    color: var(--bg-white);
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    position: relative;
}

.footer-col h4::after {
    content: '';
    display: block;
    width: 30px;
    height: 2px;
    background: var(--primary-blue);
    margin-top: 0.5rem;
}

.footer-col p {
    line-height: 1.8;
    color: #9ca3af;
}

.footer-col ul li {
    margin-bottom: 0.8rem;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 2.5rem;
    align-items: start;
}

/* Featured Article */
.featured-article {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s, box-shadow 0.3s;
}

.featured-article:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.featured-image-container {
    width: 100%;
    height: 400px;
    overflow: hidden;
}

.featured-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.featured-article:hover .featured-image-container img {
    transform: scale(1.05);
}

.featured-content {
    padding: 2rem;
}

.meta-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.meta-info span {
    color: var(--primary-blue);
}

.featured-title {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    line-height: 1.3;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.featured-excerpt {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
}

.read-more {
    color: var(--primary-blue);
    font-weight: 700;
    font-size: 0.95rem;
    position: relative;
}

.read-more::after {
    content: '→';
    margin-left: 5px;
    transition: margin-left 0.2s;
}

.read-more:hover::after {
    margin-left: 10px;
}

/* Side Stories */
.side-stories {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.side-story-card {
    display: flex;
    gap: 1rem;
    background: var(--bg-white);
    padding: 1rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
    align-items: center;
}

.side-story-card:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
}

.side-thumb {
    width: 100px;
    height: 70px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.side-content h3 {
    font-family: var(--font-serif);
    font-size: 1rem;
    line-height: 1.4;
    color: var(--text-main);
    margin-top: 0.3rem;
}

/* Responsive */
@media (max-width: 900px) {
    .hero-grid {
        grid-template-columns: 1fr;
    }

    .featured-image-container {
        height: 300px;
    }
}

/* --- Latest Updates Section --- */
.updates-section {
    margin-bottom: 4rem;
}

.updates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.article-card {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.card-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-category {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary-blue);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
}

.card-title {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    color: var(--text-main);
    margin-bottom: 1rem;
    line-height: 1.4;
    flex-grow: 1;
}

.article-card .read-more {
    margin-top: auto;
    font-size: 0.9rem;
}

/* --- Article Detail Page --- */
.article-detail-container {
    display: flex;
    gap: 1rem;
    background: var(--bg-white);
    padding: 1rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
    align-items: center;
}

.side-story-card:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
}

.side-thumb {
    width: 100px;
    height: 70px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.side-content h3 {
    font-family: var(--font-serif);
    font-size: 1rem;
    line-height: 1.4;
    color: var(--text-main);
    margin-top: 0.3rem;
}

/* Responsive */
@media (max-width: 900px) {
    .hero-grid {
        grid-template-columns: 1fr;
    }

    .featured-image-container {
        height: 300px;
    }
}

/* --- Latest Updates Section --- */
.updates-section {
    margin-bottom: 4rem;
}

.updates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.article-card {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.card-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-category {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary-blue);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
}

.card-title {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    color: var(--text-main);
    margin-bottom: 1rem;
    line-height: 1.4;
    flex-grow: 1;
}

.article-card .read-more {
    margin-top: auto;
    font-size: 0.9rem;
}

/* --- Article Detail Page --- */
.article-detail-container {
    max-width: 800px;
    margin: 3rem auto;
    padding: 0 2rem;
}

.article-header {
    margin-bottom: 2rem;
    text-align: center;
}

.article-category {
    color: var(--primary-blue);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: block;
}

.article-headline {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    color: var(--text-main);
    line-height: 1.3;
    margin-bottom: 1.5rem;
}

.article-meta {
    color: var(--text-secondary);
    font-size: 0.95rem;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.article-hero-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    margin-bottom: 3rem;
}

.article-body {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #374151;
    /* Slightly darker for readability */
}

.article-body p {
    margin-bottom: 1.5rem;
}

.article-body h2 {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    color: var(--text-main);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.article-body ul {
    list-style: disc;
    margin-left: 2rem;
    margin-bottom: 1.5rem;
}

.article-body li {
    margin-bottom: 0.5rem;
}

/* Buttons */
.btn-primary {
    display: inline-block;
    background: var(--primary-blue);
    color: var(--text-light);
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
}

.discussion-form .form-group {
    margin-bottom: 1.5rem;
}

.discussion-form label {
    display: block;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.discussion-form input[type="text"],
.discussion-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#replyAuthor,
#replyContent {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-size: 1rem;
}

.discussion-form input[type="text"]:focus,
.discussion-form textarea:focus,
#replyAuthor:focus,
#replyContent:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 1px rgba(15, 98, 254, 0.2);
}

.discussion-form textarea {
    resize: vertical;
    min-height: 120px;
}

.discussion-form input[type="file"] {
    width: 100%;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    border: 2px dashed var(--border-light);
    background-color: var(--bg-white);
}

.discussion-form .btn-primary {
    margin-top: 0.5rem;
}

/* Notification */
.notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--primary-blue);
    color: var(--white);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 2000;
}

.modal-content {
    width: 95%;
    margin: 10% auto;
    padding: 1.5rem;
}

/* --- Responsive Header & Nav --- */
@media (max-width: 768px) {
    .top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .logo-container {
        align-self: center;
    }

    .right-actions {
        align-self: flex-end;
    }

    /* Collapse nav into hamburger */
    .hamburger-icon {
        display: block;
        cursor: pointer;
        padding: 0.5rem 5%;
    }

    .main-nav {
        position: relative;
        z-index: 20;
    }

    .main-nav .nav-links {
        display: none;
        flex-direction: column;
        gap: 0.25rem;
        padding: 0.5rem 5% 0.75rem;
        width: 100%;
        height: auto;
        /* override desktop fixed height so menu can expand */
        background-color: var(--primary-blue);
    }

    .main-nav .nav-links.nav-open {
        display: flex;
    }

    .main-nav .nav-links>li>a {
        color: var(--text-light);
    }

    /* Make the top-level 'Codes and Rules' heading clear on mobile */
    .dropdown>.dropbtn {
        color: var(--text-light);
        font-weight: 600;
        padding: 0.6rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }

    /* Make 'Codes' and 'Rules' sub-headings stand out */
    .sub-dropbtn {
        color: var(--text-light);
        font-weight: 500;
        padding: 0.5rem 0;
    }

    .dropdown,
    .sub-dropdown {
        position: static;
    }

    /* Base style for dropdown lists on mobile: hidden by default */
    .dropdown-content,
    .sub-dropdown-content {
        position: static;
        box-shadow: none;
        min-width: 100%;
        border-radius: 0;
        padding: 0.25rem 0 0.5rem;
        border-top: none;
        border-left: none;
        margin-left: 0;
        background-color: var(--primary-blue);
        display: none;
    }

    /* When parent has .open (toggled by JS), show the submenu */
    .dropdown.open>.dropdown-content,
    .sub-dropdown.open>.sub-dropdown-content {
        display: block;
    }

    .dropdown-content a,
    .sub-dropdown-content a {
        padding: 0.5rem 0;
        color: var(--text-light);
    }

    /* Slight indent for child links under Codes/Rules */
    .sub-dropdown-content a {
        padding-left: 1rem;
    }

    /* Footer: stack columns vertically on mobile for better alignment */
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* Loading and No News States for Latest Legal News */
.loading-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.loading-state i {
    font-size: 2.5rem;
    color: var(--primary-blue);
    margin-bottom: 15px;
    display: block;
}

.loading-state p {
    font-size: 1rem;
}

.no-news-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    background: var(--bg-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.no-news-message i {
    font-size: 3rem;
    color: #ddd;
    margin-bottom: 15px;
    display: block;
}

.no-news-message p {
    font-size: 1.1rem;
}