/* --- General Reset & Color Palette --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

:root {
    --bg-main: #060913;
    --bg-card: #0d1527;
    --bg-input: #141f36;
    --text-main: #f0f4f8;
    --text-muted: #7fa1ca;
    --accent-cloud: #00f0ff;
    --accent-green: #00ffaa;
    --accent-orange: #ffaa00;
    --border: #1b2a47;
    --header-bg: rgba(13, 21, 39, 0.95);
    --header-scrolled: rgba(6, 9, 19, 0.98);
    --footer-bg: #03050a;
    --bg-overlay: rgba(6, 9, 19, 0.80); /* Dark theme overlay */
}

[data-theme="light"] {
    --bg-main: #f0f4f8;
    --bg-card: #ffffff;
    --bg-input: #e2e8f0;
    --text-main: #0d1527;
    --text-muted: #4a5568;
    --accent-cloud: #0088ff;
    --accent-green: #00a366;
    --accent-orange: #d97700;
    --border: #cbd5e0;
    --header-bg: rgba(255, 255, 255, 0.95);
    --header-scrolled: rgba(240, 244, 248, 0.98);
    --footer-bg: #e2e8f0;
    --bg-overlay: rgba(240, 244, 248, 0.80); /* Light theme overlay */
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

[style*="var(--bg-card)"], tr, th, td {
    transition: background-color 0.3s ease, background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

a { 
    text-decoration: none; 
    color: inherit; 
}

/* --- Header Navigation --- */
header {
    background-color: var(--header-bg);
    padding: 1rem 5%;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    backdrop-filter: blur(10px);
    transition: background-color 0.3s ease, padding 0.3s ease, box-shadow 0.3s ease;
}

header.scrolled {
    background-color: var(--header-scrolled);
    padding: 0.6rem 5%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
}

.logo {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: var(--text-main);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-self: start;
}

.logo img {
    height: 32px;
    width: auto;
}

.logo span { color: var(--accent-cloud); }

nav {
    justify-self: center;
}

nav ul { display: flex; list-style: none; }
nav ul li { margin-left: 1.5rem; }
nav ul li:first-child { margin-left: 0; }
nav ul li a { 
    font-weight: 600; 
    font-size: 0.95rem; 
    transition: color 0.3s; 
    position: relative;
}
nav ul li a:hover { color: var(--accent-cloud); }

.header-right {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.header-right a {
    font-weight: 600; 
    font-size: 0.95rem; 
    transition: color 0.3s; 
    position: relative;
}
.header-right a:hover { color: var(--accent-cloud); }

/* --- Theme Toggle Button --- */
.theme-toggle {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.1rem;
    cursor: pointer;
    transition: color 0.3s;
    position: relative;
}
.theme-toggle:hover { color: var(--accent-cloud); }

/* --- Color Picker --- */
.color-picker-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.color-picker {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    padding: 0;
}

.color-picker::-webkit-color-swatch-wrapper { padding: 0; }
.color-picker::-webkit-color-swatch {
    border: 2px solid var(--text-main);
    border-radius: 50%;
    transition: border-color 0.3s;
}
.color-picker:hover::-webkit-color-swatch { border-color: var(--accent-cloud); }
.color-picker::-moz-color-swatch {
    border: 2px solid var(--text-main);
    border-radius: 50%;
    transition: border-color 0.3s;
}
.color-picker:hover::-moz-color-swatch { border-color: var(--accent-cloud); }

/* --- Nav Tooltips --- */
nav ul li a::after, .header-right a::after, .header-right .theme-toggle::after, .color-picker-wrapper::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background-color: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--accent-cloud);
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    text-shadow: 0 0 5px var(--accent-cloud);
}

nav ul li a:hover::after, .header-right a:hover::after, .header-right .theme-toggle:hover::after, .color-picker-wrapper:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* --- Hero Section --- */
.hero {
    height: 55vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 1rem;
    margin-top: 60px;
    background: linear-gradient(rgba(6, 9, 19, 0.7), var(--bg-main)), 
                url('https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?q=80&w=1920') no-repeat center center/cover;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: 0 4px 15px rgba(0,0,0,0.7);
}

.hero p {
    font-size: 1.2rem;
    max-width: 600px;
    margin-bottom: 2rem;
    color: var(--text-muted);
}

/* --- Global Layout Containers --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem 5rem 1.5rem;
}

section { padding: 2.5rem 0; }

h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-left: 4px solid var(--accent-cloud);
    padding-left: 0.75rem;
}

/* --- Server Map Boards --- */
.map-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.map-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.map-card h3 {
    font-size: 1.5rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.map-meta {
    font-size: 0.85rem;
    color: var(--accent-cloud);
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.map-features {
    list-style: none;
    margin: 1.25rem 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.map-features li {
    margin-bottom: 0.5rem;
}

.map-features li::before {
    content: "⚡ ";
    color: var(--accent-cloud);
}

.status-ip-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    padding: 0.6rem 1rem;
    border-radius: 4px;
    margin-top: 1rem;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.status-ip {
    font-family: monospace;
    color: var(--accent-green);
    font-size: 0.9rem;
}

/* --- Shop System Layout --- */
.shop-container {
    display: grid;
    grid-template-columns: 2.5fr 1.2fr;
    gap: 2rem;
}

@media (max-width: 900px) {
    .shop-container { grid-template-columns: 1fr; }
}

.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
}

.product-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s, border-color 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}

.product-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-cloud);
}

