/* ==========================================================================
   Cosmic Drift — Full-Screen Reactive Consultancy Theme
   ==========================================================================
   WebGL background fills viewport. Glass content panel at 95vw.
   Panel tilts with mouse. Everything is clean but alive with Three.js.
   ========================================================================== */

@import url(font-awesome.min.css);
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap");

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
    background: #050510; color: rgba(255,255,255,0.85);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 400; line-height: 1.6;
    overflow: hidden; height: 100vh; width: 100vw;
}
a { color: #a78bfa; text-decoration: none; transition: color 0.2s; }
a:hover { color: #7ec8e3; }

/* ===== THREE.JS BACKGROUND ===== */
#three-container {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 0; pointer-events: none;
}

/* ===== HEADER ===== */
#site-header {
    position: fixed; z-index: 2; top: 0; left: 0; right: 0;
    height: 48px; display: flex; align-items: center;
    padding: 0 24px;
    background: linear-gradient(180deg, rgba(5,5,16,0.6) 0%, transparent 100%);
    pointer-events: none;
}
#site-header .logo { font-size: 0.85rem; font-weight: 700; letter-spacing: 0.04em; color: rgba(255,255,255,0.9); pointer-events: auto; }
#site-header .logo a { color: inherit; }
#site-header .nav-links { display: flex; gap: 1px; margin-left: auto; align-items: center; pointer-events: auto; }
#site-header .nav-links a {
    font-size: 0.65rem; font-weight: 500; letter-spacing: 0.03em;
    color: rgba(255,255,255,0.35); padding: 5px 10px;
    border-radius: 4px; transition: all 0.2s; text-decoration: none;
}
#site-header .nav-links a:hover { color: rgba(255,255,255,0.85); background: rgba(167,139,250,0.08); }
#site-header .nav-links a.active { color: #a78bfa; }

/* ===== CONTENT OVERLAY — full width, reactive tilt ===== */
#content-overlay {
    position: fixed; z-index: 1;
    top: 58px; bottom: 26px;
    left: 50%; transform: translateX(-50%) perspective(1000px) rotateX(0deg) rotateY(0deg);
    width: 94vw; max-width: 1200px;
    background: rgba(5,5,16,0.25);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(167,139,250,0.05);
    border-radius: 8px;
    overflow: hidden;
    opacity: 0; transition: opacity 0.15s ease, transform 0.15s ease-out;
    will-change: transform;
}
#content-overlay.visible { opacity: 1; }

/* ===== MAIN CONTENT ===== */
#main {
    height: 100%; width: 100%; overflow-y: auto; overflow-x: hidden;
    padding: 24px 28px;
    scrollbar-width: thin; scrollbar-color: rgba(167,139,250,0.12) transparent;
}
#main::-webkit-scrollbar { width: 3px; }
#main::-webkit-scrollbar-thumb { background: rgba(167,139,250,0.18); border-radius: 2px; }
#main .content { padding: 0; }

/* ===== TYPOGRAPHY ===== */
#main h1 { font-size: 1.3rem; font-weight: 700; color: rgba(255,255,255,0.95); margin-bottom: 0.5rem; letter-spacing: -0.01em; }
#main h2 { font-size: 1rem; font-weight: 600; color: rgba(255,255,255,0.9); margin: 1rem 0 0.4rem; }
#main h3 { font-size: 0.88rem; font-weight: 600; color: rgba(167,139,250,0.85); margin: 0.8rem 0 0.3rem; }
#main p { margin-bottom: 0.55rem; font-size: 0.82rem; line-height: 1.6; color: rgba(255,255,255,0.7); }
#main strong { color: rgba(255,255,255,0.9); font-weight: 600; }
#main em { color: rgba(126,200,227,0.8); }
#main hr { border: none; border-top: 1px solid rgba(167,139,250,0.05); margin: 1rem 0; }
#main a { color: #a78bfa; text-decoration: underline; text-decoration-color: rgba(167,139,250,0.2); text-underline-offset: 2px; }
#main ul, #main ol { margin: 0.25rem 0 0.5rem 1.2rem; font-size: 0.82rem; color: rgba(255,255,255,0.7); }
#main li { margin-bottom: 0.1rem; }
#main table { width: 100%; border-collapse: collapse; margin: 0.6rem 0; font-size: 0.78rem; }
#main table.page-table { table-layout: fixed; }
#main table.page-table th:first-child,
#main table.page-table td:first-child { width: 30%; }
#main table.page-table th:last-child,
#main table.page-table td:last-child { width: 70%; }
#main table th,
#main table td { padding: 0.4rem 0.6rem; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.08); vertical-align: top; }
#main table th { color: rgba(255,255,255,0.5); font-weight: 500; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; }
#main table td { color: rgba(255,255,255,0.7); }
#main th { text-align: left; padding: 5px 8px; background: rgba(167,139,250,0.05); color: rgba(255,255,255,0.8); font-weight: 600; border-bottom: 1px solid rgba(167,139,250,0.08); }
#main td { padding: 4px 8px; border-bottom: 1px solid rgba(167,139,250,0.04); color: rgba(255,255,255,0.65); }
#main code { font-family: 'JetBrains Mono', monospace; font-size: 0.82em; background: rgba(167,139,250,0.05); padding: 1px 4px; border-radius: 3px; color: rgba(255,255,255,0.8); }
#main pre { background: rgba(0,0,0,0.2); border: 1px solid rgba(167,139,250,0.05); border-radius: 6px; padding: 10px 14px; overflow-x: auto; margin: 0.5rem 0; }
#main blockquote { border-left: 2px solid rgba(167,139,250,0.12); padding-left: 12px; margin: 0.5rem 0; color: rgba(255,255,255,0.4); font-style: italic; }

