/* 
 * Blog-V PHP Version - Main Stylesheet
 * IT Fire Theme - Dark & Red Accent
 */

/* ========== CSS Variables ========== */
:root {
    /* Colors */
    --color-bg: #0d0d0d;
    --color-surface: #1a1a1a;
    --color-surface-hover: #252525;
    --color-text: #ffffff;
    --color-text-muted: #a0a0a0;
    --color-text-dim: #666666;

    /* Accent colors */
    --color-accent: #dc2626;
    --color-accent-hover: #ef4444;
    --color-highlight: #ff6b6b;

    /* Borders */
    --border-color: rgba(255, 71, 87, 0.3);
    --border-muted: rgba(255, 255, 255, 0.1);
    --border-soft: rgba(255, 255, 255, 0.05);

    /* Header */
    --color-header-bg: rgba(13, 13, 13, 0.95);
    --color-header-border: rgba(255, 255, 255, 0.1);

    /* Gradients */
    --gradient-fire: linear-gradient(135deg, #8B1E1E 0%, #D95030 50%, #FF6347 100%);
    --gradient-dark: linear-gradient(180deg, #1a1a1a 0%, #0d0d0d 100%);

    /* Shadows */
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(220, 38, 38, 0.3);

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Subtle backgrounds */
    --color-bg-subtle: rgba(255, 255, 255, 0.03);

    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Font */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="light"] {
    /* Colors */
    --color-bg: #f3f4f6;
    --color-surface: #ffffff;
    --color-surface-hover: #f9fafb;
    --color-text: #111827;
    --color-text-muted: #4b5563;
    --color-text-dim: #9ca3af;

    /* Borders */
    --border-color: rgba(220, 38, 38, 0.4);
    --border-muted: rgba(0, 0, 0, 0.1);
    --border-soft: rgba(0, 0, 0, 0.05);

    /* Header */
    --color-header-bg: rgba(255, 255, 255, 0.95);
    --color-header-border: rgba(0, 0, 0, 0.1);

    /* Gradients */
    --gradient-dark: linear-gradient(180deg, #ffffff 0%, #f3f4f6 100%);

    /* Shadows */
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-glow: 0 0 15px rgba(220, 38, 38, 0.2);

    /* Subtle backgrounds */
    --color-bg-subtle: rgba(0, 0, 0, 0.03);
}

/* ========== Reset & Base ========== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
}

/* ========== Layout ========== */
.app-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    padding-top: 80px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

/* ========== Header ========== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--color-header-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-header-border);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 1.25rem;
    font-weight: 700;
}

.logo-icon {
    font-size: 1.5rem;
}

.logo-text {
    background: var(--gradient-fire);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: var(--spacing-xl);
}

.nav-link {
    position: relative;
    padding: var(--spacing-sm) 0;
    color: var(--color-text-muted);
    transition: color 0.3s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--color-text);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-fire);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.user-name {
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-text);
    transition: 0.3s;
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-fire);
    color: white;
}

.btn-primary:hover {
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--color-accent);
}

.btn-outline:hover {
    background: rgba(220, 38, 38, 0.1);
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-muted);
}

.btn-ghost:hover {
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.05);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

/* ========== Cards ========== */
.card {
    background: var(--color-surface);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.3s;
}

.card:hover {
    border-color: var(--border-color);
    box-shadow: var(--shadow-card);
    transform: translateY(-4px);
}

.card-image {
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, rgba(139, 30, 30, 0.2) 0%, var(--color-bg) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-image span {
    font-size: 2.5rem;
}

.card-content {
    padding: var(--spacing-lg);
}

.card-category {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.4rem;
    background: rgba(139, 30, 30, 0.2);
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    color: var(--color-highlight);
    margin-right: var(--spacing-sm);
    line-height: 1;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-excerpt {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    line-height: 1.5;
    margin-bottom: var(--spacing-sm);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    font-size: 0.75rem;
    color: var(--color-text-dim);
}

/* ========== Grid Layouts ========== */
.grid {
    display: grid;
    gap: var(--spacing-lg);
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1024px) {
    .grid-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {

    .grid-3,
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* ========== Section Styles ========== */
.section {
    padding: var(--spacing-2xl) 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xl);
}

.section-header h2 {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 1.5rem;
}

.section-icon {
    color: var(--color-accent);
}

.view-all {
    color: var(--color-accent);
    font-size: 0.875rem;
    transition: color 0.3s;
}

.view-all:hover {
    color: var(--color-accent-hover);
}

/* ========== Stats Grid ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-lg);
    max-width: 800px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid rgba(255, 71, 87, 0.4);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    text-align: center;
    transition: all 0.3s;
    box-shadow: 0 0 15px rgba(255, 71, 87, 0.15);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 71, 87, 0.7);
    box-shadow: 0 8px 30px rgba(255, 71, 87, 0.3);
}

.stat-icon {
    color: var(--color-accent);
    margin-bottom: var(--spacing-sm);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* ========== Hero Section ========== */
.hero {
    padding: 6rem 0 3rem;
}

/* ========== Footer ========== */
.footer {
    background: var(--color-surface);
    border-top: 1px solid var(--border-muted);
    padding: var(--spacing-2xl) 0 var(--spacing-lg);
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: var(--spacing-2xl);
    margin-bottom: var(--spacing-xl);
}

@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
    }
}

.footer-desc {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    margin-top: var(--spacing-md);
}

.footer-links {
    display: flex;
    gap: var(--spacing-2xl);
}

.footer-col h4 {
    font-size: 0.875rem;
    margin-bottom: var(--spacing-md);
    color: var(--color-text);
}

.footer-col ul {
    list-style: none;
}

.footer-col li {
    margin-bottom: var(--spacing-sm);
}

.footer-col a {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    transition: color 0.3s;
}

.footer-col a:hover {
    color: var(--color-accent);
}

.footer-bottom {
    text-align: center;
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-muted);
    color: var(--color-text-dim);
    font-size: 0.875rem;
}

/* ========== Alerts ========== */
.alert {
    padding: var(--spacing-md) var(--spacing-lg);
    margin: var(--spacing-md) auto;
    max-width: 1200px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

/* ========== Forms ========== */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-size: 0.875rem;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--color-surface);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-size: 0.875rem;
    transition: border-color 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-accent);
}

.form-input::placeholder {
    color: var(--color-text-dim);
}

textarea.form-input {
    min-height: 120px;
    resize: vertical;
}

/* ========== Pagination ========== */
.pagination {
    display: flex;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-2xl);
}

