@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #00a65a;
    --primary-dark: #008d4c;
    --secondary-color: #222d32;
    --text-color: #333;
    --bg-color: #ecf0f5;
    --border-color: #d2d6de;
    --white: #ffffff;
    --danger: #dd4b39;
    --success: #00a65a;
    --warning: #f39c12;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Montserrat', sans-serif;
    text-transform: none; 
}

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

/* Utilitários */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
    font-size: 13px;
}

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

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

.btn-danger {
    background-color: var(--danger);
    color: var(--white);
}

/* Estilo para Botões de Paginação */
.btn-paginate {
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    font-size: 12px;
}

.btn-paginate:hover {
    background-color: #eee;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 13px;
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: none;
}

/* Tela de Login */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(-45deg, #00a65a, #008d4c, #222d32, #1a2226);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.login-box {
    background: var(--white);
    padding: 60px 40px;
    border-radius: 10px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    width: 380px;
    max-width: 90%;
    text-align: center;
}

.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
    font-size: 14px;
}

.input-group input {
    width: 100%;
    padding: 12px 15px 12px 40px;
    border: 1px solid #ddd;
    border-radius: 25px;
    font-size: 14px;
    background: #f9f9f9;
    transition: all 0.3s;
}

.input-group input:focus {
    border-color: var(--primary-color);
    background: #fff;
    outline: none;
    box-shadow: 0 0 5px rgba(0, 166, 90, 0.2);
}

/* Layout Principal */
.wrapper {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* Menu Lateral (Sidebar) */
.sidebar {
    width: 270px;
    background-color: var(--secondary-color);
    color: var(--white);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease-in-out;
    height: 100vh;
    z-index: 1000;
    flex-shrink: 0;
    overflow: hidden; /* Importante para animação de largura */
}

/* Estado fechado no Desktop */
body.sidebar-closed .sidebar {
    width: 0;
}

.sidebar-header {
    height: 0;
    display: none;
}

.mobile-close-btn {
    display: none; /* Padrão (Desktop) */
}

.user-panel {
    padding: 20px 15px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #4b646f;
    min-height: 70px;
}

.user-panel img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
    background: #fff;
}

.user-panel .info {
    overflow: hidden;
    width: 100%;
}

.user-panel .info p {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    margin-bottom: 2px;
}

.user-panel .info small {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.sidebar-menu {
    list-style: none;
    margin-top: 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-menu li a {
    display: block;
    padding: 12px 15px;
    color: #b8c7ce;
    text-decoration: none;
    border-left: 3px solid transparent;
    font-size: 14px;
}

.sidebar-menu li a:hover, .sidebar-menu li a.active {
    color: var(--white);
    background-color: #1e282c;
    border-left-color: var(--primary-color);
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid #4b646f;
}

.sidebar-footer a {
    display: block;
    padding: 15px;
    color: #b8c7ce;
    text-decoration: none;
    transition: color 0.2s, background 0.2s;
    font-size: 14px;
}

.sidebar-footer a:hover {
    background-color: #dd4b39;
    color: white;
}

/* Área de Conteúdo */
.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
    position: relative;
    transition: margin-left 0.3s ease-in-out;
}

.main-header {
    height: 50px;
    background-color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    color: white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

/* Cards & Dashboard */
.card {
    background: var(--white);
    border-top: 3px solid var(--primary-color);
    border-radius: 3px;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    padding: 15px;
    overflow: hidden;
}

.card-header {
    border-bottom: 1px solid #f4f4f4;
    padding-bottom: 10px;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
}

/* Tabelas */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 13px;
}

.table th, .table td {
    padding: 10px;
    border: 1px solid var(--border-color);
    text-align: left;
}

.table th {
    background-color: #f9f9f9;
}

.table tbody tr:nth-child(odd) {
    background-color: #f9f9f9;
}

.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Widgets do Dashboard */
.dashboard-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.small-box {
    border-radius: 2px;
    position: relative;
    display: block;
    padding: 20px;
    color: #fff;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

.bg-aqua { background-color: #00c0ef !important; }
.bg-green { background-color: #00a65a !important; }
.bg-yellow { background-color: #f39c12 !important; }
.bg-red { background-color: #dd4b39 !important; }

.small-box h3 { font-size: 26px; margin: 0; font-weight: bold; }
.small-box p { font-size: 14px; margin: 0; }

/* Controle de Visualização */
.view-section {
    display: none;
}

.view-section.active {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Preview de Imagem */
.img-preview {
    max-width: 100px;
    max-height: 100px;
    border: 1px solid #ddd;
    margin-top: 5px;
    display: none;
}

/* --- Responsividade (Mobile) --- */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        left: -270px;
        height: 100%;
        width: 270px;
    }

    .sidebar.open {
        left: 0;
        box-shadow: 2px 0 5px rgba(0,0,0,0.2);
    }
    
    .mobile-close-btn {
        display: block;
        position: absolute;
        top: 10px;
        right: 15px;
        color: #b8c7ce;
        font-size: 20px;
        cursor: pointer;
        z-index: 1002;
    }
    
    .mobile-close-btn:hover {
        color: #fff;
    }

    .content-wrapper {
        margin-left: 0;
    }

    .dashboard-widgets {
        grid-template-columns: 1fr;
    }

    .form-row {
        flex-direction: column;
        gap: 0 !important;
    }
    
    .form-group {
        margin-bottom: 10px;
    }

    .card-header {
        display: flex;
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px;
    }
    
    .card-header > div {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    #dashboard-filter {
        width: 100% !important;
    }
    
    .card-header button {
        width: 100%;
    }

    .table th, .table td {
        padding: 8px 5px;
        font-size: 12px;
    }
    
    .login-box {
        padding: 40px 20px;
    }
}
