/* ESTILOS GERAIS */
body {
    margin: 0;
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background-color: #f4f7f9;
    color: #4a4a4a;
}

.top-nav {
    background-color: #ffffff;
    padding: 15px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.top-nav .logo {
    display: flex;
    align-items: center;
}
.top-nav .logo img {
    height: 40px;
    margin-right: 15px;
}
.top-nav .logo h1 {
    font-size: 22px;
    color: #004a91;
    margin: 0;
    font-weight: 600;
}
.nav-wrapper {
    display: flex;
    align-items: center;
    gap: 25px;
}
.top-nav nav {
    display: flex;
    align-items: center;
    gap: 25px;
}
.top-nav nav a {
    color: #555;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    padding: 8px 0;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}
.top-nav nav a:hover, .top-nav nav a.active {
    color: #007bff;
    border-bottom-color: #007bff;
}

.user-menu {
    position: relative;
    display: inline-block;
}
.user-initial-btn {
    background-color: #007bff;
    color: white;
    font-size: 18px;
    font-weight: bold;
    border: 2px solid #fff;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}
.user-initial-btn:hover {
    transform: scale(1.1);
}
.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 55px;
    background-color: #ffffff;
    min-width: 220px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.15);
    z-index: 100;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #ddd;
}
.dropdown-content.show {
    display: block;
}
.dropdown-header {
    padding: 15px 20px;
    color: #333;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-weight: bold;
}
.dropdown-content a {
    color: #dc3545;
    font-weight: 500;
    padding: 12px 20px;
    text-decoration: none;
    display: block;
    text-align: left;
    border-bottom: none;
}
.dropdown-content a:hover {
    background-color: #f1f1f1;
}

.main-content {
    padding: 40px;
}
.content-box {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border-top: 4px solid #007bff;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
}
.content-box h2 {
    font-size: 32px;
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    font-weight: 600;
}
.content-box h3 {
    font-size: 22px;
    color: #333;
    font-weight: 600;
}
.home-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}
.cost-box .value {
    font-size: 90px;
    font-weight: 600;
    color: #007bff;
    cursor: pointer;
    display: inline-block;
    margin-top: top;
}
.cost-box .editable-input {
    font-size: 32px;
    font-weight: 700;
    color: #007bff;
    border: none;
    border-bottom: 2px solid #007bff;
    width: 100%;
    background: transparent;
    padding: 0;
    margin: 0;
    box-shadow: none;
}
.cost-box .editable-input:focus {
    outline: none;
}
.history-summary {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 0;
}
.history-summary ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex-grow: 1;
}
.history-summary li {
    display: flex;
    justify-content: space-between;
    padding: 8px 5px;
    border-bottom: 1px solid #f0f0f0;
}
.history-summary li:last-child {
    border-bottom: none;
}
.history-summary .domain {
    font-weight: 700;
}
.history-summary .cost {
    font-weight: 700;
    color: #28a745;
}
.history-summary .total {
    color: #ffffff;
    background-color: #004a91;
    font-size: 20px;
    font-weight: 700;
    margin: 15px -25px -25px -25px;
    padding: 15px 25px;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    text-align: right;
    flex-shrink: 0;
}
.empty-history {
    color: #888;
    text-align: center;
    padding: 20px;
    margin: auto;
}
.upload-box {
    display: flex;
    flex-direction: column;
    justify-content: top;
    flex-grow: 1;
}
.upload-text {
    font-size: 16px;
    color: #333;
    margin-top: 0;
    margin-bottom: 10px;
    font-weight: 500;
}
.upload-text span {
    font-weight: 700;
    color: #007bff;
}
.upload-area {
    text-align: center;
    border: 2px dashed #ccc;
    padding: 40px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
}
.upload-area:hover {
    border-color: #007bff;
    background-color: #f8faff;
}
.upload-area p {
    margin: 0;
    color: #555;
    font-weight: 500;
    font-size: 18px;
}
input[type="file"] {
    display: none;
}
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 1rem;
}
th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}
th {
    background-color: #e9ecef;
    font-weight: 600;
}
tr:hover {
    background-color: #f8f9fa;
}
tfoot tr {
    background-color: #e9ecef;
    font-weight: bold;
}
tfoot td {
    font-size: 1.1em;
}
.filter-form {
    background-color: #e9ecef;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
}
.filter-form select, .filter-form button {
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
    font-size: 16px;
}
.filter-form button {
    background-color: #007bff;
    color: white;
    cursor: pointer;
    border-color: #007bff;
}
.btn {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    text-decoration: none;
    display: inline-block;
}
.btn:hover {
    opacity: 0.9;
}
.search-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 40px;
    margin-bottom: 10px;
}
.search-container {
    position: relative;
    display: flex;
    align-items: center;
}
.search-container::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background-color: #888;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'%3E%3C/path%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
}
.search-input {
    padding: 8px 12px 8px 35px;
    border: 1px solid #ccc;
    border-radius: 20px;
    font-size: 14px;
    width: 250px;
    transition: all 0.2s ease-in-out;
}
.search-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}


/* --- SEÇÃO DE ESTILOS RESPONSIVOS --- */

/* Esconde o hamburger em telas grandes por padrão */
.hamburger {
    display: none;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    z-index: 1001;
}
.hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px 0;
    background: #333;
    transition: all 0.3s ease-in-out;
}

/* Estilos para Tablet e telas menores */
@media (max-width: 992px) {
    .home-grid {
        grid-template-columns: 1fr 1fr;
    }
    .top-nav {
        padding: 15px 20px;
    }
    .main-content {
        padding: 20px;
    }
}


/* Estilos para Celular */
@media (max-width: 768px) {
    .top-nav .logo h1 {
        font-size: 18px;
    }
    
    /* Esconde a navegação principal (Página Inicial, Histórico) */
    #main-nav {
        display: none;
        position: absolute;
        top: 71px;
        left: 0;
        background: #343a40;
        flex-direction: column;
        width: 100%;
        padding: 0;
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        z-index: 1000;
    }
    /* Mostra a navegação quando o hamburger for clicado */
    #main-nav.nav-active {
        display: flex;
    }
    #main-nav a {
        color: white;
        width: 100%;
        text-align: left;
        padding: 15px 20px;
        border-bottom: 1px solid #495057;
    }
    
    /* Faz o hamburger aparecer e o alinha com o menu do usuário */
    .nav-wrapper {
        gap: 15px;
    }
    .hamburger {
        display: block;
        order: 1; /* Coloca o hamburger primeiro */
    }
    .user-menu {
        order: 2; /* Coloca o menu de usuário depois */
    }
    
    /* Esconde os links de navegação originais (que agora estão dentro do hamburger) */
    .nav-wrapper > nav {
        display: none;
    }
    
    /* Animação do Hamburger para 'X' */
    .hamburger.is-active span:nth-child(2) {
        opacity: 0;
    }
    .hamburger.is-active span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    .hamburger.is-active span:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    /* Ajustes gerais de layout mobile */
    .home-grid {
        grid-template-columns: 1fr;
    }
    .cost-box .value {
        font-size: 60px;
    }
    .content-box h2 {
        font-size: 24px;
    }
    .search-wrapper, .filter-form {
        flex-direction: column;
        align-items: stretch;
    }
    .search-input {
        width: 100%;
        box-sizing: border-box;
    }
}