.page-link {
    padding: 0.5rem 1rem;
    background: var(--color-surface);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    font-size: 0.875rem;
    transition: all 0.3s;
}

.page-link:hover {
    border-color: var(--border-color);
    color: var(--color-text);
}

.page-link.active {
    background: var(--gradient-fire);
    border-color: transparent;
    color: white;
}

/* ========== Loading ========== */
.loading {
    text-align: center;
    padding: var(--spacing-2xl);
    color: var(--color-text-muted);
}

/* ========== Empty State ========== */
.empty-state {
    text-align: center;
    padding: var(--spacing-2xl);
    color: var(--color-text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-md);
}

/* ========== Page Header ========== */
.page-header {
    padding: var(--spacing-2xl) 0;
    text-align: center;
}

.page-title {
    font-size: 2rem;
    margin-bottom: var(--spacing-sm);
}

.page-description {
    color: var(--color-text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* ========== View Toggle ========== */
.view-toggle {
    display: flex;
    gap: 0.25rem;
}

.view-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.3s;
}

.view-btn:hover {
    border-color: var(--border-color);
    color: var(--color-text);
}

.view-btn.active {
    background: var(--gradient-fire);
    border-color: transparent;
    color: white;
}

/* ========== Posts Grid/List Views ========== */
.posts-grid {
    transition: all 0.3s ease;
}

/* List View Mode */
.posts-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.posts-grid.list-view .post-item {
    display: flex;
    flex-direction: row;
    height: 180px;
    /* Fixed height for consistency */
    align-items: stretch;
}

.posts-grid.list-view .post-image {
    width: 280px;
    min-width: 280px;
    height: 100%;
    /* Fill height */
    aspect-ratio: auto;
    /* Allow flexible aspect within height */
    padding: var(--spacing-md);
    /* Add padding around image */
    background: transparent !important;
    /* Remove gradient background to match right side */
}

.posts-grid.list-view .post-image img {
    height: 100%;
    width: 100%;
    object-fit: cover;
    border-radius: var(--radius-lg);
    /* Add rounded corners to image */
}

.posts-grid.list-view .post-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    /* Align top */
    padding: var(--spacing-lg);
}

