:root {
    --bg: #0f172a;
    --card: #1e293b;
    --primary: #3b82f6;
    --danger: #ef4444;
    --text: #f8fafc;
}

* {
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
}

.screen {
    display: none;
    height: 100%;
    overflow-y: auto;
    padding: 20px;
}

.screen.active {
    display: block;
    animation: fadeIn 0.3s;
}

#auth-screen {
    display: none;
    place-items: center;
}

#auth-screen.active {
    display: grid;
}

.auth-card {
    background: var(--card);
    padding: 40px;
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.logo-large {
    font-size: 2rem;
    margin-bottom: 30px;
}

.logo-large span {
    color: var(--primary);
    font-size: 3rem;
    display: block;
}

.highlight {
    color: var(--primary);
}

.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid #334155;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: #64748b;
    padding: 10px;
    cursor: pointer;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
    font-weight: bold;
}

input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    background: #0f172a;
    border: 1px solid #334155;
    color: white;
    border-radius: 8px;
    outline: none;
}

input:focus {
    border-color: var(--primary);
}

button {
    cursor: pointer;
    transition: 0.2s;
    border: none;
    font-weight: 600;
}

#btn-auth {
    width: 100%;
    background: var(--primary);
    color: white;
    padding: 12px;
    border-radius: 8px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.2rem;
}

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

.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px;
    border-radius: 50%;
    display: flex;
    color: white;
}

.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.device-card {
    background: var(--card);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid #334155;
    position: relative;
}

.status-badge {
    display: inline-block;
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.status-badge.aberto {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.status-badge.fechado {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.status-badge.offline {
    background: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
}
.status-badge.online {
    background-color: rgba(59, 130, 246, 0.15); /* Fundo Azul Claro */
    color: #3b82f6; /* Texto Azul */
    border: 1px solid #3b82f6;
}

.control-btn {
    width: 100%;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--primary);
    border-radius: 10px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.control-btn:hover {
    background: var(--primary);
    color: white;
}

.control-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.add-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    background: var(--card);
    padding: 10px;
    border-radius: 12px;
    flex-wrap: wrap;
}

.btn-primary {
    background: var(--primary);
    color: white;
    padding: 0 20px;
    border-radius: 8px;
    min-width: 50px;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: none;
    place-items: center;
    z-index: 100;
}

.modal-overlay.active {
    display: grid;
    animation: fadeIn 0.2s;
}

.modal-content {
    background: var(--card);
    width: 90%;
    max-width: 500px;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid #334155;
}

.modal-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.2);
}

.modal-body {
    padding: 30px;
}

.close-btn {
    background: none;
    color: white;
}

.btn-outline {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    border-radius: 8px;
}

#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--card);
    border-left: 4px solid var(--primary);
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s;
}

.toast.error {
    border-color: var(--danger);
}

.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

/* --- NOVOS ESTILOS PARA O FORMULÁRIO DE CADASTRO --- */

.unit-config-area {
    margin-top: 15px;
    border-top: 1px solid #334155;
    padding-top: 15px;
}

.input-label {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 8px;
    display: block;
    text-align: left;
}

/* Toggle Switch (Interruptor) */
.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    color: #cbd5e1;
    font-size: 0.95rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(22px);
}

/* Segmented Control (Botões Apto/Casa) */
.segmented-control {
    display: flex;
    background: #0f172a;
    padding: 4px;
    border-radius: 8px;
    border: 1px solid #334155;
    margin-bottom: 15px;
}

.segmented-control input[type="radio"] {
    display: none;
}

.segmented-control label {
    flex: 1;
    text-align: center;
    padding: 10px;
    cursor: pointer;
    border-radius: 6px;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 600;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Estilo do botão quando selecionado */
.segmented-control input:checked+label {
    background: var(--card);
    /* ou use var(--primary) para mais destaque */
    color: var(--primary);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Inputs Lado a Lado */
.input-row {
    display: flex;
    gap: 10px;
}

.input-group {
    flex: 1;
}
#salvarNovaSenha-btn{
    padding: 20px;
}