:root {
    --primary: #2196F3;
    --success: #4CAF50;
    --warning: #FFC107;
    --danger: #F44336;
    --accent: #9C27B0;
    --background: #f5f5f5;
    --surface: #ffffff;
    --text-primary: #212121;
    --text-secondary: #757575;
    --border: #e0e0e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    padding-bottom: 80px;
    line-height: 1.6;
}

.app-header {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    padding: 1rem;
    text-align: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.app-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.header-sub {
    margin-top: 0.25rem;
}

.header-privacy-link {
    color: #e3f2fd;
    font-size: 0.9rem;
    text-decoration: underline;
}

.header-privacy-link:hover,
.header-privacy-link:focus {
    text-decoration: none;
}

.app-main {
    padding: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.page-section {
    display: none;
}

.page-section.active {
    display: block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.search-container {
    margin-bottom: 2rem;
}

.search-box {
    display: flex;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
    overflow: hidden;
}

.search-box input {
    flex: 1;
    border: none;
    padding: 1rem;
    font-size: 1rem;
    outline: none;
}

.search-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.search-btn:hover {
    background: #1976D2;
}

.filter-tabs {
    display: flex;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.tab-btn:hover {
    background: rgba(33, 150, 243, 0.1);
}

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

.suggestions {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.suggestions.visible {
    display: block;
}

.suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background-color 0.3s;
}

.suggestion-item:hover {
    background: rgba(33, 150, 243, 0.1);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-code {
    font-weight: 600;
    color: var(--primary);
}

.suggestion-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.results-container {
    min-height: 200px;
}

.code-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1rem;
    position: relative;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.code-info {
    flex: 1;
}

.code-number {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.code-type {
    display: inline-block;
    background: var(--accent);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.code-description {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.code-source, .result-source {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0.25rem 0 0.75rem;
}

.code-source i, .result-source i {
    color: var(--primary);
}

.code-source a, .result-source a {
    color: var(--primary);
    text-decoration: underline;
}

.code-source a:hover, .code-source a:focus,
.result-source a:hover, .result-source a:focus {
    text-decoration: none;
}

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

.action-btn {
    background: none;
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.action-btn.favorited {
    background: var(--warning);
    border-color: var(--warning);
    color: white;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state i {
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.validator-form {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.validate-btn {
    width: 100%;
    background: var(--success);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.validate-btn:hover {
    background: #45a049;
}

.validate-btn:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
}

.form-help {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.validation-result {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-top: 1rem;
    display: none;
}

.validation-result.visible {
    display: block;
}

.result-valid {
    border-left: 4px solid var(--success);
    background: rgba(76, 175, 80, 0.1);
}

.result-invalid {
    border-left: 4px solid var(--danger);
    background: rgba(244, 67, 54, 0.1);
}

.result-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.result-valid .result-icon {
    color: var(--success);
}

.result-invalid .result-icon {
    color: var(--danger);
}

.result-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.result-message {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.export-btn {
    background: var(--success);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.export-btn:hover {
    background: #388E3C;
}

.clear-btn {
    background: var(--danger);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.clear-btn:hover {
    background: #d32f2f;
}

.faq-container {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.faq-item {
    border-bottom: 1px solid var(--border);
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-question {
    width: 100%;
    background: none;
    border: none;
    padding: 1.5rem;
    text-align: left;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-question:hover {
    background: rgba(33, 150, 243, 0.05);
}

.faq-icon {
    font-size: 1.25rem;
    color: var(--primary);
    transition: transform 0.3s;
}

.faq-question[aria-expanded="true"] .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    padding: 0 1.5rem 1.5rem;
    color: var(--text-secondary);
    animation: fadeIn 0.3s ease;
}

.faq-answer[hidden] {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 0.5rem;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.3s;
}

.nav-item:hover {
    background: rgba(33, 150, 243, 0.1);
}

.nav-item.active {
    color: var(--primary);
    background: rgba(33, 150, 243, 0.1);
}

.nav-item i {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.nav-item span {
    font-size: 0.75rem;
    font-weight: 500;
}

footer {
    font-size: 0.9rem;
    color: #1a1919; /* cor do texto */
    text-align: center;
    margin: 20px 0;
    background-color: #d6ddf7;
}

.footer-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 6px;
}
  
  footer .footer-link {
    color: inherit;          /* herda a cor do texto do footer */
    text-decoration: none;   /* remove o sublinhado */
    font-weight: 500;        /* mantém destaque sem parecer link */
    transition: color 0.2s ease;
  }
  
  footer .footer-link:hover,
  footer .footer-link:focus {
    color: #000;             /* muda cor no hover para indicar que é clicável */
  }

@media (min-width: 768px) {
    .app-main {
        padding: 2rem;
    }
    
    .search-box {
        max-width: 600px;
        margin: 0 auto 1rem;
    }
    
    .filter-tabs {
        max-width: 400px;
        margin: 0 auto;
    }
    
    .validator-form {
        max-width: 500px;
        margin: 0 auto 1.5rem;
    }
    
    .bottom-nav {
        max-width: 800px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: var(--radius) var(--radius) 0 0;
    }
}

@media (max-width: 767px) {
    .app-main {
        padding: 0.5rem;
    }
    
    .code-card {
        padding: 1rem;
    }
    
    .code-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .action-btn {
        width: 100%;
    }
    
    .filter-tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        min-width: 80px;
        font-size: 0.9rem;
    }
    
    .search-box input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

@media (max-width: 480px) {
    .app-header h1 {
        font-size: 1.25rem;
    }
    
    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .header-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .export-btn,
    .clear-btn {
        width: 100%;
        justify-content: center;
    }
    
    .validator-form {
        padding: 1rem;
    }
    
    .form-group {
        margin-bottom: 1.5rem;
    }
}

@media (min-width: 1024px) {
    body {
        padding-bottom: 0;
    }
    
    .bottom-nav {
        position: static;
        transform: none;
        border-radius: var(--radius);
        margin: 2rem auto 0;
        max-width: 600px;
    }
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.loading i {
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Nota de privacidade embutida em modais (se houver) */
.privacy-note {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.privacy-note a { text-decoration: underline; }
.privacy-note a:hover, .privacy-note a:focus { text-decoration: none; }
