/* ======================================
   PAINEL ADMINISTRATIVO - DESIGN MODERNO
   Cores: Azul Escuro/Marinho
====================================== */

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

:root {
    --bg-primary: #1a2332;
    --bg-secondary: #243447;
    --bg-card: #2d3e52;
    --text-primary: #ffffff;
    --text-secondary: #b8c5d6;
    --accent-blue: #4a9eff;
    --accent-green: #4ade80;
    --accent-yellow: #fbbf24;
    --accent-purple: #a78bfa;
    --accent-orange: #fb923c;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
}

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

.admin-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 240px;
    height: 100vh;
    background: var(--bg-secondary);
    padding: 20px 0;
    overflow-x: hidden;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0,0,0,0.3);
    transition: width 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #222b38 var(--bg-secondary);
}

/* Webkit scrollbar para sidebar */
.sidebar-menu::-webkit-scrollbar {
    width: 7px;
    background: var(--bg-secondary);
}
.sidebar-menu::-webkit-scrollbar-thumb {
    background: #222b38;
    border-radius: 8px;
    border: 2px solid var(--bg-secondary);
}
.sidebar-menu::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 10px;
}

.admin-sidebar .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    transition: padding 0.3s ease, justify-content 0.3s ease;
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px 10px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-toggle {
    background: var(--accent-blue);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 15px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: background 0.2s;
    margin-left: 10px;
}
.sidebar-toggle:hover {
    background: var(--accent-blue-dark, #3578e5);
}

.admin-sidebar .logo span:last-child {
    transition: opacity 0.2s ease, width 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
}

.admin-sidebar .menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    white-space: nowrap;
}

.admin-sidebar .menu-item:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
}

.admin-sidebar .menu-item.active {
    background: linear-gradient(90deg, rgba(74, 158, 255, 0.2) 0%, transparent 100%);
    border-left: 3px solid var(--accent-blue);
    color: var(--accent-blue);
}

.admin-sidebar .menu-item .icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.admin-sidebar .menu-item .text {
    flex: 1;
    font-size: 14px;
    transition: opacity 0.2s ease, width 0.3s ease;
    white-space: nowrap;
}

.admin-sidebar .menu-item .badge {
    background: var(--accent-yellow);
    color: #000;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    transition: opacity 0.2s ease, width 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-section {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-divider {
    height: 1px;
    margin: 10px 20px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
}

.section-title {
    display: block;
    margin: 0 20px 10px;
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent-yellow);
    font-weight: 700;
}

/* Botão de toggle do sidebar - MELHORADO */
.sidebar-toggle {
    position: absolute;
    top: 50%;
    right: -12px;
    transform: translateY(-50%);
    width: 24px;
    height: 48px;
    background: var(--bg-secondary);
    border: 1px solid rgba(255,255,255,0.1);
    border-left: none;
    border-radius: 0 8px 8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.3s ease;
    color: var(--text-secondary);
    font-size: 12px;
    box-shadow: 2px 0 8px rgba(0,0,0,0.2);
}
.sidebar-toggle:hover {
    background: var(--accent-blue);
    color: #fff;
    width: 28px;
}
.sidebar-toggle .toggle-icon {
    transition: transform 0.3s ease;
    line-height: 1;
}

/* Sidebar colapsado */
body.sidebar-collapsed .admin-sidebar {
    width: 70px;
}
body.sidebar-collapsed .admin-sidebar .logo span:last-child,
body.sidebar-collapsed .admin-sidebar .menu-item .text,
body.sidebar-collapsed .admin-sidebar .menu-item .badge {
    opacity: 0;
    width: 0;
        background: var(--bg-card) !important;
        color: var(--text-primary) !important;
        font-weight: 600;
        outline: none;
}
    /* Garante contraste nas opções do select */
    .form-stack select option {
        background: var(--bg-card);
        color: var(--text-primary);
        font-weight: 600;
    }
body.sidebar-collapsed .admin-sidebar .logo {
    justify-content: center;
    padding: 0 10px 30px 10px;
}
body.sidebar-collapsed .admin-sidebar .menu-item {
    justify-content: center;
    padding: 14px 10px;
}
body.sidebar-collapsed .admin-sidebar .menu-item .icon {
    font-size: 22px;
}
body.sidebar-collapsed .admin-sidebar > div:last-child {
    padding: 20px 10px !important;
}
body.sidebar-collapsed .admin-sidebar > div:last-child a {
    justify-content: center !important;
}
body.sidebar-collapsed .admin-sidebar > div:last-child a span:last-child {
    opacity: 0;
    width: 0;
    overflow: hidden;
}
body.sidebar-collapsed .sidebar-toggle .toggle-icon {
    transform: rotate(180deg);
}

