/* Base Styles */
:root {
    --primary-color: #2c3e50;
    --accent-color: #e74c3c;
    --bg-color: #f9f9f9;
    --text-color: #333;
    --border-color: #ddd;
    --success-color: #27ae60;
    --hover-bg: #f1f1f1;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

/* Navigation */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: white;
    padding: 10px 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-left .logo {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.nav-center .nav-link {
    margin: 0 15px;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
}

.nav-center .nav-link:hover, .nav-center .nav-link.active {
    color: var(--accent-color);
}

.user-switcher {
    position: relative;
    cursor: pointer;
}

.current-user {
    padding: 5px 10px;
    background: var(--primary-color);
    color: white;
    border-radius: 4px;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: white;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    z-index: 1;
    min-width: 120px;
    border-radius: 4px;
}

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

.user-option {
    padding: 10px;
    text-align: center;
}

.user-option:hover {
    background-color: var(--hover-bg);
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn.loading {
    opacity: 0.8;
    cursor: not-allowed;
}

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

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

.secondary-btn {
    background-color: #95a5a6;
    color: white;
}

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

.danger-btn {
    background-color: #c0392b;
    color: white;
}

/* Top Operations Area */
.top-operations {
    margin-bottom: 20px;
    position: relative;
}

.input-area {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.input-area textarea {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    resize: vertical;
}

.floating-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 15px 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 100;
    transition: all 0.3s ease;
}

.floating-bar.hidden {
    bottom: -100px;
    opacity: 0;
    pointer-events: none;
}

/* Data Grid */
.data-grid {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    overflow: hidden;
}

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

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

th {
    background-color: var(--hover-bg);
    font-weight: 600;
}

.col-checkbox { width: 5%; }
.col-word { width: 25%; }
.col-phonetics { width: 15%; }
.col-translation { width: 40%; }
.col-actions { width: 15%; }

td.col-word { font-weight: bold; cursor: pointer; color: var(--primary-color); }
td.col-word:hover { text-decoration: underline; }
td.col-phonetics { color: #7f8c8d; font-style: italic; }
td.col-translation { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Actions */
.row-actions-visible {
    display: flex;
    gap: 15px;
    align-items: center;
}

.action-icon {
    cursor: pointer;
    color: #7f8c8d;
    font-size: 1.1rem;
    transition: color 0.2s, transform 0.1s;
}

.action-icon:hover { transform: scale(1.1); }
.action-icon:hover.master { color: var(--success-color); }
.action-icon:hover.delete { color: var(--accent-color); }

.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    cursor: help;
    vertical-align: middle;
    margin-right: 8px;
}
.status-dot.mastered { background-color: var(--success-color); }
.status-dot.learning { background-color: #f1c40f; } /* Changed to yellow/gold to be more visible than grey */

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

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #7f8c8d;
}

/* Word Modal Details */
#modal-word-title { color: var(--primary-color); margin-bottom: 5px; }
#modal-word-phonetics { color: #7f8c8d; margin-bottom: 20px; font-style: italic; }
#modal-word-explanation { line-height: 1.8; white-space: pre-wrap; }

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-top: 40px;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    min-width: 250px;
    padding: 15px 20px;
    background-color: white;
    color: var(--text-color);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideInRight 0.3s ease forwards;
    border-left: 4px solid var(--primary-color);
}

.toast.success { border-left-color: var(--success-color); }
.toast.error { border-left-color: var(--accent-color); }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}


/* Generate Article Modal Specifics */
.generate-modal-content {
    max-width: 700px;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background-color: var(--hover-bg);
    border-bottom: 1px solid var(--border-color);
}

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

.modal-header .close-btn {
    position: static;
    margin-left: 10px;
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    max-height: calc(90vh - 70px);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--primary-color);
}

.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 15px;
    background-color: var(--hover-bg);
    border-radius: 6px;
    min-height: 50px;
}

/* Prompt Toggle */
.prompt-toggle {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-color);
}

.default-prompt-text {
    background-color: var(--hover-bg);
    padding: 15px;
    border-radius: 6px;
    font-size: 0.95rem;
    color: #555;
    border: 1px solid var(--border-color);
    line-height: 1.5;
}

.tag-pill {
    background-color: white;
    color: var(--primary-color);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
}

.center-actions {
    display: flex;
    justify-content: center;
    margin: 25px 0;
}

.right-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.large-btn {
    padding: 12px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.large-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.result-container {
    margin-top: 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    background-color: #fff;
}

.generated-content {
    line-height: 1.8;
    color: var(--text-color);
}

.generated-content h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

/* Skeleton Loading Animation */
.skeleton-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.skeleton-title, .skeleton-line {
    background: #f0f0f0;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

.skeleton-title {
    height: 28px;
    width: 60%;
    margin-bottom: 10px;
}

.skeleton-line {
    height: 16px;
    width: 100%;
}

.skeleton-line.short {
    width: 80%;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Reading View Specifics */
.reading-container {
    display: flex;
    width: 100%;
    margin: 0;
    padding: 20px;
    position: relative;
    gap: 20px;
    min-height: calc(100vh - 120px);
}

.drawer {
    width: 300px;
    flex-shrink: 0;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border-radius: 8px;
    overflow-y: auto;
    height: calc(100vh - 160px); /* Account for padding */
    position: sticky;
    top: 20px;
}

.drawer-content {
    padding: 20px;
    width: 100%;
}

.drawer-content h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    border-bottom: 2px solid var(--hover-bg);
    padding-bottom: 10px;
    font-size: 1.2rem;
}

.reading-view {
    flex-grow: 1;
    padding: 40px 60px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    max-width: calc(100% - 320px); /* Account for drawer + gap */
}

#reading-title {
    margin-bottom: 30px;
    color: var(--primary-color);
    font-size: 2.2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.reading-content {
    font-size: 1.25rem;
    line-height: 2.2;
    color: var(--text-color);
    max-width: 900px; /* Keep reading width comfortable */
    margin: 0 auto;
}

.vocab-hint {
    border-bottom: 1px dashed var(--accent-color);
    cursor: help;
    position: relative;
    color: var(--primary-color);
    font-weight: 500;
}

.vocab-hint:hover::after, .vocab-hint.show-hint::after {
    content: attr(data-hint);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: normal;
    white-space: nowrap;
    z-index: 10;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 5px;
}

#article-history-list {
    list-style: none;
    margin-top: 10px;
}

#article-history-list li {
    padding: 15px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s;
    border-radius: 4px;
    font-size: 1.05rem;
}

#article-history-list li:hover {
    background-color: var(--hover-bg);
    color: var(--primary-color);
    padding-left: 18px;
}
