:root {
    --bg-color: #0f172a;
    --sidebar-bg: #1e293b;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --accent: #38bdf8;
    --accent-hover: #0ea5e9;
    --border: #334155;
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

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

/* Sidebar */
.sidebar {
    width: 300px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.logo h2 {
    color: var(--accent);
    margin-bottom: 2rem;
    font-weight: 600;
}

.file-list-container {
    flex: 1;
    overflow-y: auto;
}

.file-list-container h3 {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#file-list {
    list-style: none;
}

#file-list li {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: background 0.2s, color 0.2s;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
}

#file-list li:hover {
    background-color: rgba(56, 189, 248, 0.1);
    color: var(--accent);
}

#file-list li.active {
    background-color: var(--accent);
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    background: radial-gradient(circle at top right, #1e293b 0%, #0f172a 40%);
}

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

h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

button {
    background-color: var(--accent);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

button:hover {
    background-color: var(--accent-hover);
}

.hidden {
    display: none;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.stat-card h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.stat-card p {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-container {
    height: 400px;
    margin-bottom: 2rem;
    position: relative;
}

/* Table */
.data-table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

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

th {
    color: var(--text-secondary);
    font-weight: 500;
}

td {
    color: var(--text-primary);
}

tr:hover td {
    background-color: rgba(56, 189, 248, 0.1);
    cursor: pointer;
    color: var(--accent);
}

.hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: var(--sidebar-bg);
    border: 1px solid var(--border);
    border-radius: 1rem;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

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

.modal-header h3 {
    margin: 0;
    color: var(--accent);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

#context-list {
    list-style: none;
}

#context-list li {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

#context-list li:last-child {
    border-bottom: none;
}

.context-sentence {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.context-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.highlight {
    background-color: rgba(56, 189, 248, 0.3);
    color: white;
    padding: 2px 4px;
    border-radius: 4px;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.star-icon {
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.star-icon:hover,
.star-icon.saved {
    color: #ffd700;
}

#pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

#pagination-controls button {
    background-color: var(--sidebar-bg);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

#pagination-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#pagination-controls button:hover:not(:disabled) {
    border-color: var(--accent);
}

#view-saved-words {
    font-weight: 600;
    color: #ffd700;
    margin-bottom: 2rem !important;
}