/* ============================================
   IronSide RP - Admin Panel
   ============================================ */

:root {
    --bg-primary: #0a0c14;
    --bg-card: #12141f;
    --bg-card-hover: #181b28;
    --bg-input: #0e1019;
    --border: rgba(255,255,255,0.06);
    --border-focus: rgba(212,168,67,0.4);
    --text-primary: #e8e8ee;
    --text-secondary: #8b8da0;
    --text-muted: #4e5068;
    --gold: #d4a843;
    --gold-glow: rgba(212,168,67,0.25);
    --blue: #00d4ff;
    --red: #ef4444;
    --green: #4ade80;
    --orange: #f59e0b;
    --sidebar-width: 240px;
    --sidebar-collapsed: 68px;
    --topbar-height: 60px;
    --radius: 10px;
    --radius-sm: 6px;
    --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
    --font-heading: 'Rajdhani', sans-serif;
    --font-body: 'Inter', sans-serif;
}

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

html { font-size: 14px; }

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1,h2,h3,h4,h5,h6 { font-family: var(--font-heading); font-weight: 600; }

a { color: var(--gold); text-decoration: none; }
a:hover { color: #e6bf5e; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(212,168,67,0.04) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(0,212,255,0.03) 0%, transparent 60%);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.login-logo {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--gold), #b8912e);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: #0a0c14;
    box-shadow: 0 4px 24px var(--gold-glow);
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 1px;
}

.login-subtitle {
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.login-error {
    color: var(--red);
    font-size: 13px;
    margin-top: 12px;
    min-height: 20px;
}

/* ============================================
   FORMS
   ============================================ */

.form-group {
    margin-bottom: 18px;
    text-align: left;
}

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

.form-group label i {
    margin-right: 4px;
    font-size: 11px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
textarea,
select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-glow);
}

textarea { resize: vertical; }

::placeholder { color: var(--text-muted); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gold), #b8912e);
    color: #0a0c14;
}
.btn-primary:hover { box-shadow: 0 4px 20px var(--gold-glow); transform: translateY(-1px); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-success { background: var(--green); color: #0a0c14; }

.btn-secondary {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: rgba(255,255,255,0.10); }

.btn-block { width: 100%; }

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

.btn-warn { background: rgba(245,158,11,0.15); color: var(--orange); border: 1px solid rgba(245,158,11,0.2); }
.btn-warn:hover { background: rgba(245,158,11,0.25); }
.btn-kick { background: rgba(0,212,255,0.1); color: var(--blue); border: 1px solid rgba(0,212,255,0.2); }
.btn-kick:hover { background: rgba(0,212,255,0.2); }
.btn-ban { background: rgba(239,68,68,0.12); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }
.btn-ban:hover { background: rgba(239,68,68,0.22); }
.btn-heal { background: rgba(74,222,128,0.12); color: var(--green); border: 1px solid rgba(74,222,128,0.2); }
.btn-heal:hover { background: rgba(74,222,128,0.22); }
.btn-money { background: rgba(212,168,67,0.12); color: var(--gold); border: 1px solid rgba(212,168,67,0.2); }
.btn-money:hover { background: rgba(212,168,67,0.22); }

.select-sm {
    padding: 6px 10px;
    font-size: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text-primary);
    outline: none;
}

/* chart period buttons */
.chart-period-btns { display: flex; gap: 4px; }
.chart-period-btns .btn-sm {
    padding: 4px 12px;
    font-size: 11px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
}
.chart-period-btns .btn-sm.active {
    background: var(--gold);
    color: #0a0c14;
    border-color: var(--gold);
}
.chart-period-btns .btn-sm:hover:not(.active) {
    border-color: var(--gold);
    color: var(--gold);
}

/* ============================================
   APP LAYOUT
   ============================================ */

.app {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width var(--transition);
    overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 16px;
    border-bottom: 1px solid var(--border);
    min-height: 64px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-logo i {
    font-size: 22px;
    color: var(--gold);
    flex-shrink: 0;
}

.sidebar-brand {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 0.5px;
    transition: opacity var(--transition);
}

.sidebar.collapsed .sidebar-brand { opacity: 0; width: 0; }

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    transition: color var(--transition), transform var(--transition);
    flex-shrink: 0;
}
.sidebar-toggle:hover { color: var(--text-primary); }
.sidebar.collapsed .sidebar-toggle i { transform: rotate(180deg); }

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
    white-space: nowrap;
    margin-bottom: 2px;
    text-decoration: none;
}

.nav-link i {
    width: 20px;
    text-align: center;
    font-size: 15px;
    flex-shrink: 0;
}

.nav-link:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
}

.nav-link.active {
    background: rgba(212,168,67,0.1);
    color: var(--gold);
    border-left: 3px solid var(--gold);
    padding-left: 11px;
}

.sidebar.collapsed .nav-link span { opacity: 0; width: 0; }
.sidebar.collapsed .nav-link { justify-content: center; padding-left: 0; padding-right: 0; }
.sidebar.collapsed .nav-link.active { border-left: none; padding-left: 0; }

.sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    min-height: 56px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    white-space: nowrap;
    font-size: 13px;
    color: var(--text-secondary);
}

.sidebar-user i { font-size: 18px; color: var(--blue); flex-shrink: 0; }

.sidebar.collapsed .sidebar-user span { opacity: 0; width: 0; }

.btn-logout {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    transition: color var(--transition);
    flex-shrink: 0;
}
.btn-logout:hover { color: var(--red); }

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition);
    min-height: 100vh;
    position: relative;
}

.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-collapsed); }

/* TOPBAR */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-height);
    padding: 0 28px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }

.page-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
}

