:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-main: #eee;
    --text-muted: #888;
    --border-color: #333;
    
    --primary: #4caf50;
    --primary-hover: #45a049;
    --secondary: #2196F3;
    --secondary-hover: #1976D2;
    --danger: #f44336;
    --danger-hover: #d32f2f;
    --button-bg: #3a3a3a;
    --button-hover: #555;
    
    --header-height: 60px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
}

/* === Custom Scrollbar === */
* {
    scrollbar-width: thin;
    scrollbar-color: #444 transparent;
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #666; }

/* === Sticky Global Header === */
.global-header {
    position: sticky;
    top: 0;
    width: 100%;
    height: var(--header-height);
    background-color: #111;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-sizing: border-box;
    z-index: 1000;
}

.header-brand {
    font-size: 1.5em;
    font-weight: bold;
    color: white;
    text-decoration: none;
    letter-spacing: 1px;
}

.header-nav {
    display: flex;
    gap: 15px;
    align-items: center;
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.nav-btn:hover {
    background: var(--button-hover);
    border-color: var(--text-muted);
}

.nav-btn.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}
.nav-btn.primary:hover {
    background: var(--primary-hover);
}

/* === Layout & Containers === */
.main-content {
    padding: 40px 20px;
    min-height: calc(100vh - var(--header-height));
    box-sizing: border-box;
}

.container {
    max-width: 600px;
    margin: auto;
    background: var(--card-bg);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.container.wide {
    max-width: 1000px;
}

.section {
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
}
.section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* === Typography === */
h1, h2, h3 { margin-top: 0; color: white; }
hr { border: 0; height: 1px; background: var(--border-color); margin: 20px 0; }
a { color: var(--secondary); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }

/* === Forms & Inputs === */
.input-group {
    position: relative;
    margin-bottom: 15px;
    width: 100%;
}

input[type="text"], 
input[type="email"], 
input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    background: #2a2a2a;
    border: 1px solid var(--border-color);
    color: white;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1em;
    transition: border-color 0.2s ease;
}

input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Password Toggle Icon */
.pwd-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-muted);
    user-select: none;
}
.pwd-toggle:hover { color: white; }

/* === Buttons === */
button {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    background: var(--button-bg);
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    font-size: 1em;
    transition: background 0.2s ease, transform 0.1s ease;
}

button:hover { background: var(--button-hover); }
button:active { transform: scale(0.98); }
button:disabled { background: #222; color: #555; cursor: not-allowed; transform: none; }

button.btn-primary { background-color: var(--primary); }
button.btn-primary:hover { background-color: var(--primary-hover); }

button.btn-danger { background-color: var(--danger); }
button.btn-danger:hover { background-color: var(--danger-hover); }

/* Loading State Animation */
button.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}
button.loading::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 18px;
    height: 18px;
    margin-left: -9px;
    margin-top: -9px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

/* === Badges & Callouts === */
.callout {
    padding: 12px 15px;
    border-radius: 4px;
    margin: 15px 0;
    font-size: 0.95em;
    display: none; /* hidden by default */
}
.callout.error {
    display: block;
    background-color: rgba(244, 67, 54, 0.1);
    border-left: 4px solid var(--danger);
    color: #ff8a80;
}
.callout.success {
    display: block;
    background-color: rgba(76, 175, 80, 0.1);
    border-left: 4px solid var(--primary);
    color: #b9f6ca;
}

/* === Tabs === */
.tabs { display: flex; margin-bottom: 20px; border-bottom: 1px solid var(--border-color); }
.tab { 
    flex: 1; text-align: center; padding: 12px; cursor: pointer; 
    border-bottom: 3px solid transparent; color: var(--text-muted); 
    transition: all 0.2s ease;
}
.tab.active { border-bottom-color: var(--primary); color: white; font-weight: bold; }
.tab:hover:not(.active) { color: white; background: rgba(255,255,255,0.05); }

/* === Tables === */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
th, td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--border-color); }
th { background-color: #2a2a2a; color: white; font-weight: 600; }
.action-btn { width: auto; padding: 6px 10px; font-size: 0.85em; margin: 2px; }

/* === Custom Modal === */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(3px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.modal-box {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}
.modal-overlay.active .modal-box {
    transform: translateY(0);
}
.modal-title { margin-top: 0; font-size: 1.2em; }
.modal-desc { color: #ccc; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions button { margin-bottom: 0; }

/* Utility */
.copy-btn {
    background: transparent; border: 1px solid var(--border-color);
    padding: 4px 8px; font-size: 0.8em; margin-left: 10px; width: auto;
}
.copy-btn:hover { background: rgba(255,255,255,0.1); }
