:root {
    --bg-primary: #0a0a0a;       
    --bg-secondary: #121212;     
    --bg-darker: #050505;        
    --text-primary: #f0f0f0;     
    --text-secondary: #a0a0a0;   
    --gold-primary: #D4AF37;     
    --gold-dim: rgba(212, 175, 55, 0.4);
    --border-color: rgba(255, 255, 255, 0.1);
    --font-serif: 'Playfair Display', serif;
    --font-sans: 'Montserrat', sans-serif;
    --container-width: 1200px;
    --transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

/* Global Scrollbar Theming */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-darker); 
}
::-webkit-scrollbar-thumb {
    background: #333; 
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--gold-primary); 
}
* {
    scrollbar-width: thin;
    scrollbar-color: #333 var(--bg-darker);
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

html { scroll-behavior: smooth; }
body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden; 
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1, h2, h3, h4 { 
    font-family: var(--font-serif); 
    font-weight: 700; 
    color: #fff; 
    line-height: 1.2; 
}
p { 
    margin-bottom: 1.5rem; 
    color: var(--text-secondary); 
    max-width: 75ch; 
}
a { 
    text-decoration: none; 
    color: inherit; 
    transition: var(--transition); 
}
.container { 
    width: 92%; 
    max-width: var(--container-width); 
    margin: 0 auto; 
    padding: 0 15px; 
}
.text-center { text-align: center; }
.gold-text { color: var(--gold-primary) !important; }
.serif { font-family: var(--font-serif); }
.kicker {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--gold-primary);
    font-weight: 700;
    display: block;
    margin-bottom: 15px;
}
.divider { 
    height: 1px; 
    width: 100%; 
    background-color: var(--border-color); 
    margin: 30px 0; 
}

