/* core/global.css */

/* --- 1. GLOBAL RESET & OS NORMALIZATION --- */
*, *::before, *::after {
    box-sizing: border-box; /* Fixes layout math on all OSs */
}

html {
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
}

/* 2. Register the Custom Font */
@font-face {
    font-family: 'Minecraft';
    src: url('../assets/fonts/Minecraft_Custom.woff2') format('woff2');
}

:root {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --accent-color: #3585d0;
    --nav-bg: #1e1e1e;
    --border-color: #333;
    --hover-bg: #2d2d2d;
}

/* --- CUSTOM SCROLLBAR --- */

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #444 var(--bg-color);
}

/* WebKit (Chrome, Edge, Safari, Opera) */
::-webkit-scrollbar {
    width: 12px; /* Width of vertical scrollbar */
    height: 12px; /* Height of horizontal scrollbar */
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background-color: #444; 
    border-radius: 6px;
    /* Adds a nice gap between the thumb and the track edge */
    border: 3px solid var(--bg-color); 
    transition: background-color 0.2s;
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--accent-color); 
}

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    -webkit-font-smoothing: antialiased; 
    -moz-osx-font-smoothing: grayscale; 
    overflow-x: hidden; 
}

/* --- NAVIGATION BAR --- */
#global-navbar {
    display: flex;
    align-items: center;
    background-color: var(--nav-bg);
    border-bottom: 1px solid var(--border-color);
    min-height: 60px; /* Changed from height to min-height for mobile wrapping */
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
    flex-wrap: wrap; /* Allows wrapping on small screens */
    flex-shrink: 0;
}

/* Header Wrapper (Logo + Mobile Toggle) */
.nav-header {
    width: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Left: Logo */
.nav-left {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap; 
    height: 100%;
}

/* Center: Categories Container */
.nav-center {
    display: flex;
    gap: 10px;
    height: 100%;
    align-items: center;
    margin-left: 40px; 
    margin-right: auto; 
}

/* Nav Item Wrapper */
.nav-item {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

/* Links */
.nav-link {
    color: #aaa;
    text-decoration: none;
    font-size: 1rem;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
    white-space: nowrap;
}

.nav-link:hover, .nav-item:hover .nav-link {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.05);
}

/* --- DROPDOWN MENU --- */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--nav-bg);
    border: 1px solid var(--border-color);
    border-top: none;
    min-width: 160px;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    padding: 5px 0;
    flex-direction: column;
}

/* Show on Hover (Desktop) */
.nav-item:hover .dropdown-menu {
    display: flex;
}

.dropdown-item {
    color: #ccc;
    text-decoration: none;
    padding: 10px 15px;
    font-size: 0.9rem;
    transition: background 0.2s;
    display: block;
    text-align: left;
}

.dropdown-item:hover {
    background-color: var(--hover-bg);
    color: #fff;
}

/* Right: Search & Settings */
.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Main Content */
main {
    padding: 60px 20px;
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
}

h1 { font-size: 3rem; margin: 0 0 10px 0; }
.hero-subtitle { color: #888; font-size: 1.2rem; }


/* --- UI COMPONENT STANDARD --- */

/* 1. Standard Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    font-family: inherit; 
    font-size: 1rem;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    text-align: center;
}

/* Primary Action */
.btn-primary {
    background-color: var(--accent-color);
    color: #000;
    font-weight: bold;
    border-color: var(--accent-color);
}

.btn-primary:hover {
    background-color: #5a9ce6; 
    border-color: #5a9ce6;
    transform: translateY(-1px);
}

/* Secondary Action */
.btn-secondary {
    background-color: transparent;
    border: 1px solid #444;
    color: #ccc;
}

.btn-secondary:hover {
    border-color: #fff;
    color: #fff;
    background-color: rgba(255, 255, 255, 0.05);
}

/* 4. Icon Button Modifier (Fixes alignment) */
.btn-icon {
    padding: 0;
    width: 38px;
    height: 38px;
    font-size: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;      
    box-sizing: border-box;
}

/* 2. Standard Inputs */
.input-std {
    background-color: #000;
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
    line-height: 1.5; /* FIX: Prevents cutting off 'y' and 'g' */
}

.input-std:focus {
    border-color: var(--accent-color);
}

/* 3. Standard Content Panel */
.panel {
    background-color: var(--nav-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

/* --- SEARCH BAR --- */
.search-wrapper {
    position: relative; 
    width: 250px;
}

.search-input {
    width: 100%;
    box-sizing: border-box;
}

.search-results-menu {
    display: none; 
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--nav-bg);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    z-index: 1100;
    flex-direction: column;
    max-height: 300px;
    overflow-y: auto;
}

/* --- TOAST NOTIFICATIONS --- */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
}

.toast {
    background-color: var(--nav-bg);
    border: 1px solid var(--accent-color);
    color: #fff;
    padding: 12px 20px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    opacity: 0;
    transform: translateY(20px);
    animation: slideIn 0.3s forwards;
    font-size: 0.9rem;
    min-width: 200px;
}

@keyframes slideIn {
    to { opacity: 1; transform: translateY(0); }
}

.toast.fade-out {
    animation: slideOut 0.3s forwards;
}

@keyframes slideOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
}