/* Main content ajustado quando sidebar colapsado */
body.sidebar-collapsed .admin-main {
    margin-left: 70px;
}

/* Tooltip no hover quando colapsado */
body.sidebar-collapsed .admin-sidebar .menu-item {
    position: relative;
}
body.sidebar-collapsed .admin-sidebar .menu-item::after {
    content: attr(data-title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    margin-left: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1002;
}
body.sidebar-collapsed .admin-sidebar .menu-item:hover::after {
    opacity: 1;
    visibility: visible;
}

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

.admin-main {
    margin-left: 240px;
    padding: 20px 30px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.admin-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
}

.admin-header .user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.admin-header .user-info .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.admin-header .logout-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
}

.admin-header .logout-btn:hover {
    background: rgba(255,255,255,0.15);
}

/* ======================================
   CARDS DE ESTATÍSTICAS
====================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.stat-card .card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

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

.stat-card .icon.blue { background: rgba(74, 158, 255, 0.2); }
.stat-card .icon.green { background: rgba(74, 222, 128, 0.2); }
.stat-card .icon.yellow { background: rgba(251, 191, 36, 0.2); }
.stat-card .icon.purple { background: rgba(167, 139, 250, 0.2); }

.stat-card .card-content .title {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.stat-card .card-content .value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-card .card-content .subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 5px;
}

.stat-card .card-action {
    margin-top: 15px;
}

.stat-card .card-action button,
.stat-card .card-action a {
    background: rgba(255,255,255,0.1);
    border: none;
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
}

.stat-card .card-action button:hover,
.stat-card .card-action a:hover {
    background: rgba(255,255,255,0.15);
}

/* ======================================
   BOTÕES DE AÇÃO
====================================== */

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.action-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    text-align: center;
    transition: transform 0.3s ease;
}

.action-card:hover {
    transform: translateY(-3px);
}

.action-card .icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 15px auto;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.action-card .icon.blue { background: rgba(74, 158, 255, 0.2); }
.action-card .icon.green { background: rgba(74, 222, 128, 0.2); }
.action-card .icon.purple { background: rgba(167, 139, 250, 0.2); }
.action-card .icon.yellow { background: rgba(245, 158, 11, 0.2); }

.action-card h3 {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.action-card p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.action-card .btn {
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    display: inline-block;
    transition: all 0.3s ease;
}

.action-card .btn.blue {
    background: var(--accent-blue);
    color: #fff;
}

.action-card .btn.green {
    background: var(--accent-green);
    color: #000;
}

.action-card .btn.purple {
    background: var(--accent-purple);
    color: #fff;
}

.action-card .btn.yellow {
    background: #f59e0b;
    color: #000;
}

.action-card .btn:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

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

@media (max-width: 768px) {
    .admin-sidebar {
        width: 70px;
    }
    
    .admin-sidebar .menu-item .text,
    .admin-sidebar .menu-item .badge,
    .admin-sidebar .logo {
        display: none;
    }
    
    .admin-main {
        margin-left: 70px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    gap: 10px;
}

.chart-header h3 {
    font-size: 16px;
    color: var(--text-primary);
}

.chart-header span {
    font-size: 12px;
    color: var(--text-secondary);
}

.panel-grid {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.4fr);
    gap: 20px;
    align-items: start;
}

.panel-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.panel-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 14px;
}

.panel-help {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-stack input,
.form-stack textarea,
.form-stack select {
    width: 100%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 10px 12px;
    font-size: 14px;
}

.form-stack textarea {
    min-height: 110px;
    resize: vertical;
}

.btn-primary {
    background: var(--accent-blue);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-weight: 600;
    cursor: pointer;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #fecaca;
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
}

.list-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 12px;
}

.list-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.badge-inline {
    display: inline-block;
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 600;
}

.badge-success {
    background: rgba(74, 222, 128, 0.2);
    color: var(--accent-green);
}

.badge-warn {
    background: rgba(251, 191, 36, 0.2);
    color: var(--accent-yellow);
}

@media (max-width: 980px) {
    .panel-grid {
        grid-template-columns: 1fr;
    }
}

/* ======================================
   PREMIUM THEME (NON-GAMES)
====================================== */

