/* ==========================================
   dBoSS Dashboard - Dark Theme
   ========================================== */

:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #242424;
    --bg-hover: #2a2a2a;
    --bg-card: #1a1a1a;
    --border: #2d2d2d;
    --border-hover: #404040;
    --text-primary: #e8e8e8;
    --text-secondary: #999;
    --text-muted: #666;
    --accent: #5865F2;
    --accent-hover: #4752C4;
    --success: #43B581;
    --danger: #ED4245;
    --warning: #FAA61A;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
    --transition: all 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ---- Login Page ---- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px 32px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.logo-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #5865F2, #7289DA);
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    color: white;
    margin-bottom: 16px;
    box-shadow: 0 4px 20px rgba(88, 101, 242, 0.3);
}

.login-logo h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

/* ---- Forms ---- */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input[type="text"],
input[type="password"],
.form-select {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 15px;
    transition: var(--transition);
    outline: none;
}

input:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.15);
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #5865F2, #4752C4);
    color: white;
    box-shadow: 0 2px 8px rgba(88, 101, 242, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4752C4, #3c45a5);
    box-shadow: 0 4px 16px rgba(88, 101, 242, 0.4);
    transform: translateY(-1px);
}

.btn-full { width: 100%; padding: 14px; font-size: 16px; }

.btn-sm { padding: 6px 14px; font-size: 13px; }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn-invite {
    padding: 14px 28px;
    font-size: 15px;
    border-radius: var(--radius);
}

.btn-save {
    padding: 12px 32px;
    font-size: 15px;
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-option {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 8px 16px;
    font-size: 13px;
}

.btn-option:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-option.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* ---- Alert ---- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: rgba(237, 66, 69, 0.1);
    border: 1px solid rgba(237, 66, 69, 0.3);
    color: #ED4245;
}

/* ---- Navbar ---- */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 60px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-back {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    transition: var(--transition);
}

.nav-back:hover { color: var(--text-primary); }

.logo-icon-sm {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #5865F2, #7289DA);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    color: white;
}

.nav-title {
    font-size: 16px;
    font-weight: 700;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-user {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ---- Container ---- */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* ---- Stats Grid ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ---- Sections ---- */
.section {
    margin-bottom: 32px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.badge {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* ---- Server Grid ---- */
.server-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.server-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition);
}

.server-card:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    transform: translateX(4px);
}

.server-avatar img,
.server-avatar-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 12px;
}

.server-avatar img {
    object-fit: cover;
}

.server-avatar-placeholder {
    background: linear-gradient(135deg, #5865F2, #7289DA);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: white;
}

.server-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.server-name {
    font-weight: 600;
    font-size: 15px;
}

.server-id {
    font-size: 12px;
    color: var(--text-muted);
    font-family: 'SF Mono', monospace;
}

.server-arrow {
    color: var(--text-muted);
}

/* ---- Server Config Page ---- */
.server-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.server-avatar-lg img,
.server-avatar-placeholder-lg {
    width: 64px;
    height: 64px;
    border-radius: 16px;
}

.server-avatar-lg img { object-fit: cover; }

.server-avatar-placeholder-lg {
    background: linear-gradient(135deg, #5865F2, #7289DA);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: white;
}

.server-header h1 {
    font-size: 24px;
    font-weight: 700;
}

/* ---- Config Cards ---- */
.config-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    overflow: hidden;
    transition: var(--transition);
}

.config-card:hover {
    border-color: var(--border-hover);
}

.config-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
}

.config-title-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.config-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.config-header h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 2px;
}

.config-body {
    padding: 0 20px 20px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.text-muted {
    color: var(--text-muted);
    font-size: 13px;
}

/* ---- Toggle Switch ---- */
.toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 26px;
    transition: var(--transition);
}

.toggle-slider::before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
}

.toggle input:checked + .toggle-slider {
    background: var(--success);
    border-color: var(--success);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

/* ---- Toast ---- */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--success);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 16px rgba(67, 181, 129, 0.3);
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

/* ---- Save Bar ---- */
.save-bar {
    position: sticky;
    bottom: 0;
    padding: 20px 0;
    text-align: right;
    background: linear-gradient(transparent, var(--bg-primary) 30%);
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 48px;
    color: var(--text-secondary);
}

.empty-state p {
    margin-bottom: 16px;
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
    .stats-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .navbar { padding: 0 16px; }
    .container { padding: 20px 16px; }
    .config-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .btn-group { flex-direction: column; }
    .btn-option { text-align: center; }
}