.posts-grid.list-view .card-category {
    align-self: flex-start;
    margin-bottom: var(--spacing-sm);
}

.posts-grid.list-view .card-title {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-xs);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.posts-grid.list-view .card-excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: auto;
    /* Push meta to bottom */
}

@media (max-width: 768px) {
    .posts-grid.list-view .post-item {
        flex-direction: column;
        height: auto;
    }

    .posts-grid.list-view .post-image {
        width: 100%;
        height: 200px;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
}

/* ========== Article Content (Premium Typography) ========== */
.article-content {
    line-height: 1.8;
    font-size: 1.125rem;
    color: var(--color-text);
    word-wrap: break-word;
}

.article-content p {
    margin-bottom: 1.75rem;
    color: rgba(255, 255, 255, 0.9);
}

.article-content h2,
.article-content h3 {
    margin: 2.5rem 0 1.25rem;
    line-height: 1.3;
    font-weight: 700;
}

.article-content h2 {
    font-size: 1.75rem;
    color: var(--color-text);
    border-left: 4px solid var(--color-accent);
    padding-left: 1rem;
}

.article-content h3 {
    font-size: 1.5rem;
    color: var(--color-highlight);
}

.article-content strong {
    color: white;
}

/* ========== Toolbar & Search ========== */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xl);
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.search-form {
    flex: 1;
    max-width: 400px;
}

.search-group {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    padding-right: 3rem;
    /* Space for the button */
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.05);
    border-color: transparent;
}

.search-input:focus {
    background: var(--color-surface);
    border-color: var(--color-accent);
}

.search-group .btn-icon {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    color: var(--color-text-muted);
    padding: 0.5rem;
    border-radius: 50%;
}

.search-group .btn-icon:hover {
    color: var(--color-accent);
    background: rgba(255, 255, 255, 0.1);
}

/* ========== Badges ========== */
.badge-tips {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    margin-right: var(--spacing-sm);
    line-height: 1;
}

/* ========== Gradients & Utilities ========== */
.gradient-tips {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15) 0%, var(--color-bg) 100%) !important;
}

.meta-separator {
    margin-left: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

@media (max-width: 768px) {
    .toolbar {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .view-toggle {
        align-self: flex-end;
    }

    .search-form {
        max-width: 100%;
    }
}



.article-content a {
    color: var(--color-accent);
    text-decoration: underline;
    text-underline-offset: 4px;
    transition: color 0.3s;
}

.article-content a:hover {
    color: var(--color-accent-hover);
}

.article-content blockquote {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    background: rgba(220, 38, 38, 0.05);
    border-left: 4px solid var(--color-accent);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-style: italic;
    color: var(--color-text-muted);
}

.article-content ul,
.article-content ol {
    margin: 0 0 2rem 1.5rem;
}

.article-content li {
    margin-bottom: 0.75rem;
    padding-left: 0.5rem;
}

.article-content .article-img-container {
    margin: 2.5rem 0;
    text-align: center;
}

.article-content .article-img-container img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.article-content .img-caption {
    display: block;
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: var(--color-text-dim);
    font-style: italic;
}

.article-content hr {
    margin: 3rem 0;
    border: none;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-muted), transparent);
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .nav-actions {
        display: none;
    }
}