/* VARIABLES: The "Theme" */
:root {
    --bg-app: #0f172a;       /* Deep Slate */
    --bg-card: #1e293b;      /* Lighter Slate */
    --text-main: #f1f5f9;    /* Off-white */
    --text-muted: #94a3b8;   /* Gray text */
    --accent-primary: #3b82f6; /* Bright Blue */
    --accent-glow: rgba(59, 130, 246, 0.5);
    --border-color: #334155;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

/* GLOBAL RESET */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-app);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    padding-bottom: 50px;
}

a { color: var(--accent-primary); text-decoration: none; transition: 0.2s; }
a:hover { color: #60a5fa; text-decoration: underline; }

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

/* NAVBAR */
.navbar {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    margin-bottom: 40px;
}
.navbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}
.brand { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.5px; background: linear-gradient(to right, #3b82f6, #8b5cf6); -webkit-background-clip: text; color: transparent; }
.nav-links a { margin-left: 20px; font-weight: 500; color: var(--text-muted); }
.nav-links a:hover { color: var(--text-main); }

/* NAVBAR RESPONSIVE STYLES */
.mobile-menu-toggle {
    display: none; /* Hidden on desktop */
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-card);
        border-top: 1px solid var(--border-color);
        flex-direction: column;
        padding: 10px 0;
    }
    .nav-links.active {
        display: flex;
    }
    .nav-links a {
        margin: 10px 20px;
    }
    .mobile-menu-toggle {
        display: block; /* Shown on mobile */
    }
    .nav-username, .nav-logout-btn {
        margin: 10px 20px;
    }
}

/* GRID SYSTEM (Dashboard) */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); /* Auto-responsive */
    gap: 25px;
}

/* CARDS (Glassmorphism) */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    border-color: var(--accent-primary);
}
.card h3 { margin-bottom: 15px; font-size: 1.25rem; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; }

/* NEWSLETTER & ITEM LISTS */
.item-list { list-style: none; }
.item-list li {
    background: rgba(255, 255, 255, 0.03);
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid transparent;
}
.item-list li:hover { border-color: var(--border-color); background: rgba(255, 255, 255, 0.05); }

/* BADGES */
.badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-success { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.2); color: var(--danger); }

/* FORMS */
form p, .form-group { margin-bottom: 20px; }
label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--text-muted); }
input[type="text"], input[type="password"], input[type="email"], textarea {
    width: 100%;
    padding: 12px;
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 1rem;
    transition: 0.2s;
}
input:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* BUTTONS */
button, .btn {
    display: inline-block;
    background: var(--accent-primary);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: 0.2s;
}
button:hover, .btn:hover {
    background: #2563eb;
    box-shadow: 0 0 15px var(--accent-glow);
    text-decoration: none;
}
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-muted); }
.btn-outline:hover { border-color: var(--text-main); color: var(--text-main); }

/* Drag and Drop Styles */
.drag-over {
    border: 2px dashed var(--accent-primary) !important;
    background-color: rgba(59, 130, 246, 0.1);
}

/* Responsive media within cards */
.post-media-container {
    max-width: 100%;
    overflow: hidden; /* Ensures content doesn't spill out */
    border-radius: 8px; /* Matches card border-radius */
    margin-top: 10px;
    margin-bottom: 10px;
    background-color: #000; /* Optional: background for videos */
}

.post-media-container img,
.post-media-container video {
    width: 100% !important; /* Make media fill the container */
    height: auto !important;
    max-height: 400px !important; /* Limit maximum height */
    display: block !important;
    object-fit: contain !important; /* Ensures the whole image/video is visible */
}

/* Autocomplete Suggestions Styles */
.autocomplete-suggestions {
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
    max-height: 150px;
    overflow-y: auto;
    position: absolute; /* Or relative to its parent if needed */
    z-index: 100;
    width: calc(100% - 2px); /* Adjust to match input width */
    display: none; /* Hidden by default */
    border-radius: 0 0 8px 8px;
}

.suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-main);
}

.suggestion-item:hover {
    background-color: var(--accent-primary);
    color: white;
}

/* Bootstrap's card-img-top might need explicit sizing */
.card-img-top {
    max-width: 100% !important;
    height: auto !important;
    object-fit: cover !important; /* or contain, depending on desired crop/fit */
    border-top-left-radius: 8px !important;
    border-top-right-radius: 8px !important;
}

/* FOOTER */
.site-footer {
    border-top: 1px solid var(--border-color);
    padding: 30px 0;
    margin-top: 40px;
    text-align: center; /* Center the inline elements */
}

.site-footer .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.footer-copy {
    color: var(--text-muted);
}

.footer-socials a, .footer-legal a {
    color: var(--text-muted);
    margin: 0 10px;
}
.footer-socials a:hover, .footer-legal a:hover {
    color: var(--text-main);
}

/* CODE BLOCKS */
.code-block {
    background: #0f172a;
    border: 1px solid #334155;
    padding: 1rem;
    border-radius: 8px;
    font-family: 'Courier New', Courier, monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: #f1f5f9;
}

/* IMAGES IN CONTENT */
.card-text img {
    max-width: 100%;
    height: auto !important;
    border-radius: 8px;
}

/* CAROUSEL STYLES */
.carousel {
    position: relative;
    overflow: hidden;
}
.carousel-inner {
    position: relative;
    width: 100%;
    overflow: hidden;
}
.carousel-item {
    display: none;
    min-width: 100%;
    transition: opacity 0.5s ease;
}
.carousel-item.active {
    display: block;
}
.carousel-item img {
    width: 100%;
    display: block;
}
.carousel-control-prev, .carousel-control-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    text-decoration: none;
    font-size: 2rem;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 0.5rem;
    border-radius: 50%;
}
.carousel-control-prev {
    left: 10px;
}
.carousel-control-next {
    right: 10px;
}

/* ARTICLE GRID AND CARDS */
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* Matches newspaper grid */
    gap: 30px;
}

.article-card {
    background-color: #2c2c34;
    border-radius: 12px;
    margin-bottom: 30px;
    border: 1px solid #444;
    overflow: hidden;
    width: 100%;
    min-width: 200px;
}
.article-card img {
    width: 100%;
    height: auto;
    display: block;
}
.article-card-content {
    padding: 25px;
    overflow-wrap: anywhere;
}
.article-card h3 {
    margin: 0 0 10px;
    font-size: 1.4rem;
    word-wrap: break-word;
}
.article-card h3 a { color: #f5f5f5; text-decoration: none; }
.article-card .meta { color: #9a9a9a; font-size: 0.9rem; margin-bottom: 15px; }
.article-card .description { color: #f5f5f5; font-size: 1rem; }
.article-card .d-flex {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
}
@media (max-width: 768px) {
    .article-card-content { padding: 15px; }
    .article-card .d-flex {
        flex-direction: column;
        align-items: flex-start;
    }
}