/* ===========================================================
   MINESCOUT MASTER STYLESHEET (V5.0 - Fully Merged)
   Contains: Main Layout, Material 3 Design, Roadmap, Glitch, & Admin
   =========================================================== */

/* --- 1. THEME VARIABLES (Merged) --- */
:root {
    /* Brand Palette */
    --md-primary: #5d8c58;
    --md-primary-dark: #4a7046;
    --md-primary-light: #edf7ed;
    --md-secondary-container: #dff0d8;
    
    /* Functional Colors */
    --md-error: #ef4444;
    --md-warning: #f59e0b;
    --md-success: #10b981;
    
    /* Backgrounds & Text */
    --md-surface: #f8fafc;       /* Light Grey Page Background */
    --md-surface-card: #ffffff;  /* White Card Background */
    --md-on-surface: #1a1c1e;    /* Dark Text */
    --md-text-secondary: #475569;
    --md-outline: #e2e8f0;
    
    /* Shapes & Shadows */
    --radius-pill: 50px;
    --radius-card: 16px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    
    /* Animations */
    --motion-standard: cubic-bezier(0.2, 0, 0, 1);
    
    /* Feature Specifics */
    --bg-color: var(--md-surface);
    --text-color: var(--md-on-surface);
    --card-bg: var(--md-surface-card);
    --accent: var(--md-primary);
}

/* Dark Mode Variables (Triggered via JS) */
[data-theme="dark"] {
    --md-surface: #0d1117;
    --md-surface-card: #161b22;
    --md-on-surface: #c9d1d9;
    --md-text-secondary: #8b949e;
    --md-outline: #30363d;
    --md-primary: #00ff00; /* Hacker Green for Dark Mode */
    --md-primary-dark: #00cc00;
    --md-secondary-container: #0f2e18;
    
    /* Mapping for features */
    --bg-color: #0d1117;
    --text-color: #c9d1d9;
    --card-bg: #161b22;
    --accent: #00ff00;
}

/* --- 2. GLOBAL RESET & TYPOGRAPHY --- */
* { box-sizing: border-box; margin: 0; padding: 0; outline-color: var(--md-primary); }

body {
    font-family: 'DM Sans', 'Inter', sans-serif;
    background-color: var(--md-surface);
    color: var(--md-on-surface);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s, color 0.3s;
}

a { text-decoration: none; color: inherit; transition: color 0.2s; }
ul { list-style: none; }
img { max-width: 100%; height: auto; display: block; }
.hidden { display: none !important; }
.text-center { text-align: center; }


/* --- 3. HEADER (Modern Gradient) --- */
.main-header, .top-app-bar {
    background: linear-gradient(120deg, var(--md-primary), #3a5c39);
    color: white;
    padding: 1rem 0;
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
    position: sticky; top: 0; z-index: 1000;
}

.main-header .container, 
.site-title-container,
.header-content {
    display: flex; justify-content: space-between; align-items: center;
    max-width: 1200px; margin: 0 auto; padding: 0 20px;
}

.site-title-wrapper, .site-branding { text-align: center; flex-grow: 1; }

.site-title {
    font-size: 1.8rem; font-weight: 700; letter-spacing: -0.5px; margin: 0;
}
.site-title a { color: white; text-decoration: none; }

.tagline {
    font-size: 0.85rem; color: rgba(255, 255, 255, 0.9);
    font-weight: 500; text-transform: uppercase; letter-spacing: 1px;
}

/* Auth Buttons */
#auth-container a, 
#user-display button,
#signOut-btn,
.btn-glass {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 6px 16px;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
}
#auth-container a:hover, #user-display button:hover {
    background: rgba(255, 255, 255, 0.3); transform: translateY(-1px);
}
#user-display { display: flex; align-items: center; gap: 15px; }


/* --- 4. PAGE LAYOUT --- */
.main-content-area .container, .page-container {
    display: grid;
    grid-template-columns: 1fr 280px; /* Content | Sidebar */
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    align-items: start;
}
main.main-content, main.post-main { min-width: 0; }

/* Sticky Sidebar */
#sidebar, .sidebar {
    background: var(--md-surface-card);
    padding: 25px;
    border-radius: var(--radius-card);
    border: 1px solid var(--md-outline);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 100px;
}

