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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f6fa;
}

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

/* Botões Genéricos */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    transition: background 0.3s, transform 0.2s;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
    transform: translateY(-2px);
}

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-warning:hover {
    background: #e67e22;
    transform: translateY(-2px);
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.btn-info {
    background: #3498db;
    color: white;
}

.btn-info:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn-light {
    background: #ecf0f1;
    color: #333;
    border: 1px solid #ddd;
}

.btn-light:hover {
    background: #dcdde1;
    transform: translateY(-2px);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Alertas */
.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 1rem;
    text-align: center;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Badges */
.badge {
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.85rem;
    font-weight: bold;
}
.badge-success { background: #27ae60; color: white; }
.badge-warning { background: #f39c12; color: white; }
.badge-danger { background: #e74c3c; color: white; }
.badge-info { background: #3498db; color: white; }
.badge-secondary { background: #95a5a6; color: white; }


/* --- ADMIN LAYOUT --- */
.admin-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.admin-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-header h1 {
    color: white;
    margin: 0;
    font-size: 1.5rem;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.admin-user span {
    color: white;
}

/* Menu Hambúrguer (escondido por padrão em desktop) */
.menu-toggle {
    display: none; 
    background: none;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0.5rem;
}

.admin-container {
    display: flex;
    min-height: calc(100vh - 64px); /* Altura da tela menos o header */
}

.admin-sidebar {
    width: 250px;
    background: #2c3e50;
    color: white;
    padding: 2rem 0;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    flex-shrink: 0; /* Não encolhe */
    transition: transform 0.3s ease-in-out;
}

.admin-sidebar nav ul {
    list-style: none;
}

.admin-sidebar nav ul li a {
    display: block;
    padding: 1rem 2rem;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: background 0.3s, color 0.3s;
}

.admin-sidebar nav ul li a:hover,
.admin-sidebar nav ul li a.active {
    background: #34495e;
    color: white;
    border-left: 5px solid #667eea;
    padding-left: 1.75rem; /* Ajusta padding para compensar a borda */
}

.admin-content {
    flex-grow: 1; /* Ocupa o espaço restante */
    padding: 2rem;
    background-color: #f5f6fa;
}

/* --- CLIENTE LAYOUT --- */
.cliente-header {
    background: linear-gradient(135deg, #3498db 0%, #2c3e50 100%);
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.cliente-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cliente-header h1 {
    color: white;
    margin: 0;
    font-size: 1.5rem;
}

.cliente-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cliente-user span {
    color: white;
}

.cliente-sidebar {
    width: 250px;
    background: #3498db; /* Cor diferente para cliente */
    color: white;
    padding: 2rem 0;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    flex-shrink: 0;
    transition: transform 0.3s ease-in-out;
}

.cliente-sidebar nav ul {
    list-style: none;
}

.cliente-sidebar nav ul li a {
    display: block;
    padding: 1rem 2rem;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: background 0.3s, color 0.3s;
}

.cliente-sidebar nav ul li a:hover,
.cliente-sidebar nav ul li a.active {
    background: #2980b9;
    color: white;
    border-left: 5px solid white; /* Borda branca para cliente */
    padding-left: 1.75rem;
}

/* --- TABELAS RESPONSIVAS --- */
.table-container {
    overflow-x: auto; /* Adiciona scroll horizontal para tabelas */
    margin-bottom: 2rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px; /* Garante que a tabela não fique muito estreita */
}

table th, table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

table th {
    background-color: #f8f9fa;
    color: #555;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9rem;
}

table tbody tr:last-child td {
    border-bottom: none;
}

table tbody tr:hover {
    background-color: #f2f2f2;
}

/* --- GRIDS DE INFORMAÇÕES (Dashboard, Detalhes Contrato) --- */
.stats-grid, .info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.stat-card, .info-card {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.stat-icon {
    font-size: 3rem;
}

.stat-info h3 {
    font-size: 2rem;
    color: #2c3e50;
    margin: 0;
}

.stat-info p {
    color: #7f8c8d;
    margin: 0.5rem 0 0 0;
}

/* --- FORMULÁRIOS --- */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #555;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="tel"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea; /* Cor de foco padrão */
}

/* Estilo para checkboxes/radios */
.form-group input[type="checkbox"],
.form-group input[type="radio"] {
    width: auto;
    margin-right: 0.5rem;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
}

/* --- RESPONSIVIDADE GERAL --- */

/* Telas menores que 992px (tablets e celulares grandes) */
@media (max-width: 992px) {
    .admin-header, .cliente-header {
        padding: 1rem 1.5rem;
    }

    .admin-header h1, .cliente-header h1 {
        font-size: 1.3rem;
    }

    .admin-user span, .cliente-user span {
        font-size: 0.9rem;
    }

    .admin-content, .cliente-content {
        padding: 1.5rem;
    }

    .admin-content h1, .cliente-content h1 {
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }

    .stats-grid, .info-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 1.5rem;
    }

    .stat-card, .info-card {
        padding: 1.5rem;
    }

    .stat-icon {
        font-size: 2.5rem;
    }

    .stat-info h3 {
        font-size: 1.8rem;
    }

    table {
        min-width: 600px; /* Reduz o min-width para tabelas */
    }
}

/* Telas menores que 768px (tablets pequenos e celulares) */
@media (max-width: 768px) {
    .admin-header-content, .cliente-header-content {
        flex-direction: row; /* Mantém o logo e o botão de menu na mesma linha */
        justify-content: space-between;
    }

    .admin-user, .cliente-user {
        display: none; /* Esconde o nome do usuário e botão sair no header em mobile */
    }

    .menu-toggle {
        display: block; /* Mostra o botão de menu */
    }

    .admin-container, .cliente-container {
        flex-direction: column; /* Empilha sidebar e conteúdo */
    }

    /* Sidebar em mobile: fixo e oculto por padrão */
    .admin-sidebar, .cliente-sidebar {
        position: fixed; 
        top: 64px; /* Altura do header */
        left: -250px; /* Esconde fora da tela */
        height: calc(100% - 64px); 
        z-index: 999;
        width: 250px; /* Largura do sidebar */
        transform: translateX(0); /* Estado inicial (oculto) */
    }

    /* Sidebar aberto em mobile */
    .admin-sidebar.open, .cliente-sidebar.open {
        transform: translateX(250px); /* Move para dentro da tela */
    }

    .admin-content, .cliente-content {
        margin-left: 0; /* Remove margem do conteúdo principal */
        padding: 1.5rem;
    }

    .stats-grid, .info-grid {
        grid-template-columns: 1fr; /* Uma coluna para grids */
        gap: 1.5rem;
    }

    .stat-card, .info-card {
        padding: 1.2rem;
    }

    .stat-icon {
        font-size: 2rem;
    }

    .stat-info h3 {
        font-size: 1.5rem;
    }

    table {
        min-width: 500px; /* Reduz ainda mais o min-width */
    }

    .form-group input, .form-group select, .form-group textarea {
        padding: 10px;
        font-size: 0.95rem;
    }

    .btn {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
}

/* Telas menores que 480px (celulares muito pequenos) */
@media (max-width: 480px) {
    .admin-header, .cliente-header {
        padding: 0.8rem 1rem;
    }

    .admin-header h1, .cliente-header h1 {
        font-size: 1.2rem;
    }

    .menu-toggle {
        font-size: 1.5rem;
    }

    .admin-sidebar, .cliente-sidebar {
        width: 200px; /* Sidebar um pouco mais estreito */
        left: -200px;
    }

    .admin-sidebar.open, .cliente-sidebar.open {
        transform: translateX(200px);
    }

    .admin-sidebar nav ul li a, .cliente-sidebar nav ul li a {
        padding: 0.8rem 1.5rem;
    }

    .admin-content, .cliente-content {
        padding: 1rem;
    }

    .admin-content h1, .cliente-content h1 {
        font-size: 1.5rem;
    }

    .stats-grid, .info-grid {
        gap: 1rem;
    }

    .stat-card, .info-card {
        padding: 1rem;
    }

    .stat-icon {
        font-size: 1.8rem;
    }

    .stat-info h3 {
        font-size: 1.3rem;
    }

    table {
        min-width: 400px; /* Mínimo para tabelas */
    }
}
