:root {
    --primary-color: #c0392b; /* Dark red sidebar */
    --primary-dark: #a93226;
    --text-main: #333333;
    --text-muted: #777777;
    --bg-main: #f5f5f5;
    --bg-white: #ffffff;
    --border-color: #e0e0e0;
    
    /* Character state colors */
    --state-unknown: #ffffff;
    --state-studying: #a8d5ba; /* Green */
    --state-learned: #f1948a; /* Red/Pink */
}

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

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

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h1 {
    font-size: 24px;
    font-weight: 700;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
}

.nav-section-title {
    font-size: 11px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.6);
    padding: 10px 20px;
    margin-top: 10px;
    letter-spacing: 1px;
}

.nav-item {
    display: block;
    padding: 12px 20px;
    color: white;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s;
}

.nav-item:hover {
    background-color: rgba(255,255,255,0.1);
}

.nav-item.active {
    background-color: var(--primary-dark);
    border-left: 4px solid white;
    padding-left: 16px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.username {
    font-size: 14px;
    font-weight: 500;
}

.logout-link {
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
}

.logout-link:hover {
    color: white;
    text-decoration: underline;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-header {
    background-color: var(--bg-white);
    padding: 15px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

.search-container {
    position: relative;
    width: 300px;
}

#search-input {
    width: 100%;
    padding: 10px 15px;
    padding-right: 40px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 14px;
    outline: none;
}

#search-input:focus {
    border-color: var(--primary-color);
}

.search-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
}

.content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border-left: 4px solid var(--border-color);
}

.stat-card.red { border-left-color: var(--primary-color); }
.stat-card.blue { border-left-color: #3498db; }
.stat-card.orange { border-left-color: #e67e22; }
.stat-card.purple { border-left-color: #9b59b6; }

.stat-title {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
}

/* Progress Bar */
.progress-section {
    background: var(--bg-white);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.progress-bar-bg {
    width: 100%;
    height: 12px;
    background-color: var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--primary-color);
    width: 0%;
    transition: width 0.5s ease-out;
}

/* Character Grid */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.filters {
    display: flex;
    gap: 10px;
}

.filter-btn {
    padding: 6px 15px;
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    border-radius: 15px;
    cursor: pointer;
    font-size: 13px;
}

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

.actions {
    display: flex;
    gap: 10px;
}

.btn-action {
    padding: 6px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: white;
}
.btn-action.studying { background-color: #27ae60; }
.btn-action.learned { background-color: var(--primary-color); }
.btn-action.unknown { background-color: #95a5a6; }

.char-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
}

.char-box {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background-color: var(--state-unknown);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    transition: transform 0.1s;
}

.char-box:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.char-box.state-studying {
    background-color: var(--state-studying);
    border-color: #7ab994;
}

.char-box.state-learned {
    background-color: var(--state-learned);
    border-color: #d8776d;
    color: white;
}

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 300px;
    text-align: center;
    position: relative;
}

.close-modal {
    position: absolute;
    top: 10px; right: 15px;
    font-size: 24px;
    cursor: pointer;
}

.char-large {
    font-size: 80px;
    line-height: 1;
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    padding: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: white;
}
.btn-unknown { background-color: #95a5a6; }
.btn-studying { background-color: #27ae60; }
.btn-learned { background-color: var(--primary-color); }

.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
}

.page-btn {
    padding: 5px 12px;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    border-radius: 4px;
}
.page-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}
