:root {
    --primary: #3498db;
    --secondary: #2c3e50;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f1c40f;
    --light: #f8f9fa;
    --dark: #343a40;
    --gray: #95a5a6;
}

* {
    box-sizing: border-box;
    max-width: 100%;
}

html, body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f7f6;
    margin: 0;
    padding: 0;
    color: #333;
    overflow-x: hidden !important;
    width: 100vw;
    position: relative;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
}

header {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

@media (min-width: 768px) {
    header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

h1 { color: var(--secondary); margin: 0; font-size: 1.5rem; }
h2 { font-size: 1.2rem; margin-bottom: 20px; color: var(--secondary); border-bottom: 2px solid #eee; padding-bottom: 10px; }

.btn {
    display: inline-block;
    padding: 10px 15px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.85rem;
    cursor: pointer;
    border: none;
    transition: opacity 0.2s;
    text-align: center;
}

.btn:hover { opacity: 0.8; }
.btn-blue { background: var(--primary); color: white; }
.btn-green { background: var(--success); color: white; }
.btn-red { background: var(--danger); color: white; }
.btn-gray { background: var(--gray); color: white; }

.nav-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

.nav-buttons .btn {
    flex: 1 1 calc(25% - 8px); /* 4 botões por linha no mobile */
    min-width: 80px;
    padding: 8px 2px;
    font-size: 0.65rem;
}

@media (min-width: 768px) {
    .nav-buttons {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
    }
    .nav-buttons .btn {
        flex: 0 1 auto;
        font-size: 0.85rem;
        padding: 10px 15px;
    }
}

.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

@media (min-width: 992px) {
    .grid {
        grid-template-columns: 1fr 1fr;
    }
}

.card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    width: 100%;
}

input, select, textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1rem;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
}

.srv-box {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #eee;
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
    display: inline-block;
}

.badge-active { background: #d4edda; color: #155724; }
.badge-pending { background: #fff3cd; color: #856404; }
.badge-connected { background: #cce5ff; color: #004085; }

/* Nova Estrutura de Listagem (Sem Tabelas) */
.list-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.list-item {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

@media (min-width: 768px) {
    .list-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.item-info {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    flex: 1;
}

@media (min-width: 768px) {
    .item-info {
        grid-template-columns: 1.5fr 2fr 1fr;
        align-items: start;
    }
}

.info-group {
    word-break: break-all;
    overflow-wrap: break-word;
}

.item-actions {
    display: flex;
    gap: 10px;
}

@media (max-width: 767px) {
    .item-actions {
        border-top: 1px solid #f5f5f5;
        padding-top: 15px;
    }
    .item-actions .btn {
        flex: 1;
    }
}

.search-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

@media (min-width: 768px) {
    .search-box {
        flex-direction: row;
    }
    .search-box input { margin-bottom: 0; }
}

/* Estilo para o Toggle Switch */
.switch-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    background: rgba(0,0,0,0.03);
    padding: 10px;
    border-radius: 8px;
}

.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: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.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: #7b1fa2;
}

input:focus + .slider {
    box-shadow: 0 0 1px #7b1fa2;
}

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

.switch-label {
    font-size: 0.85rem;
    font-weight: bold;
    color: #7b1fa2;
    text-transform: uppercase;
}

.warning-text {
    display: block;
    font-size: 0.75rem;
    color: #d32f2f;
    margin-top: 5px;
    font-weight: normal;
}
