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

:root {
    --primary-blue: #01426A;
    --medium-blue: #0067A0;
    --dark-green: #007B5F;
    --light-green: #00B388;
    --institutional-yellow: #FFCD00;
    --light-yellow: #FBDB65;

    --bg-light: #f4f7f6;
    --bg-dark: #012a44;
    --bg-card: #ffffff;
    --text-main: #1a202c;
    --text-muted: #4a5568;
    --border-color: #e2e8f0;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', 'Aller', sans-serif;
    background: var(--bg-light);
    color: var(--text-main);
    min-height: 100vh;
}

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

header {
    margin-bottom: 2rem;
}

header h1 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 3rem;
    color: var(--primary-blue);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

header p {
    color: var(--medium-blue);
    font-weight: 500;
}

.glass {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.dashboard-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    padding: 1.5rem;
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-5px);
}

.card h3 {
    margin: 0;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.25rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.card p {
    margin: 0.5rem 0 0 0;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 2rem;
    color: var(--dark-green);
}

.card.highlight p {
    color: var(--primary-blue);
}

.filters-container {
    padding: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

input,
select {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    padding: 0.6rem 1rem;
    color: var(--text-main);
    outline: none;
    transition: all 0.2s;
}

input:focus,
select:focus {
    border-color: var(--medium-blue);
    box-shadow: 0 0 0 3px rgba(0, 103, 160, 0.1);
}

.primary-btn {
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 0.25rem;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s;
}

.primary-btn:hover {
    background: var(--medium-blue);
}

.table-container {
    padding: 1rem;
    overflow-x: auto;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(2px);
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 0.5rem;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: var(--primary-blue);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1rem;
    background: var(--primary-blue);
    color: white;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.1rem;
    letter-spacing: 0.05em;
}

th[data-sort] {
    cursor: pointer;
    position: relative;
    padding-right: 20px;
    user-select: none;
}

th[data-sort]::after {
    content: '';
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: transparent;
    display: none;
}

th[data-sort].sort-asc::after {
    display: block;
    border-bottom-color: white;
    margin-top: -5px;
}

th[data-sort].sort-desc::after {
    display: block;
    border-top-color: white;
    margin-top: 5px;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

tbody tr {
    transition: background-color 0.2s;
}

tr:nth-child(even) {
    background-color: rgba(1, 66, 106, 0.03);
}

tr:hover {
    background-color: rgba(255, 205, 0, 0.05);
}

.name-link {
    color: var(--medium-blue);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.name-link:hover {
    color: var(--primary-blue);
    text-decoration: underline;
}

footer {
    margin-top: 3rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

#btn-dictionary {
    background: white;
    border: 2px solid var(--institutional-yellow);
    color: var(--primary-blue);
    padding: 0.5rem 1.2rem;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.1rem;
    border-radius: 0.25rem;
    cursor: pointer;
    margin-bottom: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

#btn-dictionary:hover {
    background: var(--institutional-yellow);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.help-icon {
    color: var(--institutional-yellow);
    font-weight: bold;
    cursor: help;
}

/* Modal and Dictionary */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(1, 66, 106, 0.85);
    backdrop-filter: blur(4px);
}

.modal-content {
    margin: 5vh auto;
    padding: 2.5rem;
    width: 85%;
    max-width: 90vh;
    max-height: 90vh;
    overflow-y: auto;
}

.close {
    float: right;
    font-size: 1.8rem;
    font-weight: bold;
    cursor: pointer;
    color: var(--primary-blue);
}

.dict-list dt {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.4rem;
    color: var(--primary-blue);
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dict-list dd {
    margin-left: 0;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.5;
}

/* Detail Modal Grid */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.2rem;
    max-height: 60vh;
    overflow-y: auto;
    padding: 1rem;
    margin-top: 1rem;
}

.detail-item {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.detail-item label {
    display: block;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 0.9rem;
    color: var(--medium-blue);
    margin-bottom: 0.2rem;
    text-transform: uppercase;
}

.detail-item span {
    font-weight: 600;
    color: var(--primary-blue);
    font-size: 1rem;
    word-break: break-all;
}

/* Admin Panel Styling */
.admin-panel {
    max-width: 600px;
    margin: 2rem auto;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.admin-form-group {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.8rem;
    display: flex;
    flex-direction: column;
}

.admin-form-group label {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1rem;
    color: var(--medium-blue);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    display: block;
}

.admin-form-group input,
.admin-form-group select {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 0.5rem 0;
    color: var(--primary-blue);
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.2s;
    outline: none;
    width: 100%;
}

.admin-form-group input:focus,
.admin-form-group select:focus {
    border-bottom-color: var(--institutional-yellow);
    box-shadow: none;
}

/* User Dropdown */
.user-menu-container {
    position: relative;
    display: inline-block;
}

.user-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 16px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 140px;
    justify-content: space-between;
}

.user-trigger:hover {
    background: #f8fafc;
    border-color: var(--medium-blue);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.user-trigger span {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--primary-blue);
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    /* Toca a borda do botão */
    padding-top: 8px;
    /* Cria o espaço visual sem perder o hover */
    z-index: 100;
    animation: fadeInSlide 0.2s ease;
}

.dropdown-inner {
    background: white;
    min-width: 160px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.user-menu-container:hover .dropdown-content {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.dropdown-item:hover {
    background: #fff5f5;
    color: #ef4444;
}

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

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