.server-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.online { background: var(--green); box-shadow: 0 0 6px rgba(74,222,128,0.5); }
.status-dot.offline { background: var(--red); box-shadow: 0 0 6px rgba(239,68,68,0.5); }

/* LOADING */
.loading-overlay {
    position: absolute;
    top: var(--topbar-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 40;
    transition: opacity 0.4s;
}

.loading-overlay.hidden { opacity: 0; pointer-events: none; }

.loading-spinner {
    text-align: center;
    color: var(--text-secondary);
}

.loading-spinner i {
    font-size: 36px;
    color: var(--gold);
    margin-bottom: 16px;
    display: block;
}

/* PAGES */
.page {
    display: none;
    padding: 28px;
    animation: fadeIn 0.3s ease;
}

.page.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   STATS CARDS
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stats-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.stats-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

.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: border-color var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
    border-color: rgba(255,255,255,0.1);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

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

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

.stat-value {
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 700;
    line-height: 1.1;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ============================================
   CARDS
   ============================================ */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 12px;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h3 i { color: var(--gold); font-size: 14px; }

.card-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body { padding: 20px; }

/* ============================================
   CHARTS
   ============================================ */

.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.chart-card.wide { grid-column: span 1; }

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}

.chart-header h3 { font-size: 15px; font-weight: 600; }

.chart-body {
    padding: 16px;
    height: 280px;
    position: relative;
}

.chart-body-pie { height: 300px; }

/* ============================================
   TABLE
   ============================================ */

.table-responsive { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    text-align: left;
    border-bottom: 1px solid var(--border);
    cursor: default;
    white-space: nowrap;
    user-select: none;
}

.table th[data-sort] { cursor: pointer; }
.table th[data-sort]:hover { color: var(--text-secondary); }
.table th i { margin-left: 4px; font-size: 10px; }

.table td {
    padding: 10px 14px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: rgba(255,255,255,0.02); }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: rgba(212,168,67,0.05); }

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-ban { background: rgba(239,68,68,0.15); color: var(--red); }
.badge-warn { background: rgba(245,158,11,0.15); color: var(--orange); }
.badge-kick { background: rgba(0,212,255,0.12); color: var(--blue); }

.badge-high { background: rgba(239,68,68,0.15); color: var(--red); }
.badge-medium { background: rgba(245,158,11,0.15); color: var(--orange); }
.badge-low { background: rgba(74,222,128,0.12); color: var(--green); }

/* Search Box */
.search-box {
    position: relative;
}

.search-box i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 12px;
    pointer-events: none;
}

.search-box input {
    padding-left: 32px;
    width: 220px;
    padding-top: 7px;
    padding-bottom: 7px;
    font-size: 13px;
}

/* ============================================
   ANTI-CHEAT FEED
   ============================================ */

.ac-feed {
    max-height: 500px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ac-entry {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.02);
    border-left: 3px solid var(--text-muted);
    font-size: 13px;
}

.ac-entry.high { border-left-color: var(--red); background: rgba(239,68,68,0.04); }
.ac-entry.medium { border-left-color: var(--orange); background: rgba(245,158,11,0.04); }
.ac-entry.low { border-left-color: var(--green); background: rgba(74,222,128,0.04); }

.ac-time {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 80px;
}

.ac-msg { flex: 1; color: var(--text-secondary); }
.ac-player { color: var(--gold); font-weight: 600; }

/* Activity Feed */
.activity-feed {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

.activity-text { flex: 1; color: var(--text-secondary); }
.activity-text strong { color: var(--text-primary); }
.activity-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ============================================
   MODAL
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 95%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 20px;
    color: var(--gold);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    transition: color var(--transition);
}
.modal-close:hover { color: var(--text-primary); }

.modal-body { padding: 24px; }

.modal-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

.player-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.player-info-section h4 {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}

.info-label { color: var(--text-muted); }
.info-value { color: var(--text-primary); font-weight: 500; text-align: right; word-break: break-all; max-width: 200px; }

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.modal-action-form {
    margin-top: 16px;
    padding: 16px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.modal-action-form .form-group { margin-bottom: 12px; }
.modal-action-form .form-row {
    display: flex;
    gap: 12px;
}
.modal-action-form .form-row .form-group { flex: 1; }

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    max-width: 440px;
    pointer-events: auto;
    animation: toastIn 0.35s ease;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    background: var(--bg-card);
}

.toast.removing { animation: toastOut 0.3s ease forwards; }

.toast-success { border-left: 4px solid var(--green); }
.toast-success i { color: var(--green); }

.toast-error { border-left: 4px solid var(--red); }
.toast-error i { color: var(--red); }

.toast-warning { border-left: 4px solid var(--orange); }
.toast-warning i { color: var(--orange); }

.toast-info { border-left: 4px solid var(--blue); }
.toast-info i { color: var(--blue); }

.toast i { font-size: 16px; flex-shrink: 0; }
.toast span { flex: 1; color: var(--text-primary); }

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 2px;
}
.toast-close:hover { color: var(--text-primary); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    to { opacity: 0; transform: translateX(40px); }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
    .charts-row { grid-template-columns: 1fr; }
    .player-detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        z-index: 200;
    }
    .sidebar.mobile-open { transform: translateX(0); }

    .main-content { margin-left: 0 !important; }

    .mobile-menu-btn { display: block; }

    .stats-grid { grid-template-columns: 1fr; }
    .stats-grid.cols-3 { grid-template-columns: 1fr; }
    .stats-grid.cols-2 { grid-template-columns: 1fr; }

    .page { padding: 16px; }
    .topbar { padding: 0 16px; }

    .card-header { flex-direction: column; align-items: flex-start; }
    .search-box input { width: 100%; }

    .modal { width: 98%; max-height: 95vh; }
}