body.admin-premium {
    font-family: 'Satoshi', 'Plus Jakarta Sans', 'DM Sans', 'Segoe UI', sans-serif;
    color: #dbe7f7;
    background:
        radial-gradient(140% 120% at 0% 0%, rgba(14, 165, 233, 0.08) 0%, transparent 45%),
        radial-gradient(120% 140% at 100% 0%, rgba(37, 99, 235, 0.1) 0%, transparent 42%),
        linear-gradient(180deg, #050b18 0%, #071125 48%, #060f21 100%);
}

body.admin-premium .admin-main {
    background: transparent;
}

body.admin-premium .admin-header {
    margin-bottom: 22px;
    padding: 14px 16px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 16px;
    background:
        radial-gradient(120% 100% at 100% 0%, rgba(37, 99, 235, 0.08) 0%, rgba(30, 41, 59, 0) 55%),
        linear-gradient(170deg, rgba(15, 23, 42, 0.92) 0%, rgba(17, 24, 39, 0.86) 100%);
    box-shadow: 0 14px 36px rgba(2, 6, 23, 0.3);
}

body.admin-premium .admin-header h1 {
    font-size: clamp(1.35rem, 1.1rem + 1vw, 1.9rem);
    letter-spacing: 0.15px;
}

body.admin-premium .stats-grid,
body.admin-premium .charts-grid,
body.admin-premium .action-buttons {
    gap: 16px;
}

body.admin-premium .stat-card,
body.admin-premium .chart-card,
body.admin-premium .action-card,
body.admin-premium .panel-card,
body.admin-premium .list-card {
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background:
        radial-gradient(100% 100% at 100% 0%, rgba(37, 99, 235, 0.08) 0%, rgba(30, 41, 59, 0) 55%),
        linear-gradient(170deg, rgba(15, 23, 42, 0.92) 0%, rgba(17, 24, 39, 0.86) 100%);
    box-shadow: 0 12px 30px rgba(2, 6, 23, 0.28);
}

body.admin-premium .stat-card,
body.admin-premium .action-card {
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

body.admin-premium .stat-card:hover,
body.admin-premium .action-card:hover {
    transform: translateY(-3px);
    border-color: rgba(125, 211, 252, 0.4);
    box-shadow: 0 18px 42px rgba(2, 6, 23, 0.4);
}

body.admin-premium .stat-card .icon,
body.admin-premium .action-card .icon {
    border: 1px solid rgba(148, 163, 184, 0.25);
    box-shadow: 0 10px 22px rgba(2, 6, 23, 0.24);
}

body.admin-premium .stat-card .card-content .title,
body.admin-premium .chart-header span,
body.admin-premium .panel-help,
body.admin-premium .list-meta {
    color: #9fb3cd;
}

body.admin-premium .stat-card .card-content .value,
body.admin-premium .chart-header h3,
body.admin-premium .action-card h3,
body.admin-premium .panel-title {
    color: #f1f5f9;
}

body.admin-premium .stat-card .card-content .subtitle,
body.admin-premium .action-card p {
    color: #94a3b8;
}

body.admin-premium .stat-card .card-action a,
body.admin-premium .stat-card .card-action button,
body.admin-premium .btn-primary,
body.admin-premium .action-card .btn {
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    transition: transform 0.2s ease, filter 0.2s ease, border-color 0.2s ease;
}

body.admin-premium .stat-card .card-action a:hover,
body.admin-premium .stat-card .card-action button:hover,
body.admin-premium .btn-primary:hover,
body.admin-premium .action-card .btn:hover {
    transform: translateY(-1px);
    border-color: rgba(125, 211, 252, 0.45);
    filter: brightness(1.04);
}

body.admin-premium .form-stack input,
body.admin-premium .form-stack textarea,
body.admin-premium .form-stack select {
    background: rgba(15, 23, 42, 0.68);
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: 10px;
    color: #e2e8f0;
}

body.admin-premium .form-stack input:focus,
body.admin-premium .form-stack textarea:focus,
body.admin-premium .form-stack select:focus {
    outline: none;
    border-color: rgba(56, 189, 248, 0.55);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

body.admin-premium .admin-main table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

body.admin-premium .admin-main table th {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.96) 0%, rgba(15, 23, 42, 0.96) 100%);
    color: #cbd5e1;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    font-size: 11px;
}

body.admin-premium .admin-main table td,
body.admin-premium .admin-main table th {
    border-color: rgba(148, 163, 184, 0.18);
}

body.admin-premium .admin-main table tr:hover td {
    background: rgba(59, 130, 246, 0.08);
}

@media (max-width: 980px) {
    body.admin-premium .admin-header {
        padding: 12px;
        border-radius: 14px;
    }

    body.admin-premium .stat-card,
    body.admin-premium .chart-card,
    body.admin-premium .action-card,
    body.admin-premium .panel-card,
    body.admin-premium .list-card {
        border-radius: 14px;
    }
}
