/* ===== GLOBAL ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:opsz@14..32&display=swap');

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

body {
    font-family: 'Inter', sans-serif;
    background: #f8fafc;
    color: #1e293b;
}

/* ===== LOGIN ===== */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(145deg, #f1f5f9 0%, #ffffff 100%);
}

.login-container {
    background: white;
    padding: 2.5rem 2rem;
    border-radius: 2rem;
    box-shadow: 0 20px 35px -8px rgba(0, 0, 0, 0.1), 0 5px 10px -4px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 380px;
    text-align: center;
}

.login-container img {
    height: 128px;
    margin-bottom: 1.5rem;
    max-width: 100%;   /* garante que não ultrapasse o container em telas pequenas */
    object-fit: contain;
}

.login-container input {
    width: 100%;
    padding: 0.85rem 1rem;
    margin: 0.5rem 0;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    font-size: 0.95rem;
    transition: border-color 0.15s;
}

.login-container input:focus {
    outline: none;
    border-color: #225cff;
    box-shadow: 0 0 0 3px rgba(34, 92, 255, 0.1);
}

.login-container button {
    width: 100%;
    padding: 0.85rem;
    background: #225cff;
    border: none;
    color: white;
    font-weight: 600;
    border-radius: 1rem;
    cursor: pointer;
    margin-top: 1rem;
    transition: background 0.2s;
}

.login-container button:hover {
    background: #1a4ad0;
}

/* ===== LAYOUT PRINCIPAL ===== */
.layout {
    display: flex;
    min-height: 100vh;
}

/* ----- SIDEBAR ----- */
.sidebar {
    width: 260px;
    background: #151517;
    color: white;
    display: flex;
    flex-direction: column;
    padding: 2rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar .logo-area {
    display: flex;
    justify-content: center;
    margin-bottom: 2.5rem;
}

.sidebar .logo-area img {
    height: 82px;
    max-width: 100%;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.sidebar nav {
    flex: 1;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #a0a0a7;
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    margin-bottom: 0.25rem;
    transition: all 0.2s;
}

.sidebar nav a i {
    width: 1.25rem;
    font-size: 1.1rem;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    background: #2a2a2f;
    color: white;
}

.sidebar button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 1px solid #3a3a40;
    color: #f87171;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    cursor: pointer;
    font-weight: 500;
    width: 100%;
    transition: background 0.2s;
}

.sidebar button:hover {
    background: #2a2a2f;
    border-color: #f87171;
}

/* ----- CONTEÚDO ----- */
.content {
    flex: 1;
    padding: 2rem;
    background: #ffffff;
}

.content h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #151517;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ----- CARDS ----- */
.card {
    background: white;
    border-radius: 1.5rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -2px rgba(0, 0, 0, 0.02), 0 10px 15px -3px rgba(0, 0, 0, 0.03);
    border: 1px solid #f0f2f5;
    margin-bottom: 2rem;
}

/* ===== DASHBOARD CÂMERAS ===== */
.camera-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.camera-card {
    background: white;
    border-radius: 1.2rem;
    padding: 1rem;
    border: 1px solid #edf2f7;
    transition: transform 0.2s, box-shadow 0.2s;
}

.camera-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -8px rgba(0, 0, 0, 0.1);
}

.camera-card .snapshot {
    width: 100%;
    height: 160px;
    background: #f1f5f9;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    overflow: hidden;
}

.camera-card .snapshot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.camera-card .status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.status {
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.85rem;
}

.status.online {
    background: #dcfce7;
    color: #166534;
}

.status.offline {
    background: #fee2e2;
    color: #991b1b;
}

/* ===== TABELAS ===== */
.table-container {
    overflow-x: auto;
    border-radius: 1rem;
    border: 1px solid #f0f2f5;
}

.styled-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.styled-table thead tr {
    background: #f8fafc;
    border-bottom: 2px solid #e9edf2;
}

.styled-table th {
    text-align: left;
    padding: 1rem 1.2rem;
    font-weight: 600;
    color: #475569;
}

.styled-table td {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid #f0f2f5;
    color: #334155;
}

.styled-table tbody tr:hover {
    background: #fafcff;
}

.styled-table .actions {
    display: flex;
    gap: 0.5rem;
}

/* ===== BOTÕES ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    border-radius: 2rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    font-size: 0.9rem;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: #225cff;
    color: white;
}

.btn-primary:hover {
    background: #1a4ad0;
}

.btn-edit {
    background: #fef3c7;
    color: #b45309;
}

.btn-edit:hover {
    background: #fde68a;
}

.btn-delete {
    background: #fee2e2;
    color: #b91c1c;
}

.btn-delete:hover {
    background: #fecaca;
}

.btn-save {
    background: #d1fae5;
    color: #065f46;
}

.btn-save:hover {
    background: #a7f3d0;
}

/* ===== FORMULÁRIOS ===== */
.form-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    align-items: flex-end;
}

.form-inline input {
    padding: 0.7rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    min-width: 180px;
    flex: 1 1 auto;
    font-size: 0.95rem;
}

.form-inline input:focus {
    outline: none;
    border-color: #225cff;
    box-shadow: 0 0 0 2px rgba(34, 92, 255, 0.1);
}

/* ===== CONTROLES DE TABELA ===== */
.table-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.table-controls input {
    padding: 0.6rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 2rem;
    width: 250px;
    font-size: 0.9rem;
}

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

#totalRegistros {
    font-weight: 500;
    color: #475569;
}

/* ===== PAGINAÇÃO ===== */
.pagination {
    display: flex;
    gap: 0.4rem;
    margin-top: 1.5rem;
}

.pagination button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    background: white;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.pagination button.active {
    background: #225cff;
    border-color: #225cff;
    color: white;
}

.pagination button:hover:not(.active) {
    background: #f1f5f9;
}

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 768px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 1rem;
        flex-direction: row;
        align-items: center;
        gap: 1rem;
    }

    .sidebar .logo-area {
        margin-bottom: 0;
    }

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

    .sidebar nav a {
        padding: 0.5rem;
        justify-content: center;
    }

    .sidebar nav a span {
        display: none;
    }

    .sidebar nav a i {
        width: auto;
        font-size: 1.3rem;
    }

    .sidebar button span {
        display: none;
    }

    .sidebar button i {
        font-size: 1.3rem;
    }

    .content {
        padding: 1.5rem;
    }

    .table-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.8rem;
    }

    .table-controls input {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .login-container img {
        height: 48px;
    }
    .sidebar .logo-area img {
        height: 40px;
    }
}

/* ===== Lista suspensa ===== */
.form-control {
    padding: 0.7rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    font-size: 0.95rem;
    background: white;
    width: 100%;
    box-sizing: border-box;
}
.form-control:focus {
    outline: none;
    border-color: #225cff;
    box-shadow: 0 0 0 2px rgba(34, 92, 255, 0.1);
}