.tag {
    align-self: flex-start;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: bold;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.75rem;
}
.tag.pack { background: rgba(0, 240, 255, 0.15); color: var(--accent-cloud); }
.tag.dino { background: rgba(0, 255, 170, 0.15); color: var(--accent-green); }
.tag.vip { background: rgba(255, 170, 0, 0.15); color: var(--accent-orange); }

.product-card h3 { margin-bottom: 0.5rem; font-size: 1.2rem; }
.product-card p { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1.5rem; }

.price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.price { font-size: 1.3rem; font-weight: bold; color: var(--text-main); }

/* --- Buttons --- */
.btn-main {
    background: var(--accent-cloud);
    color: #000;
    border: none;
    padding: 0.75rem 2rem;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
    font-size: 0.9rem;
    transition: opacity 0.2s;
}
.btn-main:hover { opacity: 0.9; }

.btn-glow {
    animation: btn-glow-pulse 2s infinite;
}

@keyframes btn-glow-pulse {
    0% { box-shadow: 0 0 5px var(--accent-cloud); }
    50% { box-shadow: 0 0 20px var(--accent-cloud), 0 0 30px rgba(0, 240, 255, 0.4); }
    100% { box-shadow: 0 0 5px var(--accent-cloud); }
}

.text-pulse {
    animation: text-warning-pulse 1.5s infinite ease-in-out;
}

@keyframes text-warning-pulse {
    0% { opacity: 1; text-shadow: 0 0 0px rgba(255, 74, 74, 0); }
    50% { opacity: 0.7; text-shadow: 0 0 10px rgba(255, 74, 74, 0.8); }
    100% { opacity: 1; text-shadow: 0 0 0px rgba(255, 74, 74, 0); }
}

.btn-action {
    background: var(--border);
    color: var(--text-main);
    border: none;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}
.btn-action:hover { background: var(--bg-input); }

.btn-add {
    background: var(--accent-cloud);
    color: #000;
    border: none;
    padding: 0.5rem 1rem;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

/* --- Checkout Cart Sidebar --- */
.cart-panel {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    align-self: start;
    position: sticky;
    top: 90px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.cart-title {
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    transition: border-color 0.3s ease, color 0.3s ease;
}

.cart-items {
    max-height: 240px;
    overflow-y: auto;
    margin-bottom: 1.5rem;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    background-color: var(--bg-input);
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.cart-item button {
    background: none;
    border: none;
    color: #ff4a4a;
    cursor: pointer;
    font-weight: bold;
}

.input-group { margin-bottom: 1.25rem; }
.input-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
}
.input-group input {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    padding: 0.6rem;
    border-radius: 4px;
    color: var(--text-main);
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    font-size: 1.2rem;
    margin: 1.5rem 0;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    transition: border-color 0.3s ease, color 0.3s ease;
}

.btn-checkout {
    width: 100%;
    background: var(--accent-green);
    color: #000;
    border: none;
    padding: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 4px;
    cursor: pointer;
}

/* --- Footer --- */
footer {
    background-color: var(--footer-bg);
    text-align: center;
    padding: 2rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.footer-socials {
    display: flex;
    align-items: center;
    gap: 1rem;
    border-left: 1px solid var(--border);
    padding-left: 1rem;
    transition: border-color 0.3s ease;
}

.footer-socials a {
    transition: transform 0.2s ease, filter 0.3s ease;
    display: flex;
}

.footer-socials a:hover {
    transform: translateY(-2px);
    filter: drop-shadow(0 0 5px var(--accent-cloud));
}

.footer-socials img {
    width: 20px;
    height: 20px;
    transition: filter 0.3s ease;
}

[data-theme="light"] .footer-socials img {
    filter: brightness(0.5); /* Adjusts simpleicon color to match the light theme text */
}

/* --- Back to Top Button --- */
#back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--accent-cloud);
    color: #000;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.2s ease;
    z-index: 1000;
}

#back-to-top:hover {
    transform: translateY(-5px);
}

#back-to-top.show {
    opacity: 1;
    visibility: visible;
}

