:root {
    --bg-app: #05030d;
    --bg-gradient: radial-gradient(circle at 10% 20%, #1a1342 0%, rgba(5,3,13,0) 40%),
                   radial-gradient(circle at 80% 0%, #742dd0 0%, rgba(5,3,13,0) 45%),
                   #05030d;
    --surface: rgba(255,255,255,0.05);
    --surface-strong: rgba(255,255,255,0.08);
    --stroke: rgba(255,255,255,0.12);
    --primary: linear-gradient(125deg, #8b5cf6 0%, #ec4899 65%, #f97316 100%);
    --primary-solid: #a855f7;
    --primary-soft: rgba(168, 85, 247, 0.25);
    --text-main: rgba(255,255,255,0.98);
    --text-muted: rgba(255,255,255,0.68);
    --text-dim: rgba(255,255,255,0.45);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #f43f5e;
    --radius-sm: 10px;
    --radius-md: 18px;
    --radius-lg: 30px;
    --radius-pill: 999px;
    --shadow-soft: 0 25px 45px rgba(0,0,0,0.45);
    --shadow-card: 0 35px 80px rgba(6,5,15,0.65);
}

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

body {
    font-family: 'Poppins', 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; border: none; background: none; cursor: pointer; }

.app-backdrop {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.orb {
    position: absolute;
    width: clamp(280px, 35vw, 580px);
    height: clamp(280px, 35vw, 580px);
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.45;
}

.orb-one { background: #7c3aed; top: -180px; left: -120px; }
.orb-two { background: #ec4899; bottom: -240px; right: -160px; }

.grid-overlay {
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 140px 140px;
    opacity: 0.5;
}

.app-shell {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(1.5rem, 4vw, 3rem);
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

/* LOGIN */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.5rem, 4vw, 3rem);
}

.login-shell {
    width: min(1100px, 100%);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: clamp(1.5rem, 4vw, 3rem);
    background: rgba(8,7,20,0.92);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-lg);
    padding: clamp(2rem, 6vw, 3.5rem);
    box-shadow: var(--shadow-card);
}

.login-illustration {
    border-radius: var(--radius-md);
    border: 1px solid rgba(255,255,255,0.08);
    background: radial-gradient(circle at 30% 30%, rgba(139,92,246,0.2), transparent 55%),
                radial-gradient(circle at 70% 70%, rgba(236,72,153,0.15), transparent 60%),
                rgba(255,255,255,0.02);
    min-height: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    font-size: 3rem;
    color: rgba(255,255,255,0.45);
}

.login-content h1 {
    font-size: clamp(2rem, 5vw, 2.8rem);
    margin-bottom: 0.5rem;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.25em;
    font-size: 0.72rem;
    color: var(--text-dim);
    margin-bottom: 0.4rem;
}

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

.login-feature-list {
    list-style: none;
    margin: 1.5rem 0;
    display: grid;
    gap: 0.7rem;
    color: var(--text-muted);
}

.login-feature-list i { color: var(--primary-solid); margin-right: 0.6rem; }

.btn-discord {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem 1.9rem;
    border-radius: var(--radius-pill);
    background: linear-gradient(125deg, #5661f2, #7180ff);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 25px 60px rgba(86,97,242,0.45);
}

.btn-discord .btn-arrow {
    margin-left: auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,0.2);
}

.login-note {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-dim);
}

/* HERO */
.hero-header,
.workspace,
.app-footer {
    background: rgba(8,7,20,0.92);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-lg);
    padding: clamp(1.5rem, 4vw, 2.5rem);
    box-shadow: var(--shadow-card);
}

.hero-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 2rem;
}

.hero-brand {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.brand-icon {
    width: 78px;
    height: 78px;
    border-radius: 26px;
    background: var(--primary);
    display: grid;
    place-items: center;
    font-size: 2rem;
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-pill {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1.3rem;
    border-radius: var(--radius-pill);
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
}

.status-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    position: relative;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 12px rgba(16,185,129,0.6);
}

.status-dot.offline {
    background: var(--danger);
    box-shadow: 0 0 12px rgba(244,63,94,0.6);
}

.status-dot::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 1px solid currentColor;
    opacity: 0.4;
    animation: status-pulse 2s ease infinite;
}

@keyframes status-pulse {
    0%,100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.4); opacity: 0; }
}

.btn-ghost {
    padding: 0.85rem 1.2rem;
    border-radius: var(--radius-pill);
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
}

/* METRICS */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1.25rem;
}

.metric-card {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(7,7,20,0.85);
    box-shadow: var(--shadow-soft);
}

.metric-icon {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    background: var(--primary-soft);
    color: var(--primary-solid);
    display: grid;
    place-items: center;
    font-size: 1.2rem;
}

.label {
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.74rem;
    color: var(--text-dim);
}

/* WORKSPACE */
.workspace {
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
}

.workspace-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1.5rem;
    align-items: flex-end;
}

.nav-tabs {
    display: flex;
    gap: 0.4rem;
    padding: 0.35rem;
    background: rgba(255,255,255,0.04);
    border-radius: var(--radius-pill);
}

