:root {
    --primary-color: #1a438a;
    /* Receita Federal Dark Blue */
    --secondary-color: #2b5cb5;
    --background-color: #f5f5f5;
    /* Subtle gray background */
    --surface-color: #ffffff;
    --text-color: #333333;
    --text-muted: #666666;
    --border-color: #cccccc;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --sidebar-width: 250px;
    --font-family: 'Roboto', 'Arial', sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
}

.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar Styling - Sober Light Theme */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--surface-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    border-right: 1px solid var(--border-color);
    position: fixed;
    z-index: 100;
}

.sidebar-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 10px;
    border-bottom: 1px solid #eeeeee;
    background-color: #ffffff;
}

.sidebar-logo {
    max-width: 90%;
    /* Let it grow up to 90% of the sidebar width */
    margin: 10px 0;
}

.sidebar-title {
    display: none;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 15px 0;
    flex: 1;
}

.nav-item {
    background: none;
    border: none;
    color: var(--text-color);
    padding: 12px 20px;
    text-align: left;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    border-left: 4px solid transparent;
    font-weight: 500;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-icon {
    width: 20px;
    height: 20px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
    opacity: 1;
}

.nav-item:hover {
    background-color: #f8f9fa;
}

.nav-item.active {
    background-color: #eef2f7;
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #eeeeee;
    background-color: #fafafa;
}

.adsense-sidebar {
    background-color: #ffffff;
    border: 1px solid #dddddd;
    text-align: center;
    padding: 20px 10px;
    margin-bottom: 15px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.copyright {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

/* Main Content Styling */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    background-color: var(--background-color);
}

.mobile-header {
    display: none;
    background-color: var(--primary-color);
    color: white;
    padding: 15px 20px;
    justify-content: space-between;
    align-items: center;
}

.content-wrapper {
    padding: 30px;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

.adsense-placeholder {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    text-align: center;
    padding: 20px;
    margin-bottom: 20px;
    color: var(--text-muted);
}

.disclaimer {
    background-color: #fdfdfd;
    border: 1px solid #e0e0e0;
    color: #555555;
    padding: 15px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    border-left: 4px solid #f0ad4e;
}

.page-section {
    display: none;
    background-color: var(--surface-color);
    padding: 25px 30px;
    border: 1px solid var(--border-color);
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h1,
h2 {
    color: #333333;
    margin-bottom: 20px;
    font-size: 1.4rem;
    border-bottom: 1px solid #eeeeee;
    padding-bottom: 10px;
    font-weight: 400;
}

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

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555555;
}

input[type="text"],
select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cccccc;
    font-size: 1rem;
    font-family: inherit;
    background-color: #ffffff;
    border-radius: 2px;
}

input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.actions {
    margin-top: 20px;
    margin-bottom: 20px;
}

.btn {
    padding: 8px 16px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background-color 0.2s, opacity 0.2s, color 0.2s;
    border-radius: 2px;
}

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

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

.btn-secondary {
    background-color: #f5f5f5;
    color: #333333;
    border-color: #cccccc;
}

.btn-secondary:hover {
    background-color: #e9ecef;
    border-color: #adadad;
}

.result-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 15px;
    background-color: #fafafa;
    padding: 15px;
    border: 1px solid #eeeeee;
    border-radius: 2px;
}

/* History Grid Elements */
.history-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    max-height: 400px;
    overflow-y: auto;
    background-color: #fff;
    border: 1px solid #dddddd;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #ffffff;
    border-bottom: 1px solid #eeeeee;
    padding: 8px 15px;
}

.history-group {
    border-bottom: 1px solid #cccccc;
    background-color: #ffffff;
}

.history-group:last-child {
    border-bottom: none;
}

.history-matriz-row,
.history-filial-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    transition: background-color 0.2s;
}

.history-matriz-row {
    background-color: #ffffff;
    border-bottom: 1px solid #eeeeee;
}

.history-filial-row {
    background-color: #fcfcfc;
    padding-left: 20px;
    border-bottom: 1px solid #eeeeee;
    border-left: 4px solid #5b7bb2;
}

.history-matriz-row:hover,
.history-filial-row:hover,
.history-item:hover {
    background-color: #f1f3f5;
}

.history-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.05rem;
    font-weight: normal;
    color: #333333;
    padding-left: 5px;
}

.history-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.filiais-control-group {
    display: flex;
    align-items: center;
    gap: 5px;
    background-color: transparent;
    padding: 0;
    border: none;
    font-size: 0.85rem;
    font-weight: bold;
    color: #555555;
}

.btn-circle {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid #1a438a;
    background-color: white;
    color: #1a438a;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.btn-circle:hover {
    background-color: #1a438a;
    color: white;
}

.badge {
    padding: 3px 8px;
    border-radius: 2px;
    font-size: 0.70rem;
    font-weight: bold;
    color: white;
}

.badge-matriz {
    background-color: #3b5998;
}

.badge-filial {
    background-color: #6c88b9;
}

.btn-icon-copy {
    background: none;
    border: none;
    cursor: pointer;
    color: #1a438a;
    transition: color 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border-radius: 2px;
}

.btn-icon-copy:hover {
    color: #2b5cb5;
    background-color: #f1f1f1;
}

.btn-icon-copy.success {
    color: var(--success-color);
}

.history-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-limpar {
    background-color: #ffffff;
    color: #dc3545;
    border-color: #dc3545;
}

.btn-limpar:hover {
    background-color: #dc3545;
    color: #ffffff;
}

.resultado-validacao {
    margin-top: 20px;
    padding: 15px;
    border-radius: 2px;
    font-weight: bold;
    display: none;
}

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

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

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar.open {
        transform: translateX(0);
    }

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

    .mobile-header {
        display: flex;
    }

    .history-matriz-row,
    .history-filial-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* Footer Styles */
.site-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    padding: 2rem 1rem;
    margin-top: auto;
    width: 100%;
    color: #555555;
    font-size: 0.9rem;
    text-align: center;
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
}

.footer-disclaimer {
    font-size: 0.8rem;
    color: #777777;
    margin-top: 5px;
    margin-bottom: 15px;
}

.footer-links a {
    color: var(--primary-color);
    text-decoration: none;
    margin: 0 10px;
    font-weight: 500;
}

.footer-links a:hover {
    text-decoration: underline;
}