/* Base resets and fonts */
body, html {
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    height: 100vh;
    background-color: #f8fafc;
    color: #1e293b;
    overflow: hidden;
}

#app {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 300px;
    background: white;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    height: 100%;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.filter-section {
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
}

.filter-section select {
    width: 100%;
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-family: inherit;
    margin-top: 5px;
}

.tabs {
    display: flex;
    border-bottom: 1px solid #e2e8f0;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-weight: 500;
    font-family: inherit;
    color: #64748b;
    transition: all 0.2s;
}

.tab-btn.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.category-list, .recent-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-item {
    padding: 10px 20px;
    cursor: pointer;
    font-weight: 500;
}
.category-item:hover { background: #f1f5f9; }

.theme-list {
    list-style: none;
    padding: 0 0 0 20px;
    display: none;
}
.category-item.expanded .theme-list {
    display: block;
}

.theme-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 5px;
    padding: 8px 10px;
    cursor: pointer;
    font-size: 0.95rem;
    color: #475569;
}
.theme-item > span:first-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.theme-badge {
    flex-shrink: 0;
    font-size: 0.7rem;
    color: white;
    background: #eab308;
    padding: 2px 5px;
    border-radius: 12px;
    font-weight: bold;
}
.theme-item:hover {
    background: #f1f5f9;
    border-radius: 4px;
}
.theme-item.active {
    background: #e0e7ff;
    color: #4338ca;
    font-weight: 600;
    border-radius: 4px;
}

.recent-word-item {
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
}
.recent-word-item:hover { background: #f1f5f9; }
.recent-word-item .word-title { font-weight: 500; }
.recent-word-item .word-status { font-size: 0.8rem; margin-top: 4px; }


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

.mobile-header {
    display: none;
    padding: 15px 20px;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    align-items: center;
    gap: 15px;
}
.mobile-header h3 { margin: 0; font-size: 1.1rem; }

.words-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scroll-behavior: smooth;
}

.empty-state {
    text-align: center;
    color: #64748b;
    margin-top: 50px;
}

/* Word Cards & Colors */
.word-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-left: 6px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
}

.word-card.collapsed .word-details {
    display: none;
}

/* Colors based on status */
.word-card[data-status="none"] { border-left-color: #cbd5e1; background: #ffffff; }
.word-card[data-status="opened"] { border-left-color: #f472b6; background: #fdf2f8; } /* Light Pink */
.word-card[data-status="review"] { border-left-color: #eab308; background: #fefce8; } /* Yellow */
.word-card[data-status="fix"] { border-left-color: #ef4444; background: #fef2f2; }    /* Red-ish for fixing */
.word-card[data-status="checked"] { border-left-color: #22c55e; background: #f0fdf4; } /* Green */

.word-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}
.word-header > div:first-child {
    flex: 1;
    min-width: 0;
}
.word-header > div:last-child {
    flex-shrink: 0;
    margin-top: 2px;
}

.word-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.word-translations {
    color: #64748b;
    margin-top: 5px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.word-details {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.detail-section {
    margin-bottom: 15px;
}
.detail-section strong {
    display: block;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 4px;
}

.manager-controls {
    background: rgba(255,255,255,0.5);
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
}

.status-select {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    margin-bottom: 10px;
    font-family: inherit;
    font-weight: 500;
}

.comment-box {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 10px;
}

.action-btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    background: #3b82f6;
    color: white;
}
.edit-db-btn {
    background: #8b5cf6;
    margin-left: 10px;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fff;
    margin: 15% auto;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

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

.form-group {
    margin-bottom: 15px;
}
.form-group label { display: block; margin-bottom: 5px; font-weight: 500; }
.form-group input, .form-group textarea { 
    width: 100%; 
    padding: 8px; 
    border: 1px solid #cbd5e1; 
    border-radius: 4px; 
    box-sizing: border-box; 
    font-family: inherit;
}
.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.save-btn {
    width: 100%;
    padding: 10px;
    background: #22c55e;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
}

.mobile-only-btn { display: none; }

/* Mobile Responsiveness */
/* Comments History */
.comments-history-container {
    max-height: 120px;
    overflow-y: auto;
    margin-bottom: 10px;
    padding: 10px;
    background: #f8fafc;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    transition: max-height 0.3s ease;
}
.comments-history-container.expanded {
    max-height: 600px;
}
.comments-history-container::-webkit-scrollbar {
    width: 6px;
}
.comments-history-container::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 4px;
}

.chat-bubble {
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.9rem;
    max-width: 85%;
    word-break: break-word;
    position: relative;
}

.chat-bubble.manager {
    background: #dbeafe;
    color: #1e3a8a;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.chat-bubble.admin {
    background: #f1f5f9;
    color: #334155;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.chat-bubble .chat-meta {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-bottom: 3px;
    padding-right: 15px;
}

.chat-bubble .delete-comment-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background: none;
    border: none;
    color: #cbd5e1;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px 8px;
    transition: color 0.2s, transform 0.2s;
    z-index: 10;
}
.chat-bubble:hover .delete-comment-btn {
    color: #94a3b8;
}
.chat-bubble .delete-comment-btn:hover {
    color: #ef4444;
    transform: scale(1.2);
}

/* Extended Edit Modal Tabs */
.edit-modal-extended {
    width: 600px;
    max-width: 95%;
}

.edit-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.edit-tab-btn {
    padding: 8px 15px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-weight: 500;
    color: #64748b;
}

.edit-tab-btn.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.edit-tab-content {
    display: none;
}

.edit-tab-content.active {
    display: block;
}

/* Clickable Fields in Word Card */
.clickable-field {
    cursor: pointer;
    border-radius: 4px;
    padding: 2px 4px;
    margin: -2px -4px;
    transition: background 0.2s;
    position: relative;
    word-break: break-word;
}

.clickable-field:hover {
    background: #fef08a;
}

.clickable-field.has-comments {
    background: #fef9c3;
    border-left: 2px solid #eab308;
    padding-left: 6px;
}

.clickable-field.fixed-comments {
    background: #dcfce7;
    border-left: 2px solid #22c55e;
    padding-left: 6px;
}

.clickable-field.question-comments {
    background: #dbeafe;
    border-left: 2px solid #3b82f6;
    padding-left: 6px;
}

@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        width: 100%;
        max-width: 320px;
    }
    
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    
    .mobile-header {
        display: flex;
    }
    
    .mobile-only-btn {
        display: inline-block;
        background: none;
        border: none;
        font-size: 1.2rem;
        cursor: pointer;
    }
    #open-sidebar-btn { font-size: 1rem; padding: 5px 10px; border: 1px solid #cbd5e1; border-radius: 6px; }

    .word-header {
        flex-direction: column-reverse;
    }
    .word-header > div:last-child {
        margin-top: 0;
        margin-bottom: 10px;
        align-self: flex-start;
    }
}