.nav-tab {
    position: relative;
    padding: 0.65rem 1.35rem;
    border-radius: var(--radius-pill);
    color: var(--text-muted);
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nav-tab::after {
    content: '';
    position: absolute;
    inset: 0.15rem;
    border-radius: var(--radius-pill);
    background: var(--primary);
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.nav-tab i,
.nav-tab span {
    position: relative;
    z-index: 1;
}

.nav-tab.active { color: #fff; }
.nav-tab.active::after { opacity: 1; transform: scale(1); }

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeUp 0.3s ease; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.panel-card {
    background: rgba(5,5,15,0.88);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255,255,255,0.06);
    padding: 1.5rem;
    box-shadow: var(--shadow-soft);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}

.radios-grid,
.connections-list,
.system-info-grid {
    display: grid;
    gap: 1rem;
}

.radios-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.connections-list { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.system-info-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.radio-card-modern,
.connection-item {
    background: rgba(8,8,22,0.92);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-md);
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.radio-title-modern,
.connection-info .connection-server {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.radio-status-badge,
.connection-status {
    width: fit-content;
    padding: 0.35rem 0.9rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    border: 1px solid currentColor;
    flex-shrink: 0;
}

.radio-status-badge.ativada,
.connection-status.connected {
    color: var(--success);
    background: rgba(16,185,129,0.12);
}

.radio-status-badge.desativada,
.connection-status.disconnected {
    color: var(--danger);
    background: rgba(244,63,94,0.12);
}

.radio-info-modern,
.connection-info {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: var(--radius-sm);
    padding: 1rem;
    font-size: 0.9rem;
    display: grid;
    gap: 0.5rem;
    word-break: break-word;
}

.radio-info-modern span,
.connection-info span { color: var(--text-dim); margin-right: 0.25rem; }

.radio-actions-modern,
.connection-actions {
    display: flex;
    gap: 0.7rem;
}

.radio-actions-modern .btn-modern,
.connection-actions .btn-modern {
    padding: 0.55rem 0.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.action-card {
    display: flex;
    gap: 1rem;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: var(--radius-md);
    padding: 1.1rem;
}

.action-icon {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    background: rgba(255,255,255,0.08);
    display: grid;
    place-items: center;
}

.action-body p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0.7rem; }

.system-info-grid .dashboard-card,
.system-info-grid .info-card {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: var(--radius-sm);
    padding: 1rem;
}

.status-label {
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-bottom: 0.3rem;
}

.status-value {
    font-size: 1.25rem;
    font-weight: 600;
}

/* FOOTER */
.app-footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-meta {
    color: var(--text-muted);
    display: flex;
    gap: 1rem;
}

/* MODAL */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal.active { display: flex; }

.modal-content {
    width: min(460px, calc(100% - 2rem));
    background: rgba(5,5,15,0.94);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
}

.modal-header,
.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.modal-header { margin-bottom: 1rem; }
.modal-body { display: grid; gap: 1rem; margin-bottom: 1.5rem; }

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

.form-group label {
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.form-group input,
.checkbox-wrapper {
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
    padding: 0.85rem;
    color: var(--text-main);
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1rem;
}

.modal-body .checkbox-wrapper {
    margin-top: 0.5rem;
}

.checkbox-wrapper input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-solid);
    flex-shrink: 0;
}

.checkbox-wrapper label {
    margin: 0;
    font-weight: 500;
    color: var(--text-main);
}

.modal-footer {
    justify-content: flex-end;
}

.modal-footer .btn-modern:first-of-type {
    color: var(--text-muted);
}

/* TOASTS */
.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 9999;
}

.toast {
    min-width: 280px;
    background: rgba(5,5,15,0.94);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-sm);
    padding: 1rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transform: translateX(30px);
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show { transform: translateX(0); opacity: 1; }

.toast-content { display: flex; gap: 0.6rem; align-items: center; }
.toast-close { margin-left: auto; color: var(--text-dim); background: transparent; }

/* Generic modern buttons */
.btn-modern {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.75rem 1.2rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
    color: var(--text-main);
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.btn-modern:hover {
    border-color: rgba(255,255,255,0.25);
    transform: translateY(-1px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
}

.btn-primary-modern {
    background: var(--primary);
    color: #fff;
    border: none;
    box-shadow: 0 15px 35px rgba(138,92,246,0.35);
}

.btn-secondary-modern {
    background: rgba(255,255,255,0.03);
    color: var(--text-main);
}

/* Legacy button aliases used nos cards de sistema */
.btn-warning,
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.1rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-warning {
    background: rgba(245,158,11,0.18);
    color: var(--warning);
    border: 1px solid rgba(245,158,11,0.35);
    box-shadow: 0 12px 25px rgba(245,158,11,0.18);
}

.btn-danger {
    background: rgba(244,63,94,0.18);
    color: var(--danger);
    border: 1px solid rgba(244,63,94,0.35);
    box-shadow: 0 12px 25px rgba(244,63,94,0.18);
}

.btn-warning:hover,
.btn-danger:hover {
    transform: translateY(-1px);
}

/* RESTART OVERLAY */
.restarting-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    color: #fff;
    z-index: 10000;
}

.restarting-icon { font-size: 3.2rem; animation: spin 2s linear infinite; }

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* RESPONSIVE */
@media (max-width: 768px) {
    .hero-header,
    .workspace,
    .app-footer {
        padding: 1.25rem;
    }

    .hero-actions { flex-direction: column; align-items: stretch; }

    .nav-tabs { width: 100%; justify-content: space-between; }
    .nav-tab { flex: 1; justify-content: center; }
}
