/* =====================================================
   LAUNCHER TV BOX - ADMIN PANEL CSS
   Dark Theme com Red Accents (Baseado nos screenshots)
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ===== CSS Variables ===== */
:root {
    --bg-primary: #0d0d0d;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #242424;
    --bg-card: #1e1e1e;
    --bg-hover: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #666;
    --accent-red: #e53e3e;
    --accent-red-hover: #c53030;
    --accent-green: #38a169;
    --accent-yellow: #ecc94b;
    --accent-blue: #4299e1;
    --accent-purple: #9f7aea;
    --border-color: #333;
    --sidebar-width: 250px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.2s ease;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

a { color: var(--accent-red); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-red-hover); }

/* ===== Layout ===== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

.sidebar-header h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.sidebar-header .subtitle {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.sidebar-nav {
    padding: 12px 0;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
    cursor: pointer;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-red);
    color: #fff;
    border-left-color: var(--accent-red);
    border-radius: 0 8px 8px 0;
    margin-right: 8px;
}

.nav-item .icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}

.sidebar-footer .heart { color: var(--accent-red); }

/* ===== Main Content ===== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
}

/* ===== Top Bar ===== */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 30px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

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

/* ===== Page Content ===== */
.page-content {
    padding: 30px;
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    transition: var(--transition);
}

.card:hover {
    border-color: #444;
}

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

.card-title {
    font-size: 16px;
    font-weight: 600;
}

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    transition: var(--transition);
}

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

.stat-value {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 8px;
}

.stat-value.red { color: var(--accent-red); }
.stat-value.green { color: var(--accent-green); }
.stat-value.yellow { color: var(--accent-yellow); }
.stat-value.blue { color: var(--accent-blue); }
.stat-value.purple { color: var(--accent-purple); }

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

/* ===== Quick Links ===== */
.quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

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

.quick-card:hover {
    background: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    color: var(--text-primary);
}

.quick-card .q-icon {
    font-size: 28px;
}

.quick-card .q-title {
    font-size: 14px;
    font-weight: 600;
}

.quick-card .q-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--accent-red);
    color: white;
}
.btn-primary:hover { background: var(--accent-red-hover); color: white; }

.btn-success {
    background: var(--accent-green);
    color: white;
}
.btn-success:hover { background: #2f855a; }

.btn-warning {
    background: var(--accent-yellow);
    color: #000;
}
.btn-warning:hover { background: #d69e2e; }

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

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

.btn-danger {
    background: #c53030;
    color: white;
}
.btn-danger:hover { background: #9b2c2c; }

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.15);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

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

/* ===== Tables ===== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

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

table th {
    background: var(--bg-tertiary);
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

table td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

table tr:hover td {
    background: var(--bg-hover);
}

table tr:last-child td {
    border-bottom: none;
}

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.badge-success { background: rgba(56, 161, 105, 0.2); color: var(--accent-green); }
.badge-danger { background: rgba(229, 62, 62, 0.2); color: var(--accent-red); }
.badge-warning { background: rgba(236, 201, 75, 0.2); color: var(--accent-yellow); }
.badge-info { background: rgba(66, 153, 225, 0.2); color: var(--accent-blue); }

/* ===== Flash Messages ===== */
.flash-message {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
}

.flash-success {
    background: rgba(56, 161, 105, 0.15);
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
}

.flash-error {
    background: rgba(229, 62, 62, 0.15);
    border: 1px solid var(--accent-red);
    color: var(--accent-red);
}

@keyframes slideIn {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ===== Theme Cards ===== */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.theme-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    position: relative;
}

.theme-card.active {
    border-color: var(--accent-red);
}

.theme-card .active-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--accent-red);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    z-index: 2;
}

.theme-preview {
    height: 160px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.theme-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.theme-info {
    padding: 16px;
}

.theme-name {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.theme-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.theme-colors {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
}

.color-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
}

.theme-actions {
    display: flex;
    gap: 8px;
}

/* ===== Login Page ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    background-image: 
        radial-gradient(ellipse at top left, rgba(229, 62, 62, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(159, 122, 234, 0.08) 0%, transparent 50%);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.login-card h1 {
    text-align: center;
    margin-bottom: 8px;
    font-size: 22px;
    font-weight: 700;
}

.login-card .subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 30px;
}

.login-card .btn-primary {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 14px;
}

.login-error {
    background: rgba(229, 62, 62, 0.15);
    border: 1px solid var(--accent-red);
    color: var(--accent-red);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 13px;
    text-align: center;
}

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

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state h3 {
    margin-bottom: 8px;
    color: var(--text-primary);
}

/* ===== Color Inputs ===== */
.color-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-input-group input[type="color"] {
    -webkit-appearance: none;
    width: 40px;
    height: 40px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: transparent;
}

.color-input-group input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.color-input-group input[type="color"]::-webkit-color-swatch { border: none; border-radius: 4px; }

/* ===== Actions Group ===== */
.actions-group {
    display: flex;
    gap: 6px;
}

/* ===== Search Bar ===== */
.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-bar .form-control {
    max-width: 300px;
}

/* ===== Modal (simple) ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal h3 {
    margin-bottom: 20px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar .nav-text, .sidebar-header h2, .sidebar-header .subtitle, .sidebar-footer { display: none; }
    .main-content { margin-left: 60px; }
    .nav-item { justify-content: center; padding: 14px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .page-content { padding: 16px; }
}
