/* D'Orygin Panel - Estilos (skin de marca: negro + degradado magenta/púrpura) */

:root {
    /* Marca D'Orygin */
    --void: #07060d;
    --deep-purple: #170a2b;
    --glow-purple: #3d1160;
    --pink: #ec2695;
    --purple: #7b2ff7;
    --brand-gradient: linear-gradient(90deg, var(--pink), var(--purple));
    --brand-gradient-soft: linear-gradient(135deg, rgba(236,38,149,0.16), rgba(123,47,247,0.16));

    /* Superficies */
    --surface: #120a1f;
    --surface-raised: #1a1129;
    --border: rgba(236,38,149,0.18);
    --border-soft: rgba(255,255,255,0.08);

    /* Texto */
    --text-primary: #f5f3fa;
    --text-muted: #a79bc4;
    --text-faint: #6f6485;

    /* Estados (mantienen función semántica, tono ajustado a la paleta) */
    --success: #2ecc9a;
    --warning: #f0a92f;
    --info: #7b2ff7;
    --danger: #ec2695;

    --shadow: 0 10px 40px rgba(0,0,0,0.45);
    --shadow-glow: 0 0 0 1px var(--border), 0 10px 30px rgba(123,47,247,0.15);
    --radius: 16px;
    --radius-pill: 999px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background:
        radial-gradient(circle at 85% 15%, rgba(236,38,149,0.10) 0%, transparent 45%),
        radial-gradient(circle at 10% 90%, rgba(123,47,247,0.14) 0%, transparent 50%),
        var(--void);
    background-attachment: fixed;
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--deep-purple) 0%, var(--void) 100%);
    border-right: 1px solid var(--border-soft);
    color: white;
    min-height: 100vh;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
}

.logo { margin-bottom: 32px; padding: 0 8px; }
.logo h2 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}
.logo span { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 1.5px; }

.sidebar nav { flex: 1; }
.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    text-decoration: none;
    padding: 12px 16px;
    margin: 4px 0;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}
.sidebar nav a:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
}
.sidebar nav a.active {
    background: var(--brand-gradient);
    color: white;
    box-shadow: 0 4px 16px rgba(236,38,149,0.35);
}
.sidebar nav a svg { opacity: 0.85; flex-shrink: 0; }

.sidebar-footer { padding: 16px 8px; border-top: 1px solid var(--border-soft); }
.sidebar-footer p { font-size: 11px; color: var(--text-faint); }

/* Main content */
.main {
    flex: 1;
    margin-left: 260px;
    padding: 32px;
    max-width: calc(100% - 260px);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}
header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

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

#fecha-actual {
    color: var(--text-muted);
    font-size: 14px;
    text-transform: capitalize;
}

.btn-refresh {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    color: var(--text-primary);
    padding: 10px 18px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-refresh:hover {
    border-color: var(--pink);
    color: var(--pink);
    box-shadow: 0 0 0 1px rgba(236,38,149,0.3);
}

/* Cards */
.cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.card {
    background: var(--surface);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}
.card:hover {
    transform: translateY(-2px);
    border-color: var(--border);
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.card-leads .card-icon { background: rgba(236,38,149,0.14); color: var(--pink); }
.card-citas .card-icon { background: rgba(123,47,247,0.16); color: var(--purple); }
.card-conversion .card-icon { background: rgba(46,204,154,0.14); color: var(--success); }
.card-activos .card-icon { background: rgba(240,169,47,0.14); color: var(--warning); }

.card-info h3 {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 8px;
    font-weight: 600;
}
.card-info p {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 6px;
}
.trend {
    font-size: 12px;
    color: var(--text-faint);
}

/* Sections */
.section {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.section-header h2 { font-size: 18px; font-weight: 600; color: var(--text-primary); }

.btn-link {
    color: var(--pink);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}
.btn-link:hover { text-decoration: underline; }

/* Tables */
.table-container { overflow-x: auto; }

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

th, td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-soft);
    font-size: 13px;
    color: var(--text-primary);
}

th {
    background: rgba(255,255,255,0.02);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.6px;
}

tr:hover { background: rgba(236,38,149,0.04); }

.loading, .empty, .error {
    text-align: center;
    padding: 40px !important;
    color: var(--text-muted);
}
.error { color: var(--danger); }

/* Estado badges */
.estado-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.estado-lead { background: rgba(240,169,47,0.14); color: var(--warning); }
.estado-cita { background: rgba(123,47,247,0.16); color: #b98cfb; }
.estado-cliente { background: rgba(46,204,154,0.14); color: var(--success); }
.estado-archivado { background: rgba(167,155,196,0.14); color: var(--text-faint); }

/* Estados grid */
.estados-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}
.estado-item {
    text-align: center;
    padding: 20px;
    border-radius: 12px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-soft);
}
.estado-item .numero {
    font-size: 28px;
    font-weight: 700;
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.estado-item .label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Filtros */
.filtros {
    display: flex;
    gap: 12px;
}
.filtros select,
.filtros input {
    padding: 10px 14px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    font-size: 13px;
    background: var(--surface);
    color: var(--text-primary);
    min-width: 200px;
}
.filtros select:focus,
.filtros input:focus {
    outline: none;
    border-color: var(--pink);
    box-shadow: 0 0 0 3px rgba(236,38,149,0.15);
}
.filtros input::placeholder { color: var(--text-faint); }

/* Phone link */
.phone-link {
    color: #b98cfb;
    text-decoration: none;
    font-weight: 500;
}
.phone-link:hover { text-decoration: underline; color: var(--pink); }

/* Buttons */
.btn-small {
    padding: 6px 14px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-pill);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-small:hover { background: var(--brand-gradient); border-color: transparent; color: white; }

/* Pagination */
.pagination {
    margin-top: 16px;
    text-align: right;
    font-size: 13px;
    color: var(--text-muted);
}

/* Info box */
.info-box {
    background: var(--brand-gradient-soft);
    border-left: 4px solid var(--purple);
    padding: 16px 20px;
    border-radius: 0 10px 10px 0;
}
.info-box p { font-size: 13px; color: var(--text-muted); margin: 0; }

/* Responsive */
@media (max-width: 1200px) {
    .cards { grid-template-columns: repeat(2, 1fr); }
    .estados-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .sidebar { width: 200px; }
    .main { margin-left: 200px; max-width: calc(100% - 200px); padding: 20px; }
    .cards { grid-template-columns: 1fr; }
    .estados-grid { grid-template-columns: repeat(2, 1fr); }
    header { flex-direction: column; gap: 16px; align-items: flex-start; }
}

/* Accesibilidad: foco visible */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
    outline: 2px solid var(--pink);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