#sidebar h3 {
    font-size: 1rem; color: var(--md-on-surface); font-weight: 700;
    margin-bottom: 15px; text-transform: uppercase; letter-spacing: 0.5px;
    border-bottom: 2px solid var(--md-outline); padding-bottom: 8px;
    display: flex; align-items: center; gap: 8px;
}
#sidebar ul li { margin-bottom: 6px; }
#sidebar a {
    display: block; padding: 8px 12px; border-radius: var(--radius-sm);
    color: var(--md-text-secondary); font-weight: 500; transition: all 0.2s;
}
#sidebar a:hover {
    background-color: var(--md-secondary-container);
    color: var(--md-primary-dark); transform: translateX(4px);
}


/* --- 5. BUTTONS --- */
.btn, .read-more, .submit-button, .admin-button {
    display: inline-flex; align-items: center; justify-content: center;
    background-color: var(--md-primary); color: white !important;
    padding: 10px 24px; border-radius: var(--radius-pill);
    text-decoration: none; font-weight: 600; font-size: 0.95rem;
    transition: all 0.2s; border: none; cursor: pointer;
    box-shadow: var(--shadow-sm);
}
.read-more:hover, .submit-button:hover, .admin-button:hover {
    background-color: var(--md-primary-dark); transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}


/* --- 6. POSTS GRID & CARDS --- */
.view-controls { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 24px; }
.view-btn, .seg-btn {
    background: var(--md-surface-card); border: 1px solid var(--md-outline);
    padding: 6px 12px; border-radius: var(--radius-pill); cursor: pointer; color: var(--md-text-secondary);
}
.view-btn.active, .seg-btn.active {
    background: var(--md-secondary-container); color: var(--md-primary-dark); border-color: var(--md-primary);
}

.posts-grid { display: grid; gap: 24px; }
.posts-grid.view-3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.posts-grid.view-2 { grid-template-columns: 1fr 1fr; }
.posts-grid.view-1 { grid-template-columns: 1fr; }

/* FIX: Header Span for Archives */
.month-header-span {
    grid-column: 1 / -1 !important;
    width: 100%; margin-top: 40px; margin-bottom: 10px;
    padding-bottom: 10px; border-bottom: 2px solid var(--md-outline);
    color: var(--md-primary); font-size: 1.5rem; font-weight: 700;
}

.post-card {
    background: var(--md-surface-card);
    border: 1px solid var(--md-outline);
    border-radius: var(--radius-card);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex; flex-direction: column; height: 100%;
}
.post-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }

.post-card img, .post-image-wrapper img {
    width: 100%; height: 200px; object-fit: cover; background: #eee;
}
.post-card-content, .post-body {
    padding: 24px; display: flex; flex-direction: column; flex-grow: 1;
}
.post-card h3, .post-title {
    margin: 0 0 10px 0; font-size: 1.25rem; line-height: 1.3;
}
.post-card h3 a { color: var(--md-on-surface); text-decoration: none; }
.post-card h3 a:hover { color: var(--md-primary); }