.btn {
    display: inline-block;
    padding: 12px 28px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    border: 1px solid var(--gold-primary);
    transition: var(--transition);
}
.btn-solid { background: var(--gold-primary); color: #000; }
.btn-solid:hover { background: #fff; border-color: #fff; transform: translateY(-2px); }
.btn-outline { background: transparent; color: var(--gold-primary); }
.btn-outline:hover { background: var(--gold-primary); color: #000; }
.btn-subtle {
    font-size: 0.7rem;
    padding: 8px 16px;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #ccc;
    font-weight: 600;
    text-transform: uppercase;
}
.btn-subtle:hover { border-color: var(--gold-primary); color: var(--gold-primary); }

header { 
    background: var(--bg-primary); 
    border-bottom: 1px solid var(--border-color); 
    width: 100%; 
    z-index: 99999; 
    position: relative; 
}
.header-top-row { padding: 20px 0; border-bottom: 1px solid #111; }
.top-flex { display: flex; justify-content: space-between; align-items: center; }
.logo-img { height: 50px; width: auto; display: block; }
.logo-text { 
    font-family: var(--font-sans); 
    font-weight: 700; 
    color: #fff; 
    font-size: 1.3rem; 
    letter-spacing: 1px; 
    margin-left: 15px; 
}
.brand-area { display: flex; align-items: center; }
.header-nav-row { background: #080808; padding: 0; }
.nav-links { display: flex; list-style: none; gap: 40px; justify-content: center; }
.nav-links > li { position: relative; }
.nav-links > li > a { 
    display: block;
    padding: 18px 0;
    font-size: 0.75rem; 
    text-transform: uppercase; 
    letter-spacing: 2px; 
    color: var(--text-secondary); 
    font-weight: 600;
    transition: color 0.3s ease;
}
.nav-links > li:hover > a { color: var(--gold-primary); }

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #111;
    min-width: 220px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.8);
    border: 1px solid #333;
    border-top: 2px solid var(--gold-primary);
    z-index: 99999;
    padding: 10px 0;
}
.dropdown-content a {
    display: block;
    padding: 12px 25px;
    color: var(--text-secondary);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}
.dropdown-content a:hover {
    background: #1a1a1a;
    color: var(--gold-primary);
    padding-left: 30px;
}
.nav-links .dropdown:hover .dropdown-content { display: block; }

/* Portal Admin / Dev Sub-Nav */
.portal-subnav {
    background: #000;
    border-bottom: 1px solid #222;
    padding: 0;
}
.portal-subnav-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    justify-content: center;
}
.portal-subnav-list > li > a {
    display: block;
    padding: 12px 20px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #666;
    font-weight: 700;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}
.portal-subnav-list > li > a:hover {
    background: rgba(255,255,255,0.02);
}
.portal-subnav-list > li > a.dev-link.active,
.portal-subnav-list > li > a.dev-link:hover {
    color: #ff4444;
    border-bottom-color: #ff4444;
}
.portal-subnav-list > li > a.admin-link.active,
.portal-subnav-list > li > a.admin-link:hover {
    color: var(--gold-primary);
    border-bottom-color: var(--gold-primary);
}

/* Portal Layout */
.portal-wrapper { 
    display: flex; 
    align-items: flex-start; 
    min-height: 80vh; 
    padding-top: 40px; 
}
.portal-main-content {
    flex: 1;
    min-width: 0;
    padding-bottom: 60px;
    background: transparent;
}
.portal-main-content .container {
    width: 100%;
    max-width: none;
    padding: 0 40px;
}
.portal-sidebar {
    width: 280px;
    background: transparent; 
    border-right: 1px solid var(--border-color);
    padding: 0 30px 40px 0;
    position: sticky;
    top: 40px;
    height: calc(100vh - 40px);
    overflow-y: auto;
    flex-shrink: 0;
}
.sidebar-section { margin-bottom: 40px; }
.sidebar-title { 
    font-size: 0.65rem; 
    color: #666; 
    text-transform: uppercase; 
    letter-spacing: 2px; 
    margin-bottom: 15px; 
    font-weight: 700; 
    border-bottom: 1px solid #1a1a1a;
    padding-bottom: 8px;
}
.sidebar-nav { list-style: none; }
.sidebar-nav li { margin-bottom: 8px; }
.sidebar-nav a { 
    display: flex; 
    align-items: center; 
    font-size: 0.8rem; 
    color: #aaa; 
    padding: 10px 12px; 
    border-radius: 4px; 
    transition: var(--transition); 
    font-weight: 600;
}
.sidebar-nav a:hover, .sidebar-nav a.active { 
    background: #111; 
    color: var(--gold-primary); 
}

/* Grids & Cards */
.section-padding { padding: 100px 0; }
.grid-wrapper { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; }
.grid-card { 
    background: var(--bg-secondary); 
    border: 1px solid var(--border-color); 
    padding: 40px 30px; 
    transition: var(--transition); 
}
.grid-card:hover { border-color: var(--gold-dim); transform: translateY(-5px); }
.highlight-card { border-top: 3px solid var(--gold-primary); }

/* Dashboard Heroes */
.dash-hero { 
    padding: 80px 0 40px; 
    background: radial-gradient(circle at 50% 0%, #151515 0%, #0a0a0a 100%); 
    border-bottom: 1px solid #1a1a1a; 
}
.role-badge { 
    color: var(--gold-primary); 
    font-size: 0.7rem; 
    font-weight: 700; 
    letter-spacing: 3px; 
    display: block; 
    margin-bottom: 10px; 
}
.dash-greeting { font-size: 2.5rem; margin-bottom: 10px; }

/* Auth Containers */
.auth-wrapper { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    min-height: 75vh; 
    padding: 60px 20px;
    background: radial-gradient(circle at center, #1a1a1a 0%, #050505 100%);
}
.auth-container { 
    width: 100%; 
    max-width: 420px; 
    margin: 0 auto;
}
.auth-container.wide { max-width: 500px; }
.auth-container.error-wide { max-width: 600px; }
.auth-card {
    background: #121212; 
    border: 1px solid rgba(255, 255, 255, 0.05); 
    padding: 50px 40px;
    text-align: center; 
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); 
    position: relative;
}
.auth-card::before { 
    content: ''; 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 3px; 
    background: var(--gold-primary); 
}
.auth-card.critical::before { background: #ff4444; }
.auth-logo { 
    width: 80px; 
    margin: 0 auto 25px; 
    display: block;
}
.auth-header { margin-bottom: 40px; }
.auth-header h1 { 
    font-size: 1.8rem; 
    margin-bottom: 10px; 
    color: #fff; 
    font-family: var(--font-serif); 
}
.auth-header p { 
    font-size: 0.75rem; 
    color: #666; 
    text-transform: uppercase; 
    letter-spacing: 2px; 
}
.auth-error-code {
    font-size: 4rem;
    color: var(--gold-primary);
    font-family: var(--font-serif);
    line-height: 1;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.2);
}
.auth-error-code.critical {
    color: #ff4444;
    text-shadow: 0 0 20px rgba(255, 68, 68, 0.2);
}

/* Form Styles */
.auth-alert-error { 
    background: rgba(255, 68, 68, 0.1); 
    border: 1px solid #ff4444; 
    color: #ff4444; 
    padding: 12px; 
    font-size: 0.85rem; 
    margin-bottom: 25px; 
    text-align: left; 
}
.auth-alert-success { 
    background: rgba(75, 181, 67, 0.1); 
    border: 1px solid #4BB543; 
    color: #4BB543; 
    padding: 12px; 
    font-size: 0.85rem; 
    margin-bottom: 25px; 
    text-align: left; 
}
.form-row { display: flex; gap: 15px; }
.form-group { text-align: left; margin-bottom: 20px; flex: 1; }
.form-group label { 
    display: block; 
    color: #888; 
    font-size: 0.7rem; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    margin-bottom: 8px; 
}
.login-input { 
    width: 100%; 
    background: #000; 
    border: 1px solid #333; 
    color: #fff; 
    padding: 15px; 
    font-size: 1rem; 
    outline: none; 
    border-radius: 0; 
    transition: border-color 0.3s;
}
.login-input:focus { border-color: var(--gold-primary); }
.login-input:-webkit-autofill,
.login-input:-webkit-autofill:hover, 
.login-input:-webkit-autofill:focus, 
.login-input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #000 inset !important;
    -webkit-text-fill-color: #fff !important;
    transition: background-color 5000s ease-in-out 0s;
    border: 1px solid #333 !important;
}
.login-input:focus:-webkit-autofill {
    border: 1px solid var(--gold-primary) !important;
}
.btn-login { 
    width: 100%; 
    padding: 15px; 
    background: var(--gold-primary); 
    color: #000; 
    border: none; 
    font-weight: 700; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    cursor: pointer; 
    transition: var(--transition); 
    margin-top: 10px; 
}
.btn-login:hover { background: #fff; transform: translateY(-2px); }
.auth-footer { 
    margin-top: 30px; 
    border-top: 1px solid #222; 
    padding-top: 20px; 
    display: flex; 
    flex-direction: column; 
    gap: 15px; 
    text-align: center;
}
.auth-link { 
    font-size: 0.75rem; 
    color: var(--gold-primary); 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    font-weight: 600; 
}
.auth-link:hover { color: #fff; }
.auth-link-alt { 
    color: var(--text-secondary); 
    font-size: 0.65rem; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    margin-top: 8px; 
    float: right; 
}
.auth-link-alt:hover { color: var(--gold-primary); }

/* Responsive Adjustments */
.mobile-header-controls { display: none; }
@media (max-width: 1024px) {
    .desktop-only { display: none !important; }
    .mobile-header-controls { display: block; }
    .nav-links { flex-direction: column; gap: 0; text-align: center; }
    .dropdown-content { position: static; transform: none; box-shadow: none; border: none; display: block; background: transparent; }
    .portal-wrapper { flex-direction: column; padding-top: 0; }
    .portal-main-content .container { padding: 0 15px; }
    .portal-sidebar { 
        width: 100%; 
        height: auto; 
        position: static; 
        border-right: none; 
        border-bottom: 1px solid var(--border-color); 
        padding: 20px 15px; 
    }
    .form-row { flex-direction: column; gap: 0; }
}