/* ==========================================================
   PRIME PLAY - PAINEL ONLINE DE GERENCIAMENTO & REVENDAS
   Design System: Dark Obsidian, Glassmorphism, Neon Red
========================================================== */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
    --bg-dark: #07090e;
    --bg-surface: #0d121c;
    --bg-card: rgba(18, 25, 38, 0.7);
    --bg-card-hover: rgba(26, 36, 54, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(229, 9, 20, 0.5);

    --primary: #e50914;
    --primary-hover: #ff232e;
    --primary-glow: rgba(229, 9, 20, 0.35);

    --accent-blue: #0ea5e9;
    --accent-purple: #8b5cf6;
    --accent-green: #10b981;
    --accent-amber: #f59e0b;

    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;

    --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Background Ambient Glow */
body::before {
    content: '';
    position: fixed;
    top: -20%;
    left: 20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(229, 9, 20, 0.08) 0%, rgba(0,0,0,0) 70%);
    pointer-events: none;
    z-index: 0;
}

/* ==========================================================
   LOGIN SCREEN
========================================================== */
#login-wrapper {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: radial-gradient(circle at center, #111726 0%, #06080c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #e50914, #ff5e67, #8b5cf6);
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    background: rgba(229, 9, 20, 0.1);
    border: 1px solid rgba(229, 9, 20, 0.25);
    color: var(--primary-hover);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.login-title {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #fff;
    margin-bottom: 6px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-muted);
}

/* ==========================================================
   INPUTS & BUTTONS
========================================================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.input-box {
    position: relative;
    display: flex;
    align-items: center;
}

.input-box input, .input-box select, .input-box textarea {
    width: 100%;
    background: rgba(10, 14, 22, 0.8);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: #fff;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

.input-box input:focus, .input-box select:focus, .input-box textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: rgba(13, 18, 28, 0.95);
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, #b80710 100%);
    border: none;
    border-radius: var(--radius-md);
    padding: 13px 20px;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 16px var(--primary-glow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary) 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(229, 9, 20, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 18px;
    color: var(--text-main);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}
.btn-danger:hover {
    background: #ef4444;
    color: #fff;
}

.btn-success {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.25);
}
.btn-success:hover {
    background: #10b981;
    color: #fff;
}

/* ==========================================================
   APP MAIN LAYOUT
========================================================== */
#app-layout {
    display: none;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* Sidebar */
.sidebar {
    width: 270px;
    height: 100vh;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    user-select: none;
    z-index: 10;
}

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

.logo-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #fff;
}

.logo-icon {
    width: 34px;
    height: 34px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 0 15px var(--primary-glow);
}

.sidebar-user {
    padding: 18px 20px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-color);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
}

.user-info {
    overflow: hidden;
}

.user-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.role-pill {
    display: inline-block;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 3px;
}

.role-admin { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }
.role-master { background: rgba(14, 165, 233, 0.15); color: #0ea5e9; border: 1px solid rgba(14, 165, 233, 0.3); }
.role-reseller { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }

/* Reseller Code Card in Sidebar */
.reseller-code-card {
    margin: 16px 20px 10px 20px;
    padding: 12px 14px;
    background: rgba(229, 9, 20, 0.08);
    border: 1px dashed rgba(229, 9, 20, 0.35);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.reseller-code-card:hover {
    background: rgba(229, 9, 20, 0.14);
    border-color: var(--primary);
}

.code-title {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 4px;
}

.code-value-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.code-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 2px;
}

/* Sidebar Nav */
.sidebar-nav {
    flex: 1;
    padding: 16px 14px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 4px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
}

.nav-item.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 16px var(--primary-glow);
}

.nav-icon {
    font-size: 18px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

/* ==========================================================
   MAIN CONTENT AREA
========================================================== */
.main-wrapper {
    flex: 1;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Topbar */
.topbar {
    height: 70px;
    padding: 0 32px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(13, 18, 28, 0.6);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.page-title-box h1 {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: #fff;
}

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

.credits-badge {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #f59e0b;
    padding: 7px 14px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Content Body */
.content-body {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.25s ease-out;
}

.tab-pane.active {
    display: block;
}

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

/* ==========================================================
   METRIC STATS CARDS
========================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    transition: var(--transition);
}

.stat-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.14);
    transform: translateY(-2px);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.red { background: rgba(229, 9, 20, 0.15); color: #ff3b46; }
.stat-icon.blue { background: rgba(14, 165, 233, 0.15); color: #0ea5e9; }
.stat-icon.green { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.stat-icon.purple { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.stat-val {
    font-size: 26px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
}

/* ==========================================================
   TABLES & CARDS
========================================================== */
.panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    margin-bottom: 28px;
}

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

.panel-card-title {
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

thead th {
    background: rgba(10, 14, 22, 0.6);
    padding: 14px 20px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

tbody td {
    padding: 16px 20px;
    font-size: 13px;
    color: var(--text-main);
    vertical-align: middle;
}

.code-pill {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.06);
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

.status-active { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.status-blocked { background: rgba(239, 68, 68, 0.15); color: #ef4444; }

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ==========================================================
   MODALS
========================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-card {
    width: 100%;
    max-width: 520px;
    background: #0f1422;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
    animation: modalPop 0.2s ease-out;
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.modal-title {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 22px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-close:hover {
    color: #fff;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* Alert Notification Banner */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: #1e293b;
    border: 1px solid var(--border-color);
    padding: 14px 20px;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease-out;
}

.toast.success { border-color: #10b981; }
.toast.error { border-color: #ef4444; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