/* ===== CARDS ===== */
.card { background: rgba(167,139,250,0.02); border: 1px solid rgba(167,139,250,0.05); border-radius: 6px; padding: 14px 18px; margin: 0.6rem 0; transition: all 0.2s; }
.card:hover { border-color: rgba(167,139,250,0.12); background: rgba(167,139,250,0.04); }

/* ===== BREADCRUMBS ===== */
.breadcrumbs { font-size: 0.7rem; color: rgba(255,255,255,0.22); margin-bottom: 0.6rem; }
.breadcrumbs a { color: rgba(167,139,250,0.45); text-decoration: none; }

/* ===== FOOTER ===== */
#site-footer {
    position: fixed; z-index: 2; bottom: 0; left: 0; right: 0;
    height: 32px; display: flex; align-items: center; justify-content: flex-end;
    padding: 0 24px;
    background: linear-gradient(0deg, rgba(5,5,16,0.45) 0%, transparent 100%);
    pointer-events: none;
}
#site-footer .copyright { font-size: 0.7rem; color: rgba(255,255,255,0.6); letter-spacing: 0.02em; pointer-events: auto; }

/* ===== CONTACT FORM ===== */
.fields { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 16px; }
.field { width: 100%; }
.field.half { width: calc(50% - 7px); }
.field label { display: block; font-size: 0.75rem; color: rgba(255,255,255,0.5); margin-bottom: 4px; letter-spacing: 0.04em; text-transform: uppercase; }
.field input, .field textarea {
    width: 100%; padding: 10px 12px; font-size: 0.85rem; font-family: inherit;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: 4px;
    color: rgba(255,255,255,0.8); outline: none; transition: border-color 0.2s; box-sizing: border-box;
}
.field input:focus, .field textarea:focus { border-color: rgba(167,139,250,0.4); }
.field textarea { resize: vertical; min-height: 100px; }
/* Base form element styling for all admin pages */
#main label { display: block; font-size: 0.78rem; color: rgba(255,255,255,0.5); margin-bottom: 4px; }
#main td input[type="text"], #main td input[type="password"], #main td select {
    width: auto; min-width: 120px; margin: 0; box-sizing: border-box;
}
#main td:has(input[type="text"]), #main td:has(select), #main td:has(input[type="password"]) {
    padding: 4px 6px;
}
#main td .inline-form { margin-left: 6px; white-space: nowrap; }
#main input[type="text"], #main input[type="password"], #main select, #main textarea:not(.EasyMDEContainer textarea) {
    width: 100%; max-width: 600px; padding: 8px 10px; font-size: 0.82rem; font-family: inherit;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: 4px;
    color: rgba(255,255,255,0.8); outline: none; transition: border-color 0.2s; box-sizing: border-box;
}
#main input[type="text"]:focus, #main input[type="password"]:focus, #main select:focus { border-color: rgba(167,139,250,0.4); }
#main select { cursor: pointer; }
#main input[type="checkbox"] { margin-right: 6px; accent-color: rgba(167,139,250,0.6); }
#main button[type="submit"], #main input[type="submit"] {
    padding: 8px 20px; font-size: 0.8rem; font-family: inherit;
    background: linear-gradient(135deg, rgba(167,139,250,0.2), rgba(126,200,227,0.2));
    border: 1px solid rgba(167,139,250,0.3); border-radius: 4px;
    color: rgba(255,255,255,0.8); cursor: pointer; transition: all 0.2s;
    text-transform: uppercase; letter-spacing: 0.06em;
}
#main button[type="submit"]:hover, #main input[type="submit"]:hover {
    background: linear-gradient(135deg, rgba(167,139,250,0.35), rgba(126,200,227,0.35));
    border-color: rgba(167,139,250,0.5);
}
ul.actions { list-style: none; padding: 0; margin: 0; }
ul.actions li { display: inline-block; }
input[type="submit"].primary {
    padding: 10px 28px; font-size: 0.8rem; font-family: inherit;
    background: linear-gradient(135deg, rgba(167,139,250,0.2), rgba(126,200,227,0.2));
    border: 1px solid rgba(167,139,250,0.3); border-radius: 4px;
    color: rgba(255,255,255,0.8); cursor: pointer; transition: all 0.2s;
    text-transform: uppercase; letter-spacing: 0.06em;
}
input[type="submit"].primary:hover { background: linear-gradient(135deg, rgba(167,139,250,0.35), rgba(126,200,227,0.35)); border-color: rgba(167,139,250,0.5); }
.flash-message { padding: 10px 14px; border-radius: 4px; font-size: 0.8rem; margin-bottom: 12px; }
.flash-error { background: rgba(244,114,182,0.12); border: 1px solid rgba(244,114,182,0.25); color: rgba(244,114,182,0.8); }
.flash-success { background: rgba(52,211,153,0.12); border: 1px solid rgba(52,211,153,0.25); color: rgba(52,211,153,0.8); }

