/* =============================================
   ADMIN THEME - RYO Platform
   Sistema de variables CSS para modo claro/oscuro
   ============================================= */

/* ── MODO CLARO (por defecto) ── */
:root {
    /* Brand */
    --primary: #F26522;
    --primary-hover: #D4541E;
    --primary-light: rgba(242, 101, 34, 0.1);
    --primary-border: rgba(242, 101, 34, 0.3);

    /* Semantic */
    --success: #10b981;
    --success-light: #d1fae5;
    --success-text: #065f46;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --warning-text: #92400e;
    --error: #ef4444;
    --error-light: #fee2e2;
    --error-text: #991b1b;
    --info: #3b82f6;
    --info-light: #dbeafe;
    --info-text: #1e40af;

    /* Surfaces */
    --bg-page: #f1f5f9;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-header: #1e293b;
    --bg-input: #ffffff;
    --bg-table-header: #f0f2f5;
    --bg-table-row-hover: #f5f6f8;
    --bg-table-row-alt: #f9fafb;
    --bg-code: #f1f5f9;

    /* Text */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-on-dark: #ffffff;
    --text-on-primary: #ffffff;

    /* Borders */
    --border: #e2e8f0;
    --border-light: #e8ecf1;
    --border-input: #d1d5db;
    --border-input-focus: #F26522;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-card-hover: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-dropdown: 0 4px 16px rgba(0, 0, 0, 0.12);

    /* Radii */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 10px;
    --radius-xl: 12px;
    --radius-pill: 20px;

    /* Spacing (compacto) */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 0.75rem;
    --space-lg: 1rem;
    --space-xl: 1.5rem;
    --space-2xl: 2rem;

    /* Sidebar */
    --sidebar-bg: #ffffff;
    --sidebar-item-color: #64748b;
    --sidebar-item-hover-bg: #f1f5f9;
    --sidebar-item-hover-color: #1e293b;
    --sidebar-item-active-bg: rgba(242, 101, 34, 0.08);
    --sidebar-item-active-color: #F26522;
    --sidebar-item-active-border: #F26522;
    --sidebar-border: #e2e8f0;

    /* Status badge colors */
    --status-pending-bg: #fef3c7;
    --status-pending-text: #92400e;
    --status-pending-border: #fcd34d;
    --status-operator-bg: #dbeafe;
    --status-operator-text: #1e40af;
    --status-paid-bg: #d1fae5;
    --status-paid-text: #065f46;
    --status-cancelled-bg: #fee2e2;
    --status-cancelled-text: #991b1b;

    /* Programs section */
    --program-accent: #6366f1;
    --program-accent-light: rgba(99, 102, 241, 0.1);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* ── MODO OSCURO ── */
[data-theme="dark"] {
    --bg-page: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #263548;
    --bg-sidebar: #1a2332;
    --bg-header: #0f172a;
    --bg-input: #1e293b;
    --bg-table-header: #1a2332;
    --bg-table-row-hover: #263548;
    --bg-table-row-alt: #1a2a3a;
    --bg-code: #0f172a;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border: #334155;
    --border-light: #1e293b;
    --border-input: #475569;
    --border-input-focus: #F26522;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-card-hover: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-dropdown: 0 4px 16px rgba(0, 0, 0, 0.5);

    --sidebar-bg: #1a2332;
    --sidebar-item-color: #94a3b8;
    --sidebar-item-hover-bg: #263548;
    --sidebar-item-hover-color: #f1f5f9;
    --sidebar-item-active-bg: rgba(242, 101, 34, 0.15);
    --sidebar-item-active-color: #F26522;
    --sidebar-item-active-border: #F26522;
    --sidebar-border: #334155;

    --status-pending-bg: rgba(245, 158, 11, 0.15);
    --status-pending-text: #fbbf24;
    --status-pending-border: rgba(245, 158, 11, 0.3);
    --status-operator-bg: rgba(59, 130, 246, 0.15);
    --status-operator-text: #60a5fa;
    --status-paid-bg: rgba(16, 185, 129, 0.15);
    --status-paid-text: #34d399;
    --status-cancelled-bg: rgba(239, 68, 68, 0.15);
    --status-cancelled-text: #f87171;

    --primary-light: rgba(242, 101, 34, 0.15);
    --success-light: rgba(16, 185, 129, 0.15);
    --success-text: #34d399;
    --warning-light: rgba(245, 158, 11, 0.15);
    --warning-text: #fbbf24;
    --error-light: rgba(239, 68, 68, 0.15);
    --error-text: #f87171;
    --info-light: rgba(59, 130, 246, 0.15);
    --info-text: #60a5fa;

    --program-accent-light: rgba(99, 102, 241, 0.15);
}

/* ── DARK MODE TOGGLE SWITCH ── */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    padding: 6px 12px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: background var(--transition);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.14);
}

.theme-toggle-track {
    width: 36px;
    height: 20px;
    background: #475569;
    border-radius: 10px;
    position: relative;
    transition: background var(--transition);
    flex-shrink: 0;
}

.theme-toggle-thumb {
    width: 16px;
    height: 16px;
    background: #ffffff;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform var(--transition);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .theme-toggle-track {
    background: #F26522;
}

[data-theme="dark"] .theme-toggle-thumb {
    transform: translateX(16px);
}

.theme-toggle-icon {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    width: 16px;
    text-align: center;
}

.theme-toggle-label {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
}

/* ── TRANSICIONES SUAVES AL CAMBIAR TEMA ── */
body,
.admin-body,
.admin-sidebar,
.admin-header,
.admin-main,
.stat-card,
.chart-card,
.table-container,
.admin-table,
.setting-card,
.report-card,
.program-card,
.membership-edit-card,
.search-card,
.results-list,
.transaction-card,
.search-stats,
.didit-config-panel,
.orphaned-accounts-panel,
.logs-container,
.rates-form,
.form-group input,
.form-group select {
    transition: background-color var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition);
}

/* ── DARK MODE: Selects, inputs, dropdowns ── */
[data-theme="dark"] select,
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .form-input,
[data-theme="dark"] .form-group input {
    background-color: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-input) !important;
}

[data-theme="dark"] select option,
[data-theme="dark"] .form-select option {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

[data-theme="dark"] select:focus,
[data-theme="dark"] .form-select:focus,
[data-theme="dark"] .form-input:focus,
[data-theme="dark"] .form-group input:focus {
    border-color: var(--border-input-focus) !important;
    outline: none;
    box-shadow: 0 0 0 3px rgba(242, 101, 34, 0.15);
}

/* ── DARK MODE: Wallet items y gestor de cuentas ── */
[data-theme="dark"] .wallet-item {
    background: var(--bg-card-hover) !important;
    border-color: var(--border) !important;
}

[data-theme="dark"] .accounts-manager-container p,
[data-theme="dark"] .section-header p {
    color: var(--text-secondary) !important;
}

/* ── DARK MODE: Tablas y elementos generales ── */
[data-theme="dark"] table {
    color: var(--text-primary);
}

[data-theme="dark"] .table-responsive,
[data-theme="dark"] .card,
[data-theme="dark"] .panel {
    background: var(--bg-card);
    border-color: var(--border);
}

/* ── DARK MODE: Botones secundarios ── */
[data-theme="dark"] .btn-secondary {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border);
}

[data-theme="dark"] .btn-secondary:hover {
    background: var(--bg-input);
    border-color: var(--border-input);
}