.post-meta {
    font-size: 0.85rem; color: var(--md-text-secondary); margin-bottom: 12px;
    text-transform: uppercase; font-weight: 600; letter-spacing: 0.5px;
}
.post-excerpt, .post-card p {
    flex-grow: 1; margin-bottom: 20px; color: var(--md-text-secondary);
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

/* Category Pill */
.category-pill {
    align-self: flex-start; background: var(--md-secondary-container); 
    color: var(--md-primary-dark); padding: 4px 12px; border-radius: 20px; 
    font-size: 0.75rem; font-weight: 700; text-transform: uppercase; margin-bottom: 12px;
}


/* --- 7. ADMIN & NOTICES --- */
.admin-section, .status-card {
    background: white; border: 1px solid var(--md-outline);
    padding: 15px 20px; border-radius: 12px; margin-bottom: 30px;
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: var(--shadow-sm); border-left: 4px solid var(--md-primary);
}
.admin-info-text { font-weight: 700; color: var(--md-primary); margin: 0; }

.notification-badge {
    background: var(--md-error); color: white;
    font-size: 0.7rem; padding: 2px 6px; border-radius: 10px;
    margin-left: 8px; vertical-align: middle;
    animation: pulse-red 2s infinite;
}
@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { box-shadow: 0 0 0 5px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.notice-box {
    background: #fffbeb; border: 1px solid #fcd34d; color: #92400e;
    padding: 16px; border-radius: 8px; margin-bottom: 20px;
    display: flex; gap: 10px; align-items: start; position: relative;
}
.dismiss-btn {
    background: var(--md-error); color: white; border: none;
    padding: 4px 10px; border-radius: 4px; cursor: pointer;
    font-size: 0.75rem; margin-left: auto;
}


/* ===========================================================
   FEATURES (Merged from features.css)
   Roadmap, Tree, Glitch, GitHub
   =========================================================== */

/* --- ROADMAP CONTAINER --- */
.roadmap-container {
    display: flex; gap: 20px; overflow-x: auto; padding: 20px 5px;
    font-family: 'Inter', sans-serif; position: relative;
}

/* Connect Mode Selection */
.roadmap-container.connect-mode-active { cursor: crosshair; }
.roadmap-container.connect-mode-active .roadmap-card {
    border-style: dashed; border-color: var(--md-primary);
}
.roadmap-container.connect-mode-active .roadmap-card:hover {
    background-color: #f0fdf4; transform: scale(1.05);
}

.roadmap-col {
    flex: 1; min-width: 280px;
    background: #f8f9fa; border: 1px solid #e5e7eb;
    border-radius: 12px; padding: 20px;
    display: flex; flex-direction: column;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    z-index: 2;
}

.roadmap-col h3 {
    margin-top: 0; font-size: 1.2rem; font-weight: 700;
    padding-bottom: 12px; border-bottom: 2px solid;
    display: flex; align-items: center; gap: 8px; color: #1f2937;
}

.roadmap-col.planned h3 { border-color: #3b82f6; color: #1e3a8a; }
.roadmap-col.progress h3 { border-color: #f59e0b; color: #78350f; }
.roadmap-col.done h3 { border-color: #10b981; color: #064e3b; }

/* Roadmap Card */
.roadmap-card {
    background: #ffffff;
    border: 1px solid #e5e7eb; border-left-width: 4px;
    padding: 12px 16px; margin-bottom: 12px;
    border-radius: 6px; color: #374151; font-weight: 500;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: relative; cursor: default;
    transition: all 0.2s;
}
.roadmap-card.selected-for-connect {
    border: 2px solid var(--md-primary) !important;
    transform: scale(1.02); box-shadow: 0 0 10px rgba(90, 138, 90, 0.5);
}
.roadmap-col.planned .roadmap-card { border-left-color: #3b82f6; }
.roadmap-col.progress .roadmap-card { border-left-color: #f59e0b; }
.roadmap-col.done .roadmap-card { border-left-color: #10b981; }

.roadmap-tag {
    float: right; font-size: 0.7rem; padding: 2px 8px;
    background: #f3f4f6; color: #6b7280;
    border-radius: 12px; margin-left: 8px;
    text-transform: uppercase; letter-spacing: 0.5px; font-weight: bold;
}

/* Admin Input Group */
.roadmap-input-group {
    margin-top: auto; padding-top: 15px;
    display: none; /* Hidden via JS */
    flex-direction: column; gap: 10px;
}
.roadmap-input, .roadmap-tag-select {
    width: 100%; padding: 10px 12px;
    background: #ffffff; border: 1px solid #d1d5db;
    border-radius: 6px; font-size: 0.95rem; outline: none;
    box-sizing: border-box;
}
.roadmap-input:focus { border-color: var(--md-primary); box-shadow: 0 0 0 3px rgba(90, 138, 90, 0.2); }

.btn-add-task {
    width: 100%; padding: 10px 20px;
    background-color: var(--md-primary); color: white;
    border: none; border-radius: 6px;
    font-weight: bold; cursor: pointer; text-transform: uppercase;
}
.btn-add-task:hover { background-color: var(--md-primary-dark); }

.btn-delete-item {
    position: absolute; top: 8px; right: 8px;
    color: var(--md-error); cursor: pointer; font-weight: bold;
    display: none;
    background: #fee2e2; border-radius: 50%; width: 20px; height: 20px;
    text-align: center; line-height: 20px; font-size: 14px;
}
.roadmap-card:hover .btn-delete-item { display: block; }

/* SVG Lines */
#roadmap-lines line {
    stroke: var(--md-primary); stroke-width: 3;
    stroke-dasharray: 6; opacity: 0.5;
    animation: dash 60s linear infinite;
}
@keyframes dash { to { stroke-dashoffset: 1000; } }

/* --- TREE DIAGRAM --- */
.tree-wrapper {
    margin-top: 50px; padding: 40px; background: #fff;
    border: 1px solid #ddd; border-radius: 12px;
    text-align: center; position: relative; overflow-x: auto;
}
.tree-wrapper h3 { margin-bottom: 30px; color: #444; }

.tree-level {
    display: flex; justify-content: center; gap: 40px;
    margin-bottom: 50px; position: relative;
    padding-left: 30px; min-height: 60px;
}
.tree-node {
    position: relative; padding: 10px 20px; border-radius: 20px;
    color: white; font-weight: bold; font-size: 0.9rem; min-width: 140px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1); z-index: 2;
    display: flex; align-items: center; justify-content: center;
}
.tree-node.done { background-color: #10b981; }
.tree-node.progress { background-color: #f59e0b; }
.tree-node.planned { background-color: #3b82f6; }

.tree-level:not(:last-child)::after {
    content: ''; position: absolute; bottom: -30px; left: 50%;
    width: 2px; height: 30px; background: #ccc; transform: translateX(-50%);
}
.tree-level:not(:first-child)::before {
    content: ''; position: absolute; top: -25px; left: 10%; right: 10%;
    height: 2px; background: #ccc; display: block; z-index: 1;
}
.level-label {
    position: absolute; left: 0; top: 0; bottom: 0;
    font-size: 0.7rem; font-weight: bold; color: #999;
    text-transform: uppercase; writing-mode: vertical-rl; text-align: center;
}

/* --- GITHUB & GLITCH --- */
.github-widget {
    background: #24292e; color: white; padding: 15px; border-radius: 8px; margin-bottom: 20px; font-size: 0.9rem;
}
.gh-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.gh-avatar { width: 40px; height: 40px; border-radius: 50%; }
.gh-stats { display: flex; justify-content: space-between; font-size: 0.8rem; opacity: 0.8; }

.glitch-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.2); z-index: 9999; pointer-events: none;
}
.glitch-active .glitch-overlay { display: block; animation: glitch 0.2s infinite; }
@keyframes glitch { 
    0% { transform: translate(0); } 20% { transform: translate(-2px, 2px); } 
    40% { transform: translate(-2px, -2px); } 100% { transform: translate(0); } 
}
#theme-toggle {
    background: transparent; border: 1px solid white; color: white;
    padding: 5px 10px; cursor: pointer; border-radius: 4px; font-weight: bold;
}

/* --- FOOTER & RESPONSIVE --- */
.main-footer {
    margin-top: 60px; padding: 40px 0;
    color: var(--md-text-secondary); text-align: center;
    border-top: 1px solid var(--md-outline); background: transparent;
}
@media (max-width: 900px) {
    .main-content-area .container { grid-template-columns: 1fr; gap: 30px; }
    #sidebar { position: static; width: 100%; }
    .posts-grid.view-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
    .posts-grid.view-3, .posts-grid.view-2 { grid-template-columns: 1fr; }
    .site-title { font-size: 1.5rem; }
}

/* --- MODAL --- */
.custom-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px); z-index: 2000;
    display: none; justify-content: center; align-items: center;
}
.custom-modal-overlay.show { display: flex; }
.custom-modal-content {
    background: white; padding: 30px; border-radius: var(--radius-card);
    max-width: 500px; width: 90%; box-shadow: var(--shadow-lg); text-align: center;
}
.modal-close-btn {
    margin-top: 15px; background: var(--md-outline); border: none;
    padding: 8px 16px; border-radius: 5px; cursor: pointer;
}