/* php_app/public/css/style.css */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap");

:root {
    --radius: 0.5rem;
    --font-sans: "Inter", system-ui, -apple-system, sans-serif;

    --background: #ffffff;
    --foreground: #0f172a;
    --card: #ffffff;
    --card-foreground: #0f172a;
    --primary: #ea580c; /* NextNews Vibrant Orange */
    --primary-foreground: #ffffff;
    --secondary: #f1f5f9;
    --secondary-foreground: #0f172a;
    --muted: #f8fafc;
    --muted-foreground: #64748b;
    --accent: #f1f5f9;
    --accent-foreground: #0f172a;
    --border: #e2e8f0;
    --input: #e2e8f0;
    --ring: #ea580c;

    --sidebar-bg: #f8fafc;
    --sidebar-fg: #0f172a;
}

html.dark {
    --background: #090d16;
    --foreground: #f8fafc;
    --card: #111827;
    --card-foreground: #f8fafc;
    --primary: #f97316;
    --primary-foreground: #ffffff;
    --secondary: #1e293b;
    --secondary-foreground: #f8fafc;
    --muted: #1e293b;
    --muted-foreground: #94a3b8;
    --accent: #1e293b;
    --accent-foreground: #f8fafc;
    --border: #1f293d;
    --input: #1f293d;
    --ring: #f97316;

    --sidebar-bg: #111827;
    --sidebar-fg: #f8fafc;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border-color: var(--border);
}

body {
    font-family: var(--font-sans);
    background-color: var(--background);
    color: var(--foreground);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
    transition:
        background-color 0.3s ease,
        color 0.3s ease;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Layout Utilities */
.container {
    width: 100%;
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Header & Navbar */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 50;
    width: 100%;
    border-bottom: 1px solid var(--border);
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background-color 0.3s ease;
}

html.dark .sticky-header {
    background-color: rgba(9, 13, 22, 0.85);
}

.nav-wrapper {
    display: flex;
    height: 4rem;
    align-items: center;
    justify-content: space-between;
}

.logo-text {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

@media (max-width: 1024px) {
    .nav-links.desktop-only {
        display: none;
    }
    .search-container.desktop-only {
        display: none;
    }
}

.nav-link {
    color: var(--muted-foreground);
    transition: color 0.2s ease;
    position: relative;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.nav-link:hover,
.nav-link.active {
    color: var(--foreground);
}

.nav-link.active::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--primary);
    border-radius: 1px;
}

/* Search Bar */
.search-container {
    position: relative;
    width: 14rem;
    transition: width 0.3s ease;
}

.search-container:focus-within {
    width: 18rem;
}

.search-input {
    width: 100%;
    padding: 0.45rem 2.5rem 0.45rem 2.2rem;
    font-size: 0.875rem;
    border-radius: calc(var(--radius) * 1.5);
    border: 1px solid var(--input);
    background-color: var(--muted);
    color: var(--foreground);
    outline: none;
}

.search-input:focus {
    border-color: var(--primary);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    color: var(--muted-foreground);
    pointer-events: none;
}

.search-btn {
    position: absolute;
    right: 0.25rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    background-color: var(--primary);
    color: var(--primary-foreground);
    border: none;
    border-radius: calc(var(--radius) * 1.2);
    cursor: pointer;
}

/* Theme Switcher Button */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background-color: var(--card);
    color: var(--foreground);
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-icon:hover {
    background-color: var(--accent);
}

/* Cards & Grid Layouts */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-cols-12 {
    grid-template-columns: repeat(12, minmax(0, 1fr));
}

@media (max-width: 768px) {
    .md-col-span-8,
    .md-col-span-4 {
        grid-column: span 12 / span 12 !important;
    }
}

.md-col-span-8 {
    grid-column: span 8 / span 8;
}

.md-col-span-4 {
    grid-column: span 4 / span 4;
}

.card {
    background-color: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.15);
}

/* Featured Hero Section */
.featured-card {
    position: relative;
    height: 28rem;
    border-radius: calc(var(--radius) * 1.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

@media (max-width: 768px) {
    .featured-card {
        height: 22rem;
    }
}

.featured-card > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s ease;
}

.featured-card:hover > img {
    transform: scale(1.04);
}

.card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.92) 0%,
        rgba(0, 0, 0, 0.4) 50%,
        rgba(0, 0, 0, 0) 100%
    );
}

.featured-content {
    position: relative;
    z-index: 10;
    padding: 1.75rem;
    color: #ffffff;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 9999px;
    background-color: var(--primary);
    color: #ffffff;
    margin-bottom: 0.75rem;
}

.badge-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.title-hero {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 0.75rem;
}

@media (max-width: 768px) {
    .title-hero {
        font-size: 1.35rem;
    }
}

/* Horizontal Article Card */
.horizontal-card {
    position: relative;
    height: 13.5rem;
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.horizontal-card img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.horizontal-card:hover img {
    transform: scale(1.05);
}

/* Article Cards Grid */
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.post-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.post-card-image {
    position: relative;
    width: 100%;
    height: 12rem;
    overflow: hidden;
}

.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.post-card:hover .post-card-image img {
    transform: scale(1.05);
}

.post-card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.post-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 0.5rem;
    color: var(--foreground);
    transition: color 0.2s ease;
}

.post-card-title:hover {
    color: var(--primary);
}

.post-card-excerpt {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.author-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    object-fit: cover;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--primary-foreground);
}

.btn-primary:hover {
    filter: brightness(0.95);
}

.btn-outline {
    border-color: var(--border);
    background-color: transparent;
    color: var(--foreground);
}

.btn-outline:hover {
    background-color: var(--accent);
}

/* Footer */
footer {
    margin-top: auto;
    border-top: 1px solid var(--border);
    background-color: var(--card);
    padding-top: 3rem;
    padding-bottom: 3rem;
}

/* Mobile Menu Sheet */
.mobile-drawer {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
}

.mobile-drawer.open {
    display: block;
}

.drawer-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.drawer-content {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 18rem;
    background-color: var(--card);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
}

/* Form Styles */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.9rem;
    font-size: 0.875rem;
    border-radius: var(--radius);
    border: 1px solid var(--input);
    background-color: var(--background);
    color: var(--foreground);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.2);
}

/* Tailwind-style lg:hidden utility: hide hamburger menu on large screens.
   Kept at the end so it wins over .btn-icon's display rule (same specificity). */
@media (min-width: 1025px) {
    .lg\:hidden {
        display: none;
    }
}

/* Theme toggle: always show the icon matching the active theme (pure CSS, no JS flash).
   Use element-qualified selectors so they beat FontAwesome's .fa-solid display rule. */
i.theme-icon-sun {
    display: none;
}

html.dark i.theme-icon-moon {
    display: none;
}

html.dark i.theme-icon-sun {
    display: inline-block;
}

/* Drawer search: stretch to the full width of the mobile sheet */
.drawer-search,
.drawer-search:focus-within {
    width: 100%;
}