/* --- MOBILE RESPONSIVENESS --- */
.mobile-only {
    display: none !important; /* Hidden by default */
}

@media screen and (max-width: 768px) {
    /* Stack the navbar elements vertically */
    #global-navbar {
        padding: 10px 20px;
        flex-direction: column;
        align-items: stretch; 
        gap: 15px;
    }

    /* Show hamburger on Mobile */
    .mobile-only {
        display: inline-flex !important;
    }

    .nav-header {
        width: 100%;
    }

    /* Hide links/search by default */
    .nav-center, .nav-right {
        display: none;
    }

    /* Show when toggled open */
    #global-navbar.mobile-open .nav-center,
    #global-navbar.mobile-open .nav-right {
        display: flex;
    }

    /* Reset margins for mobile */
    .nav-center {
        margin: 0;
        flex-direction: column;
        width: 100%;
        gap: 0;
    }

    .nav-item {
        width: 100%;
        text-align: center;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    
    .nav-link {
        display: block;
        padding: 15px 0; /* Larger touch target */
    }

    .nav-right {
        width: 100%;
        flex-direction: row; /* Keep search and settings side-by-side */
    }
    
    .search-wrapper {
        width: 100%;
        flex-grow: 1;
    }

    /* Handle Dropdowns on Mobile */
    .dropdown-menu {
        position: static; 
        box-shadow: none;
        border: none;
        background: rgba(0,0,0,0.2);
    }
    
    /* Always allow expanding by focus/click logic */
    .nav-item:focus-within .dropdown-menu {
        display: flex;
    }
}

/* --- ROADMAP / TODO LIST --- */
.roadmap-container {
    max-width: 700px; /* Slightly wider to fit controls */
    margin: 40px auto 0 auto;
    text-align: left;
}

/* Header & Controls Layout */
.roadmap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap; /* Wraps on mobile */
    gap: 15px;
}

.roadmap-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--accent-color);
}

.roadmap-controls {
    display: flex;
    gap: 10px;
}

/* Small Inputs for the Toolbar */
.input-sm {
    /* 1. Asymmetric Padding: Less top/More bottom pulls the text visually UP */
    padding: 4px 10px 8px 10px;
    
    font-size: 1rem;
    cursor: pointer;
    
    /* 2. Line-Height Fix: Prevents the bottom of 'g' and 'y' from being cut off */
    line-height: 1.5;
    
    /* 3. Ensure the element calculates height based on content + padding */
    height: auto;
}

/* List Styles */
.todo-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.todo-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    gap: 15px;
    animation: fadeIn 0.3s ease;
}

.todo-item:last-child {
    border-bottom: none;
}

.todo-empty {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* Status Tags */
.status-tag {
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    text-transform: uppercase;
    min-width: 90px; /* Fixed width for alignment */
    text-align: center;
    letter-spacing: 0.5px;
}

/* 1. To Do (Gray/Subtle) */
.status-tag.todo {
    background-color: rgba(255, 255, 255, 0.1);
    color: #aaa;
    border: 1px solid #555;
}

/* 2. WIP (Cyan/Accent) */
.status-tag.wip {
    background-color: rgba(53, 133, 208, 0.15);
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    box-shadow: 0 0 5px rgba(53, 133, 208, 0.2);
}

/* 3. Done (Green) */
.status-tag.done {
    background-color: rgba(46, 204, 113, 0.15);
    color: #2ecc71;
    border: 1px solid #2ecc71;
}

/* Completed Item Text */
.todo-item.completed span:last-child {
    text-decoration: line-through;
    color: #666;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- ICON IMAGES --- */
.icon-img {
    width: 20px;
    height: 20px;
    display: block;
    
    /* OPTIONAL: Filter to force the icon color to match your text theme */
    /* This filter turns a black SVG into a light gray one */
    filter: invert(0.8);
    transition: filter 0.2s ease;
}

/* On Hover: Make it brighter white */
.btn:hover .icon-img {
    filter: invert(1); 
}

/* --- SETTINGS MODAL --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000; /* Above navbar */
    backdrop-filter: blur(2px);
}

.modal-content {
    background-color: var(--nav-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.btn-close {
    background: none;
    border: none;
    color: #888;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.btn-close:hover {
    color: #fff;
}

.modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* --- TILE GRID SYSTEM --- */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.category-tile {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #1a1a1a;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 25px 10px;
    color: #e0e0e0;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s ease;
}

.category-tile:hover {
    background-color: var(--hover-bg);
    border-color: #555;
    color: #fff;
}