/* =====================================================
   MultiRadio Panel - Estilos principales
   Bootstrap 5.3.8 base + personalizaciones
===================================================== */

:root {
    --brand:          #B8D827;
    --brand-dark:     #6b8015;
    --brand-darker:   #4d5d10;
    --brand-light:    #d9ee6b;
    --brand-soft:     #f6fae1;

    --surface:        #ffffff;
    --surface-alt:    #f8fafc;
    --surface-muted:  #eef1f5;
    --border:         #e4e8ee;
    --border-soft:    #eef1f5;

    --text:           #1e2432;
    --text-muted:     #6b7280;
    --text-soft:      #9aa2b1;

    --status-active:    #16a34a;
    --status-inactive:  #f59e0b;
    --status-suspended: #dc2626;

    --sidebar-width:  260px;

    --shadow-sm:  0 1px 2px 0 rgba(20, 25, 40, 0.04);
    --shadow:     0 4px 6px -1px rgba(20, 25, 40, 0.06), 0 2px 4px -2px rgba(20, 25, 40, 0.06);
    --shadow-lg:  0 10px 25px -5px rgba(20, 25, 40, 0.10), 0 4px 10px -4px rgba(20, 25, 40, 0.08);
}

* { -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
    background: var(--surface-alt);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 0.95rem;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===================== App shell ===================== */

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
        "sidebar topbar"
        "sidebar main"
        "sidebar footer";
}

@media (max-width: 991.98px) {
    .app-shell {
        grid-template-columns: 1fr;
        grid-template-areas:
            "topbar"
            "main"
            "footer";
    }
}

/* ===================== Sidebar ===================== */

.sidebar {
    grid-area: sidebar;
    background: #11161f;
    color: #e5e7eb;
    padding: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

@media (max-width: 991.98px) {
    .sidebar { display: none; }
}

.sidebar-brand {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.2px;
}

.sidebar-brand:hover { color: #fff; }

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    background: var(--brand);
    color: #1b2400;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.sidebar-section {
    padding: 16px 16px 6px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #7b8598;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0 10px;
    flex: 1;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    color: #c9ced8;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    margin-bottom: 2px;
    transition: all 0.15s ease;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.sidebar-nav a.active {
    background: linear-gradient(135deg, rgba(184,216,39,0.18), rgba(184,216,39,0.05));
    color: var(--brand);
    box-shadow: inset 3px 0 0 var(--brand);
}

.sidebar-nav a i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 0.78rem;
    color: #7b8598;
}

/* ===================== Topbar ===================== */

.topbar {
    grid-area: topbar;
    background: #fff;
    border-bottom: 1px solid var(--border-soft);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.topbar-menu-btn {
    background: transparent;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--text);
    font-size: 1.3rem;
}

.topbar-menu-btn:hover { background: var(--surface-muted); }

@media (max-width: 991.98px) {
    .topbar-menu-btn { display: inline-flex; }
    .topbar { padding: 10px 16px; }
}

.topbar-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 0;
}

.topbar-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #1b2400;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
}

.topbar-username {
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 600;
}

@media (max-width: 575.98px) {
    .topbar-username { display: none; }
}

/* ===================== Main ===================== */

.main {
    grid-area: main;
    padding: 28px 28px 40px;
    min-width: 0;
}

@media (max-width: 767.98px) {
    .main { padding: 18px 14px 30px; }
}

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

