/* =========================================================
   ScoreOdonto · Acesso Remoto — Painel Administrativo
   Tema: dark glassmorphism (roxo)
   ========================================================= */

:root {
    --primary: #7c3aed;
    --primary-hover: #6d28d9;
    --primary-soft: rgba(124, 58, 237, 0.15);
    --secondary: #10b981;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    --bg-base: #0a0a0f;
    --bg-elev: #14141b;
    --bg-glass: rgba(255, 255, 255, 0.04);
    --border-glass: rgba(255, 255, 255, 0.08);

    --text-main: #f4f4f5;
    --text-muted: #a1a1aa;

    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

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

html, body {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-base);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Fundo animado ---------- */
.bg-animated {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle at 15% 20%, rgba(124, 58, 237, 0.18), transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(16, 185, 129, 0.12), transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.08), transparent 60%),
        var(--bg-base);
    animation: bgShift 18s ease-in-out infinite alternate;
}
@keyframes bgShift {
    from { background-position: 0% 0%, 100% 100%, 50% 50%, 0 0; }
    to   { background-position: 10% 15%, 90% 85%, 50% 50%, 0 0; }
}

/* ---------- Views ---------- */
.view-container {
    display: none;
    min-height: 100vh;
}
.view-container.active {
    display: flex;
}

/* Login centralizado */
#login-view.active {
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

/* ---------- Glass panel ---------- */
.glass-panel {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    padding: 2rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
}

/* ---------- Login ---------- */
.login-panel {
    width: 100%;
    max-width: 400px;
    text-align: center;
    animation: fadeIn 0.4s ease;
}
.logo-container {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--primary-soft);
}
.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--primary);
}
.login-panel h2 {
    font-size: 1.5rem;
    font-weight: 700;
}
.subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0.4rem 0 1.75rem;
}

/* ---------- Inputs ---------- */
.input-group {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 0 0.9rem;
    margin-bottom: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.input-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.input-group svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.input-group input,
.input-group textarea {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-size: 0.95rem;
    font-family: inherit;
    padding: 0.85rem 0;
}
.input-group input::placeholder,
.input-group textarea::placeholder {
    color: var(--text-muted);
}

/* ---------- Botões ---------- */
.btn-primary,
.btn-secondary,
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn-primary {
    width: 100%;
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}
.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
.panel-header .btn-primary,
form .btn-primary {
    width: auto;
}
.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    border: 1px solid var(--border-glass);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}
.btn-secondary.warning {
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.3);
    background: rgba(245, 158, 11, 0.08);
}
.btn-secondary.warning:hover {
    background: rgba(245, 158, 11, 0.16);
}
.btn-action {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    background: var(--primary-soft);
    color: var(--primary);
}
.btn-action:hover {
    background: rgba(124, 58, 237, 0.25);
}
.btn-action.outline,
.btn-secondary.outline {
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
}
.btn-action.outline:hover {
    border-color: var(--danger);
    color: var(--danger);
}
.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.btn-icon:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}
.btn-icon svg { width: 18px; height: 18px; }
.btn-primary svg,
.btn-secondary svg,
.btn-action svg { width: 16px; height: 16px; }

.error-msg {
    color: var(--danger);
    font-size: 0.85rem;
    min-height: 1.2rem;
    margin-top: 0.75rem;
}

.lucide-spin {
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* =========================================================
   Dashboard
   ========================================================= */
#dashboard-view {
    flex-direction: row;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}
#dashboard-view.active {
    display: flex;
}

.sidebar {
    width: 260px;
    height: 100%;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-glass);
    background: rgba(20, 20, 25, 0.7);
    border-radius: 0;
    padding: 1.5rem;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
}
.sidebar-header .header-icon {
    width: 32px;
    height: 32px;
    color: var(--primary);
}
.sidebar-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.2s;
}
.nav-item svg { width: 18px; height: 18px; }
.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}
.nav-item.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-glass);
}

.admin-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--secondary);
    background: rgba(16, 185, 129, 0.1);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
}
.admin-badge svg { width: 16px; height: 16px; }

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 3rem;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
}
.panel-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
}

/* ---------- Cards de dispositivos ---------- */
.clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.client-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: all 0.2s;
}
.client-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.client-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.client-id {
    font-weight: 600;
    color: var(--text-main);
    font-size: 1.1rem;
}
.client-status {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--secondary);
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 2px 8px;
    border-radius: 20px;
}

.client-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

code {
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 6px;
    border-radius: 4px;
}

/* ---------- Estados ---------- */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 1rem;
    font-size: 0.95rem;
}
.text-center { text-align: center; color: var(--text-muted); padding: 1rem; }

/* ---------- Tabelas ---------- */
.glass-panel h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
}
.data-table th {
    text-align: left;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-glass);
}
.data-table td {
    padding: 0.9rem 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr {
    transition: background 0.15s;
}
.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* ---------- Upload / progresso ---------- */
.file-upload-wrapper:hover {
    border-color: var(--primary) !important;
    background: var(--primary-soft);
}
.file-msg { transition: color 0.2s; }
.client-updater-log { transition: opacity 0.2s; min-height: 1em; }

/* ---------- Animações ---------- */
.tab-content {
    animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Responsivo ---------- */
@media (max-width: 768px) {
    #dashboard-view { flex-direction: column; height: auto; min-height: 100vh; overflow: visible; }
    .sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        border-right: none;
        border-bottom: 1px solid var(--border-glass);
        margin-bottom: 0;
    }
    .sidebar-header { margin-bottom: 0; margin-right: auto; }
    .sidebar-nav { flex-direction: row; flex: 0; flex-wrap: wrap; }
    .sidebar-footer { border-top: none; padding-top: 0; width: 100%; }
    .main-content { padding: 1.5rem; }
    .clients-grid { grid-template-columns: 1fr; }
}