/* --- Responsive / Mobile Design --- */
@media (max-width: 1024px) {
    header {
        display: flex;
        flex-direction: column;
        padding: 1rem 5% 0.5rem 5%;
        gap: 1rem;
    }
    header.scrolled {
        padding: 0.5rem 5%;
    }
    nav {
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
    }
    /* Custom scrollbar for mobile nav */
    nav::-webkit-scrollbar { height: 4px; }
    nav::-webkit-scrollbar-track { background: var(--bg-input); border-radius: 4px; }
    nav::-webkit-scrollbar-thumb { background: var(--accent-cloud); border-radius: 4px; }
    nav:empty { display: none; }
    
    nav ul { justify-content: flex-start; }
    nav ul li { margin-left: 1.5rem; }
    nav ul li:first-child { margin-left: 0; }
    
    /* Disable hover tooltips on touch screens */
    nav ul li a::after, .header-right a::after, .header-right .theme-toggle::after, .color-picker-wrapper::after {
        display: none !important;
    }

    .header-right {
        justify-content: center;
        width: 100%;
    }
    
    .hero { margin-top: 110px; } /* Account for taller stacked header */
}

@media (max-width: 768px) {
    .hero {
        height: auto;
        min-height: 35vh;
        padding: 4rem 1rem;
        margin-top: 110px;
    }
    .hero h1 { font-size: 2.2rem; }
    .hero p { font-size: 1rem; margin-bottom: 1.5rem; }
    
    /* Stack hero buttons */
    .hero > div[style*="display: flex"] {
        flex-direction: column;
        width: 100%;
        max-width: 350px;
        margin: 0 auto;
    }
    .hero .btn-main, .hero .btn-action {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }
    
    .container { padding: 1.5rem 1rem 4rem 1rem; }
    section { padding: 1.5rem 0; }
    h2 { font-size: 1.6rem; }
    
    .map-grid, .shop-grid { gap: 1rem; }
    .map-card, .product-card { padding: 1.5rem 1.25rem; }
    
    /* Keep map connection elements on one line */
    .status-ip-box {
        flex-direction: row;
        gap: 0.5rem;
        align-items: center;
        text-align: left;
        padding: 0.6rem 0.75rem;
    }
    .status-ip { font-size: 0.75rem; }
    .status-ip-box .btn-action { width: auto; padding: 0.4rem 0.6rem; }
    
    /* Shop layout fixes */
    .cart-panel { position: static; margin-top: 2rem; }
    
    /* Guide articles fix */
    .article-content { padding: 2rem 1.5rem !important; }
    
    /* Fix inline flex containers (like the search/dropdown in guides.html) */
    .container > div[style*="display: flex"] {
        flex-direction: column;
        align-items: stretch !important;
    }
    .container > div[style*="display: flex"] > div {
        flex: 1 1 100%;
        width: 100%;
    }
    
    .footer-socials {
        border-left: none;
        padding-left: 0;
        width: 100%;
        justify-content: center;
        margin-top: 0.25rem;
    }
}

@media (max-width: 480px) {
    .hero h1 { font-size: 1.8rem; }
    
    /* Force single column for small phones */
    .shop-grid, .map-grid { grid-template-columns: 1fr !important; }
    
    /* Stack shop price & button */
    .price-row { flex-direction: column; gap: 0.75rem; align-items: stretch; }
    .price-row .btn-action, .price-row .btn-add { width: 100%; text-align: center; box-sizing: border-box; }
    
    /* Improve table readability */
    th, td { font-size: 0.85rem; padding: 0.5rem !important; }
    
    /* Stack update titles and tags in updates.html */
    .product-card > div[style*="justify-content: space-between"] {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.5rem;
    }
}