.page-header h1 {
    font-size: 1.55rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.3px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-header h1 i {
    color: var(--brand-dark);
    font-size: 1.4rem;
}

.page-header p {
    margin: 4px 0 0 0;
    color: var(--text-muted);
    font-size: 0.92rem;
}

/* ===================== Footer ===================== */

.app-footer {
    grid-area: footer;
    background: #fff;
    border-top: 1px solid var(--border-soft);
    padding: 14px 28px;
    font-size: 0.82rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

/* ===================== Cards ===================== */

.card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-soft);
    padding: 14px 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.card-header i { color: var(--brand-dark); font-size: 1.05rem; }

.card-body { padding: 20px; }
.card-footer {
    background: transparent;
    border-top: 1px solid var(--border-soft);
    padding: 12px 20px;
}

/* ===================== Stats cards ===================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 991.98px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 479.98px)  { .stats-grid { grid-template-columns: 1fr; } }

.stat-card {
    background: #fff;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-card-icon.bg-total    { background: #eef2ff; color: #4f46e5; }
.stat-card-icon.bg-active   { background: #dcfce7; color: var(--status-active); }
.stat-card-icon.bg-inactive { background: #fef3c7; color: #b45309; }
.stat-card-icon.bg-suspended{ background: #fee2e2; color: var(--status-suspended); }

.stat-card-value {
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text);
}

.stat-card-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
}

/* ===================== Buttons ===================== */

.btn {
    font-weight: 500;
    border-radius: 9px;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-sm { border-radius: 7px; gap: 4px; }
.btn-lg { border-radius: 11px; }

.btn-brand {
    background: var(--brand);
    color: #1b2400;
    border: 1px solid var(--brand);
    font-weight: 600;
}

.btn-brand:hover, .btn-brand:focus {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    color: #fff;
}

.btn-soft {
    background: var(--surface-muted);
    color: var(--text);
    border: 1px solid transparent;
}

.btn-soft:hover { background: var(--border); }

/* ===================== Status badges ===================== */

.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px 4px 8px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: capitalize;
}

.badge-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.badge-status.active    { background: #dcfce7; color: var(--status-active); }
.badge-status.inactive  { background: #fef3c7; color: #b45309; }
.badge-status.suspended { background: #fee2e2; color: var(--status-suspended); }

/* ===================== Tables ===================== */

.table {
    --bs-table-bg: transparent;
    margin-bottom: 0;
}

.table thead th {
    background: var(--surface-alt);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-soft);
    padding: 12px 16px;
}

.table tbody td {
    padding: 14px 16px;
    vertical-align: middle;
    border-color: var(--border-soft);
}

.table tbody tr:hover { background: var(--surface-alt); }

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

/* Radio avatar */
.radio-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #1b2400;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.radio-avatar.muted {
    background: linear-gradient(135deg, #cbd5e1, #94a3b8);
    color: #fff;
}

/* ===================== Forms ===================== */

.form-label {
    font-weight: 500;
    color: var(--text);
    font-size: 0.88rem;
    margin-bottom: 6px;
}

.form-label .req { color: var(--status-suspended); }

.form-control, .form-select {
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 9px 12px;
    font-size: 0.95rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand-dark);
    box-shadow: 0 0 0 3px rgba(184, 216, 39, 0.15);
}

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

.input-group-text {
    background: var(--surface-muted);
    border-color: var(--border);
    color: var(--text-muted);
}

/* Switches */
.form-switch .form-check-input {
    width: 2.6em;
    height: 1.4em;
    cursor: pointer;
    background-color: #d1d5db;
    border: none;
}

.form-switch .form-check-input:checked {
    background-color: var(--brand-dark);
}

.form-switch .form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(184, 216, 39, 0.2);
}

/* Social row (form editor) */
.social-row {
    background: var(--surface-alt);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.social-row:has(.form-check-input:checked) {
    border-color: var(--brand);
    background: var(--brand-soft);
}

.social-row-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.social-row-head .social-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #fff;
    flex-shrink: 0;
}

/* ===================== Alerts ===================== */

.alert {
    border: none;
    border-left: 3px solid transparent;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 0.92rem;
}

.alert-success { background: #dcfce7; color: #15803d; border-left-color: var(--status-active); }
.alert-danger  { background: #fee2e2; color: #991b1b; border-left-color: var(--status-suspended); }
.alert-warning { background: #fef3c7; color: #92400e; border-left-color: var(--status-inactive); }
.alert-info    { background: #dbeafe; color: #1e40af; border-left-color: #2563eb; }

/* ===================== URL box (copy) ===================== */

.url-box {
    font-family: ui-monospace, "SF Mono", Consolas, "Cascadia Mono", monospace;
    background: #0f172a;
    color: #e2e8f0;
    border: 1px solid #1e293b;
    border-radius: 9px;
    padding: 10px 14px;
    font-size: 0.85rem;
    letter-spacing: -0.01em;
}

.url-box:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(184, 216, 39, 0.2);
    color: #fff;
    background: #0f172a;
}

.json-preview {
    background: #0f172a;
    color: #c9d1d9;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 0.82rem;
    padding: 18px;
    margin: 0;
    border-radius: 0 0 14px 14px;
    max-height: 480px;
    overflow: auto;
    line-height: 1.5;
}

/* ===================== Login ===================== */

.login-wrap {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #fff;
}

@media (max-width: 991.98px) {
    .login-wrap { grid-template-columns: 1fr; }
    .login-side { display: none !important; }
}

.login-form-side {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.login-side {
    background: linear-gradient(135deg, #0f1a06 0%, #243a11 50%, #3f5a18 100%);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    padding: 40px;
}

.login-side::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(184,216,39,0.22) 0%, transparent 45%),
        radial-gradient(circle at 80% 70%, rgba(184,216,39,0.12) 0%, transparent 45%);
    pointer-events: none;
}

.login-side-inner {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 420px;
}

.login-side h2 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 12px;
}

.login-side p {
    opacity: 0.75;
    line-height: 1.6;
}

.login-side-icon {
    font-size: 4rem;
    color: var(--brand);
    margin-bottom: 18px;
    filter: drop-shadow(0 4px 20px rgba(184, 216, 39, 0.4));
}

.login-card {
    width: 100%;
    max-width: 380px;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo-box {
    width: 64px;
    height: 64px;
    background: var(--brand);
    color: #1b2400;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 14px;
    box-shadow: 0 10px 25px -5px rgba(184, 216, 39, 0.4);
}

.login-logo h4 {
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.3px;
}

.login-logo small { color: var(--text-muted); }

/* ===================== Utilities ===================== */

.text-brand { color: var(--brand-dark) !important; }
.bg-brand   { background: var(--brand) !important; color: #1b2400 !important; }

.clickable { cursor: pointer; }

.copy-feedback {
    background: var(--status-active) !important;
    color: #fff !important;
    border-color: var(--status-active) !important;
}

/* Mobile-only radio card (alternative to table) */
.radio-card-mobile {
    display: none;
    background: #fff;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
}

@media (max-width: 767.98px) {
    .table-desktop { display: none; }
    .radio-card-mobile { display: block; }
}

.radio-card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.radio-card-name {
    font-weight: 600;
    margin: 0;
}

.radio-card-slug {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: ui-monospace, Consolas, monospace;
}

.radio-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.radio-card-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.radio-card-actions .btn {
    flex: 1;
    justify-content: center;
    min-width: 44px;
}

/* Scrollbar refinada */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