/* ===== ADMIN ===== */
#cosmic-admin-nav { display: flex; align-items: center; gap: 8px; background: rgba(20,20,40,0.5); border: 1px solid rgba(167,139,250,0.1); border-radius: 4px; padding: 6px 12px; margin: 8px 0; }
#cosmic-admin-nav .admin-badge { font-size: 0.7rem; color: rgba(167,139,250,0.7); letter-spacing: 0.04em; text-transform: uppercase; }
#cosmic-admin-nav .cosmic-nav-list { display: flex; list-style: none; padding: 0; margin: 0; gap: 4px; }
#cosmic-admin-nav .cosmic-nav-link { font-size: 0.75rem; color: rgba(255,255,255,0.6); padding: 4px 8px; border-radius: 3px; text-decoration: none; transition: color 0.2s; display: inline !important; }
#cosmic-admin-nav .cosmic-nav-link:hover { color: rgba(167,139,250,0.8); }
#cosmic-admin-nav .cosmic-nav-link.active { color: rgba(167,139,250,0.9); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 0.6rem 0; }
.stat-card { background: rgba(167,139,250,0.03); border: 1px solid rgba(167,139,250,0.06); border-radius: 6px; padding: 14px 16px; }
.stat-card h3 { font-size: 0.75rem; color: rgba(255,255,255,0.4); margin: 0 0 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 1.4rem; color: rgba(255,255,255,0.85); margin: 0; font-weight: 600; }
.stat-sub { font-size: 0.7rem; color: rgba(255,255,255,0.3); margin: 4px 0 0; }
.page-table { width: 100%; border-collapse: collapse; margin: 0.6rem 0; font-size: 0.82rem; }
.page-table th, .page-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.06); }
.page-table th { color: rgba(255,255,255,0.4); font-weight: 500; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; }
.page-table td { color: rgba(255,255,255,0.65); }
.page-table td form { display: inline; }
.inline-form { display: inline; }
.button.small { padding: 4px 12px; font-size: 0.75rem; font-family: inherit; background: rgba(244,114,182,0.1); border: 1px solid rgba(244,114,182,0.2); border-radius: 3px; color: rgba(244,114,182,0.7); cursor: pointer; transition: all 0.2s; }
.button.small:hover { background: rgba(244,114,182,0.2); border-color: rgba(244,114,182,0.35); }
.button.small[value="Update"] { background: rgba(52,211,153,0.1); border-color: rgba(52,211,153,0.2); color: rgba(52,211,153,0.7); }
.button.small[value="Update"]:hover { background: rgba(52,211,153,0.2); border-color: rgba(52,211,153,0.35); }

/* ===== RESPONSIVE ===== */
@media (max-width: 820px) {
    #content-overlay { width: 97vw; }
    #main { padding: 18px 16px; }
}
@media (max-width: 480px) {
    #content-overlay { top: 50px; bottom: 22px; }
    #main { padding: 14px 12px; }
    #site-header { height: 40px; padding: 0 12px; }
    #site-header .nav-links a { font-size: 0.6rem; padding: 4px 6px; }
}

/* ===== LEGACY ===== */
#wrapper, #scroll-hint, #header, #footer { display: none !important; }
/* Show legacy nav links on admin pages where JS module is not loaded */
#cosmic-nav .cosmic-nav-link, #cosmic-admin-nav .cosmic-nav-link { display: inline !important; }
body.is-preload { opacity: 0; }
body:not(.is-preload) { opacity: 1; transition: opacity 0.5s ease; }
