:root {
    --bg-dark: #060b16;
    --bg-card: rgba(13, 23, 42, 0.88);
    --bg-input: rgba(8, 15, 30, 0.9);
    --border-color: rgba(0, 180, 255, 0.25);
    --border-focus: #00d2ff;
    --primary: #00b4ff;
    --primary-glow: rgba(0, 180, 255, 0.4);
    --secondary: #0066ff;
    --accent-green: #10b981;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --radius-lg: 16px;
    --radius-md: 10px;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(circle at 15% 15%, rgba(0, 132, 255, 0.16) 0%, transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(0, 210, 255, 0.12) 0%, transparent 40%),
        linear-gradient(180deg, #050912 0%, #0a1428 100%);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.5;
}

/* Barra Superior */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 2rem;
    background: rgba(6, 11, 22, 0.92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    text-decoration: none;
    color: var(--text-main);
}

.brand img {
    height: 54px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(0, 180, 255, 0.45));
}

.brand-text h1 {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.8px;
    background: linear-gradient(90deg, #ffffff, #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-text span {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: block;
}

.nav-tabs {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.tab-btn {
    background: rgba(15, 29, 54, 0.8);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 0.55rem 1.15rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.22s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    text-decoration: none;
}

.tab-btn:hover {
    color: #fff;
    border-color: var(--primary);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 0 18px var(--primary-glow);
}

.badge-count {
    background: rgba(0, 0, 0, 0.35);
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

/* Contenedor Principal */
.container {
    max-width: 1180px;
    margin: 2rem auto;
    padding: 0 1.25rem 3rem;
}

/* Vista Formulario */
.form-wrapper {
    max-width: 780px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.2rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55), 0 0 30px rgba(0, 180, 255, 0.08);
    backdrop-filter: blur(12px);
}

.form-header {
    text-align: center;
    margin-bottom: 1.8rem;
    padding-bottom: 1.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.form-header img {
    height: 92px;
    margin-bottom: 0.6rem;
    filter: drop-shadow(0 0 14px rgba(0, 195, 255, 0.5));
}

.form-header h2 {
    font-size: 1.65rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 0.35rem;
}

.form-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.section-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary);
    font-weight: 700;
    margin: 1.4rem 0 0.85rem;
}

.section-label:first-of-type {
    margin-top: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 0.88rem;
    font-weight: 600;
    color: #cbd5e1;
}

.required-star {
    color: #38bdf8;
    margin-left: 2px;
}

.input-control {
    background: var(--bg-input);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: var(--radius-md);
    padding: 0.78rem 1rem;
    color: #fff;
    font-size: 0.96rem;
    transition: all 0.2s ease;
    width: 100%;
}

.input-control::placeholder {
    color: #64748b;
}

.input-control:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(0, 210, 255, 0.18);
}

textarea.input-control {
    resize: vertical;
    min-height: 86px;
}

.submit-btn {
    margin-top: 1.6rem;
    width: 100%;
    padding: 0.95rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%);
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 114, 255, 0.4);
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(0, 198, 255, 0.55);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Alertas de Estado */
.alert-box {
    margin-top: 1.2rem;
    padding: 1rem 1.2rem;
    border-radius: var(--radius-md);
    font-size: 0.94rem;
    font-weight: 600;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.alert-box.success {
    display: flex;
    background: rgba(16, 185, 129, 0.16);
    border: 1px solid rgba(16, 185, 129, 0.5);
    color: #6ee7b7;
}

.alert-box.error {
    display: flex;
    background: rgba(239, 68, 68, 0.16);
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #fca5a5;
}

/* Panel de Administración */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.2rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-card .stat-title {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 600;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
}

.stat-card.apk .stat-value { color: #38bdf8; }
.stat-card.web .stat-value { color: #a78bfa; }
.stat-card.pending .stat-value { color: #fbbf24; }
.stat-card.today .stat-value { color: #34d399; }

.panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.toolbar-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    flex: 1;
}

.toolbar-filters .input-control {
    max-width: 280px;
    padding: 0.6rem 0.9rem;
}

.toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.btn-action {
    background: rgba(30, 41, 59, 0.9);
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.3);
    padding: 0.58rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s;
}

.btn-action:hover {
    border-color: var(--primary);
    color: #fff;
}

.btn-action.primary {
    background: linear-gradient(135deg, #00b4ff, #0066ff);
    border-color: transparent;
    color: #fff;
}

.btn-action.success {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.5);
    color: #6ee7b7;
}

/* Tabla de Registros */
.table-responsive {
    overflow-x: auto;
}

table.leads-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

table.leads-table th,
table.leads-table td {
    padding: 0.85rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    vertical-align: top;
}

table.leads-table th {
    color: #94a3b8;
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    background: rgba(15, 23, 42, 0.6);
}

table.leads-table tr:hover td {
    background: rgba(0, 180, 255, 0.05);
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge.apk {
    background: rgba(0, 180, 255, 0.18);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.4);
}

.badge.web {
    background: rgba(167, 139, 250, 0.18);
    color: #c4b5fd;
    border: 1px solid rgba(167, 139, 250, 0.4);
}

.status-select {
    background: rgba(15, 23, 42, 0.9);
    color: #f8fafc;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 6px;
    padding: 0.28rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.row-actions {
    display: flex;
    gap: 0.4rem;
}

.icon-btn {
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.8);
    color: #e2e8f0;
    padding: 0.32rem 0.55rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    text-decoration: none;
}

.icon-btn.whatsapp {
    border-color: rgba(16, 185, 129, 0.45);
    color: #34d399;
}

.icon-btn.delete {
    border-color: rgba(239, 68, 68, 0.45);
    color: #f87171;
}

.api-info-banner {
    margin-top: 1.25rem;
    padding: 1rem 1.25rem;
    background: rgba(8, 15, 30, 0.85);
    border: 1px dashed rgba(0, 180, 255, 0.4);
    border-radius: var(--radius-md);
    font-size: 0.86rem;
    color: #cbd5e1;
}

.api-info-banner code {
    background: rgba(0, 180, 255, 0.15);
    color: #38bdf8;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-family: monospace;
}

@media (max-width: 680px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    .navbar {
        padding: 0.8rem 1rem;
    }
    .form-wrapper {
        padding: 1.4rem;
    }
}
