:root {
    --bg-color: #0f172a;
    --sidebar-bg: rgba(30, 41, 59, 0.7);
    --card-bg: rgba(30, 41, 59, 0.5);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --border-color: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at top right, rgba(59, 130, 246, 0.15), transparent 40%),
                      radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.1), transparent 40%);
    color: var(--text-primary);
    min-height: 100vh;
}

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
}

.logo h2 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(to right, #3b82f6, #10b981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 3rem;
    text-align: center;
}

nav ul {
    list-style: none;
}

nav ul li a {
    display: block;
    padding: 1rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
    font-weight: 500;
}

nav ul li a:hover, nav ul li a.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent);
    transform: translateX(5px);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 1.5rem 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

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

header h1 {
    font-size: 2rem;
    font-weight: 600;
}

.user-profile {
    background: var(--card-bg);
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

/* Cards */
.kpi-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-shrink: 0;
}

.charts-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: 1fr;
    gap: 1.5rem;
    flex: 1;
    min-height: 0;
}

.card, .chart-card, .upload-area, .result-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chart-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.card h3, .chart-card h3 {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.card p {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Upload Area */
.upload-area {
    text-align: center;
    padding: 4rem 2rem;
}

.upload-area h2 {
    margin-bottom: 1rem;
}

.upload-area p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.btn {
    padding: 0.8rem 2rem;
    border-radius: 8px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.btn.primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
}

input[type="file"] {
    display: block;
    margin: 0 auto 2rem auto;
    color: var(--text-secondary);
}

.status-msg {
    margin-top: 1.5rem;
    font-weight: 500;
}

/* Tables */
.table-container {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    margin-top: 1.5rem;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

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

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

th {
    background: var(--card-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text-secondary);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    color: #a7f3d0;
}

/* ── View Transition ──────────────────────────────────────────────────────── */
.view {
    opacity: 0;
    transition: opacity 0.3s ease;
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
.view.active {
    opacity: 1;
}

/* ── Chart Wrappers ───────────────────────────────────────────────────────── */
.doughnut-wrapper {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}
.doughnut-wrapper canvas {
    max-height: 100% !important;
    width: auto !important;
}

.bar-wrapper {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 0;
}
.bar-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ── Botão Secundário ─────────────────────────────────────────────────────── */
.btn.secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.14);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.25);
}

/* ── Span Edit ────────────────────────────────────────────────────────────── */
.edit-span-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.edit-span-btn:hover {
    background: var(--accent);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* ── Vocabulário ──────────────────────────────────────────────────────────── */
.vocab-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.vocab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 1.5rem;
}

.vocab-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.8rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.vocab-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    border-color: rgba(59, 130, 246, 0.3);
}

.vocab-card-header {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 1.4rem;
}

.vocab-icon {
    font-size: 1.5rem;
    width: 2.8rem;
    height: 2.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.12);
    flex-shrink: 0;
}

.vocab-card-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.vocab-card-header span.vocab-key {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: monospace;
    background: rgba(0,0,0,0.25);
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    margin-left: auto;
}

.vocab-field {
    margin-bottom: 1rem;
}

.vocab-field label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.45rem;
}

.vocab-field textarea,
.vocab-field input[type="text"] {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.25);
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    font-family: 'Inter', sans-serif;
}

.vocab-field textarea:focus,
.vocab-field input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.vocab-card-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    margin-top: 1.2rem;
}

.vocab-save-status {
    font-size: 0.85rem;
    font-weight: 500;
    min-height: 1.2em;
}

.vocab-card .btn.primary {
    padding: 0.6rem 1.4rem;
    font-size: 0.9rem;
}

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    opacity: 1;
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.modal.show .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin: 0;
}

.close-modal {
    color: var(--text-secondary);
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-modal:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

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

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

.form-control {
    width: 100%;
    padding: 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.25);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s ease;
}

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

.checkbox-group {
    display: flex;
    align-items: center;
}

.checkbox-group input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
    accent-color: var(--accent);
    cursor: pointer;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}
