/*
LBM (Leaflet Blog Manager) // CSS
Version: 0.25 (Cross Custom)
License: MIT
applchu wuz here
*/

/* --- SECTION: VARIABLES --- */
:root {
    /* CORE COLORS */
    --background-color: #050505;
    --text-color: #e0e0e0;
    --header-footer-color: #18132b;
    
    /* ACCENTS */
    --accent-color: #a590ff;
    --accent-hover-color: #fff;
    
    /* UI ELEMENTS */
    --border-color: #333;
    --sidebar-bg: #18132b;
    --leaflet-bg: #0a0a0a;
    --nav-active-color: #fff;
    
    /* INTERACTIONS */
    --like-color: #76c7c0;
    --dislike-color: #ff7675;
    --like-btn-color: #18132b;
    --dislike-btn-color: #18132b;
    
    --widget-padding: 15px;

    /* SCENE: CROSS PATTERN */
    --bg-image: 
        linear-gradient(45deg, transparent 48%, #1a1a1a 48%, #1a1a1a 52%, transparent 52%),
        linear-gradient(-45deg, transparent 48%, #1a1a1a 48%, #1a1a1a 52%, transparent 52%);
    --bg-size: 30px 30px;
    --bg-repeat: repeat;
}

/* --- SECTION: GLOBAL RESET & BRUTALIST ENFORCEMENT --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border-radius: 0 !important; /* THE BRUTALIST RULE: NO CURVES */
}

body {
    background-color: var(--background-color);
    background-image: var(--bg-image);
    background-size: var(--bg-size);
    color: var(--text-color);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Prevent scrolling when modals are open */
body.modal-open {
    overflow: hidden;
}

a { 
    color: var(--accent-color); 
    text-decoration: none; 
    border-bottom: 1px solid transparent;
    transition: 0.2s;
}
a:hover { 
    color: #fff; 
    border-bottom: 1px solid var(--accent-color);
    background: rgba(165, 144, 255, 0.1);
}

/* --- SECTION: LAYOUT --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    border-left: 1px solid #222;
    border-right: 1px solid #222;
    min-height: 100vh;
    background: rgba(5, 5, 5, 0.95);
}

/* --- SUBSECTION: HEADER --- */
header {
    background-color: var(--header-footer-color);
    border-bottom: 2px solid var(--accent-color);
    padding: 0;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

/* Decorative "Tech" line */
header::before {
    content: "SYSTEM_ONLINE // V.0.3";
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 10px;
    opacity: 0.5;
    letter-spacing: 2px;
    color: var(--accent-color);
}

/* Decorative Xs in Header corner */
header::after {
    content: "XX";
    position: absolute;
    bottom: -5px;
    right: 5px;
    font-size: 40px;
    font-weight: 900;
    color: rgba(0,0,0,0.2);
    line-height: 1;
    pointer-events: none;
}

.header-overlay {
    background: linear-gradient(to right, rgba(0,0,0,0.8), transparent);
    padding: 30px;
    width: 100%;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.header-identity {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* The PFP is removed in HTML, but just in case */
.site-pfp { display: none !important; }

header h1 {
    font-size: 32px;
    text-transform: uppercase;
    letter-spacing: -1px;
    color: #fff;
    background: var(--header-footer-color);
    padding: 0 10px 0 0;
    display: inline-block;
    border-left: 5px solid var(--accent-color);
    padding-left: 15px;
    line-height: 1;
}

.site-tagline {
    color: var(--accent-color);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 5px;
    padding-left: 20px;
}

#db-status {
    font-family: monospace;
    font-size: 10px;
    border: 1px solid #444;
    padding: 5px 10px;
    background: #000;
    text-transform: uppercase;
}
#db-status.online {
    color: #0f0;
    border-color: #0f0;
    box-shadow: 0 0 5px rgba(0, 255, 0, 0.2);
}

/* --- SECTION: SIDEBAR & NAV --- */
.layout-wrapper {
    display: flex;
    gap: 0;
}

.sidebar {
    width: 220px;
    background: var(--sidebar-bg);
    border-right: 1px solid #333;
    padding: 20px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    position: relative;
    overflow: hidden; /* Prevent large bg image from spilling */
}

.background-image-sidebar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('https://applchu.link/img/crosslogo.png');
    background-position: -10px -50px;
    background-size: 300px;
    background-repeat: no-repeat;
    opacity: 0.1;
    pointer-events: none;
    z-index: 0;
}

.nav-btn {
    display: block;
    width: 100%;
    padding: 12px 15px;
    background: transparent;
    border: 1px solid transparent;
    color: #aaa;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
    transition: 0.2s;
    position: relative;
    z-index: 2;
}

.nav-btn:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
    border-left: 2px solid var(--accent-color);
    padding-left: 13px;
}

.nav-btn.active {
    background: #fff;
    color: var(--header-footer-color);
    border: 1px solid #fff;
    font-weight: bold;
}
.nav-btn.active::after {
    content: "<";
    float: right;
}

main {
    flex: 1;
    padding: 20px;
    background: rgba(0,0,0,0.2);
    min-width: 0;
}

/* --- SECTION: CONTENT VIEWS --- */
.view-section {
    display: none;
    animation: fadeIn 0.3s ease;
}
.view-section.active {
    display: block;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

h2 {
    border-bottom: 2px solid var(--header-footer-color);
    margin-bottom: 20px;
    font-size: 14px;
    text-transform: uppercase;
    color: #fff;
    background: #000;
    display: inline-block;
    padding: 5px 15px;
    letter-spacing: 1px;
}

/* --- SECTION: LEAFLETS (GRID SYSTEM) --- */
#leaflets-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.leaflet-item {
    display: flex;
    flex-direction: column;
    gap: 0; 
    background-color: var(--leaflet-bg);
    border: 1px solid #333;
    margin-bottom: 0;
    transition: all 0.2s;
    position: relative;
    height: 100%;
    cursor: pointer;
}

/* Corner Markers */
.leaflet-item::before { content: "+"; position: absolute; top: 5px; right: 5px; color: #333; font-family: monospace; font-weight: bold; }
.leaflet-item::after { content: "+"; position: absolute; bottom: 5px; right: 5px; color: #333; font-family: monospace; font-weight: bold; }

.leaflet-item:hover {
    border-color: var(--accent-color);
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    z-index: 5;
}
.leaflet-item:hover::before, .leaflet-item:hover::after { color: var(--accent-color); }

.leaflet-avatar {
    width: 100%;
    height: 40px;
    background: #111;
    border-right: none;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 10px;
    font-size: 20px;
    flex-shrink: 0;
    color: #333;
}
.leaflet-avatar img { width: 30px; height: 30px; object-fit: cover; filter: grayscale(100%); transition: 0.3s; margin-right:10px; }
.leaflet-item:hover .leaflet-avatar img { filter: grayscale(0%); }

.leaflet-body {
    flex: 1;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

.leaflet-header {
    margin-bottom: 10px;
    font-size: 11px;
    color: var(--accent-color);
    border-bottom: 1px dashed #333;
    padding-bottom: 5px;
    display: flex;
    justify-content: space-between;
}

.leaflet-author {
    color: #fff;
    font-weight: bold;
    text-transform: uppercase;
    background: var(--header-footer-color);
    padding: 2px 5px;
    margin-right: 10px;
}

.leaflet-content {
    font-size: 13px;
    color: #ccc;
    flex-grow: 1;
    margin-bottom: 10px;
}

.leaflet-media-container {
    margin-top: 15px;
    background: #000;
    border: 1px solid #333;
    padding: 5px;
}
.leaflet-media-container img, .leaflet-media-container video {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
    opacity: 0.9;
}

/* --- SECTION: REACTIONS --- */
.reaction-widget {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 0;
    background: #000;
    border: 1px solid #333;
    width: 100%;
}

.reaction-btn {
    background: #000;
    border: none;
    color: #fff;
    padding: 8px 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 10px;
    text-transform: uppercase;
    white-space: nowrap;
}
.reaction-btn:hover { background: #222; }

.reaction-btn.like-btn { color: var(--like-color); border-right: 1px solid #333; }
.reaction-btn.dislike-btn { color: var(--dislike-color); border-left: 1px solid #333; }

.reaction-bar {
    flex: 1;
    height: 30px;
    background: #111;
    position: relative;
    background-image: linear-gradient(45deg, #181818 25%, transparent 25%, transparent 75%, #181818 75%, #181818), 
                      linear-gradient(45deg, #181818 25%, transparent 25%, transparent 75%, #181818 75%, #181818);
    background-size: 4px 4px;
    background-position: 0 0, 2px 2px;
}
.reaction-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--like-color), transparent);
    opacity: 0.3;
}

/* --- SECTION: GALLERY --- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 2px;
}
.gallery-item {
    border: 1px solid #222;
    background: #000;
    position: relative;
    cursor: crosshair;
}
.gallery-item img, .gallery-item video {
    width: 100%;
    height: 180px;
    object-fit: cover;
    filter: grayscale(80%) contrast(120%);
    transition: 0.2s;
}
.gallery-item:hover img, .gallery-item:hover video {
    filter: grayscale(0%) contrast(100%);
}
.gallery-item:hover {
    border-color: #fff;
    z-index: 10;
    transform: scale(1.05);
    box-shadow: 0 0 0 2px #000;
}

/* --- SECTION: FUNCTIONAL OVERLAYS (Admin, Lightbox, etc.) --- */

/* LIGHTBOX */
.lightbox {
    position: fixed;
    z-index: 1000;
    left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(5, 5, 5, 0.95);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center; justify-content: center;
    padding: 20px;
    opacity: 0; visibility: hidden;
    transition: 0.3s;
}
.lightbox.open { opacity: 1; visibility: visible; }

.lightbox-content {
    background-color: #000;
    border: 1px solid var(--accent-color);
    width: 90%; max-width: 800px; max-height: 90vh;
    overflow-y: auto; padding: 20px;
    box-shadow: 0 0 50px rgba(165, 144, 255, 0.1);
}
.close-btn { position: absolute; top: 10px; right: 15px; font-size: 28px; cursor: pointer; color: #fff; }

/* MEDIA FULLSCREEN */
.media-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000; display: none;
    align-items: center; justify-content: center;
}
.media-overlay.active { display: flex; }
.media-overlay img, .media-overlay video {
    max-width: 95vw; max-height: 95vh; object-fit: contain;
    border: 1px solid #333;
}
.close-media-btn { position: absolute; top: 20px; right: 20px; color: #fff; font-size: 40px; cursor: pointer; z-index: 2001; }

/* COMMENTS */
.comments-section { margin-top: 20px; padding-top: 15px; border-top: 1px dotted var(--border-color); }
.comments-list, .reply-list { list-style: none; }
.reply-list { margin-left: 20px; padding-left: 10px; border-left: 2px solid var(--border-color); margin-top: 10px; }
.comment-item {
    background-color: #111;
    padding: 10px; margin-bottom: 10px;
    border: 1px solid #333;
}
.comment-header { font-size: 11px; color: var(--accent-color); margin-bottom: 5px; display: flex; justify-content: space-between; }
.reply-btn { background: none; border: none; color: #fff; font-size: 10px; cursor: pointer; text-decoration: underline; }

/* ADMIN PANEL */
.admin-panel {
    background-color: #000;
    border: 1px solid var(--accent-color);
    padding: 15px;
}

/* BUTTONS & INPUTS GLOBAL */
button.action-btn {
    background: var(--accent-color);
    color: #000;
    border: none;
    padding: 10px 20px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    width: 100%;
    transition: 0.2s;
}
button.action-btn:hover { background: #fff; box-shadow: 0 0 10px #fff; }

input, textarea, select {
    background: #000;
    border: 1px solid #333;
    color: #fff;
    padding: 10px;
    font-family: inherit;
    width: 100%;
}
input:focus, textarea:focus { border-color: var(--accent-color); outline: none; }

/* CONFIG UI */
.config-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 15px; }
.config-item { display: flex; flex-direction: column; }
.config-item label { font-size: 10px; color: #888; text-transform: uppercase; margin-bottom: 3px; }
.color-picker { width: 100%; height: 30px; border: 1px solid #555; background: #000; cursor: pointer; padding: 2px; }
.setup-input { width: 100%; background: #111; color: var(--accent-color); border: 1px solid #444; padding: 8px; font-family: monospace; }

/* FOOTER */
footer {
    text-align: center;
    padding: 30px;
    background: var(--header-footer-color);
    color: #666;
    font-size: 10px;
    text-transform: uppercase;
    border-top: 1px solid #333;
    margin-top: 0;
}

/* RESPONSIVE */
@media (max-width: 900px) {
    .layout-wrapper { flex-direction: column; }
    .sidebar { width: 100%; border-right: none; border-bottom: 1px solid #333; }
    .container { border: none; }
    
    /* RESET GRID FOR MOBILE */
    #leaflets-container { grid-template-columns: 1fr; }
    .leaflet-item { flex-direction: row; }
    .leaflet-avatar { width: 80px; height: auto; border-right: 1px solid #333; border-bottom: none; justify-content: center; padding-left: 0; }
    .leaflet-media-container img, .leaflet-media-container video { height: auto; }
}