/* Vocabulary Cards System - General Modals */

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--card-border-radius);
    padding: 2rem;
    width: 95%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    animation: modalAppear 0.3s forwards;
}

.modal-content.large {
    max-width: 95vw;
    max-height: 90vh;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin: 1rem;
}

.modal-header-with-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    border-bottom: 2px solid var(--shadow);
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
    flex-shrink: 0;
}

.modal-header-with-actions h2 {
    margin: 0;
    flex: 1;
    padding: 0;
    border: none;
    font-size: 1.4rem;
    color: var(--text-primary);
    font-weight: 600;
}

.modal-header-with-actions .close-modal {
    position: static;
    margin: 0 1rem 0 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    background: var(--bg-primary);
}

.modal-header-with-actions .close-modal:hover {
    background: var(--accent);
    color: white;
    transform: scale(1.1);
}

.header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.header-actions .btn {
    padding: 0.7rem 1.2rem;
    font-size: 0.9rem;
    white-space: nowrap;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.header-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.2);
}

.modal-search-section {
    padding: 1rem 2rem;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--shadow);
}

.search-container {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.2rem;
    z-index: 1;
}

.modal-search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 2px solid var(--shadow);
    border-radius: 12px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.modal-search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
    outline: none;
}

.filter-section h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
}

.filter-buttons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.filter-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    border: 2px solid var(--shadow);
    border-radius: 25px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
}

.filter-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.1);
}

.filter-chip.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.filter-chip .material-symbols-sharp {
    font-size: 1.1rem;
}

.words-selection-section {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.selection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--shadow);
    background: var(--bg-primary);
    flex-shrink: 0;
}

.selection-header h4 {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin: 0;
    font-weight: 600;
}

.selection-controls {
    display: flex;
    gap: 0.5rem;
}

.selection-controls .btn {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    border-radius: 8px;
    font-weight: 500;
}

.words-grid-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    align-content: start;
}

.word-selection-card {
    background: var(--bg-secondary);
    border: 2px solid var(--shadow);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    gap: 0.75rem;
    transition: all 0.3s ease;
    cursor: pointer;
    overflow: hidden;
    min-height: fit-content;
    height: 110px;
}

.word-selection-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.15);
}

.word-selection-checkbox {
    flex-shrink: 0;
    margin-top: 0.25rem;
}

.word-selection-checkbox input[type="checkbox"] {
    display: none;
}

.word-selection-checkbox label {
    width: 20px;
    height: 20px;
    border: 2px solid var(--shadow);
    border-radius: 6px;
    display: block;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.word-selection-checkbox input[type="checkbox"]:checked + label {
    background: var(--accent);
    border-color: var(--accent);
}

.word-selection-checkbox input[type="checkbox"]:checked + label::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.word-selection-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.word-selection-content .greek-word {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.word-selection-content .transliteration {
    font-style: italic;
    color: var(--accent);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    display: block;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.word-selection-content .meaning {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.word-category {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.category-tag {
    display: inline-block;
    background: rgba(74, 144, 226, 0.1);
    color: var(--accent);
    padding: 0.3rem 0.7rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.modal-pagination {
    padding: 1rem 2rem;
    background: var(--bg-primary);
    border-top: 2px solid var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.pagination-buttons {
    display: flex;
    gap: 0.75rem;
}

.pagination-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.2rem;
    border: 2px solid var(--shadow);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.2);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.loading-words, .error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-secondary);
    grid-column: 1 / -1;
    text-align: center;
}

.loading-words .material-symbols-sharp,
.error-state .material-symbols-sharp {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--accent);
    animation: spin 2s linear infinite;
}

.modal-actions {
    padding: 1rem 2rem;
    background: var(--bg-primary);
    border-top: 1px solid var(--shadow);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.modal-actions .btn {
    padding: 0.8rem 1.5rem;
    font-weight: 600;
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.close-modal:hover {
    color: var(--accent);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.form-group input[type="text"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--shadow);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

/* Words Selection Modal */
.words-selection {
    max-height: 400px;
    overflow-y: auto;
    margin: 1.5rem 0;
    border: 1px solid var(--shadow);
    border-radius: 8px;
    padding: 1rem;
}

.search-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.search-filter-toggle {
    padding: 1rem 2rem;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--shadow);
    flex-shrink: 0;
}

.toggle-filters-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--bg-secondary);
    border: 2px solid var(--shadow);
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    width: 100%;
}

.toggle-filters-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.1);
}

.toggle-filters-btn.expanded {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.toggle-filters-btn .material-symbols-sharp {
    transition: transform 0.3s ease;
}

.toggle-filters-btn.expanded .material-symbols-sharp {
    transform: rotate(180deg);
}

.search-filter-content {
    padding: 1.5rem 2rem;
    background: var(--bg-primary);
    border-bottom: 2px solid var(--shadow);
    display: none;
}

/* Remove the modal-actions from large modals since we moved buttons to header */
.modal-content.large .modal-actions {
    display: none;
}

/* Word detail modal */
.word-detail-section {
    margin: 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.detail-row {
    display: flex;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--shadow);
}

.detail-label {
    flex: 0 0 140px;
    font-weight: 600;
    color: var(--accent);
}

.detail-value {
    flex: 1;
    line-height: 1.5;
}

.word-detail-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--shadow);
    display: flex;
    justify-content: space-between;
}

.status-label span {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    color: white;
}

.status-label span.unread {
    background-color: var(--status-unread);
}

.status-label span.reading {
    background-color: var(--status-reading);
}

.status-label span.familiar {
    background-color: var(--status-familiar);
}

.status-label span.memorized {
    background-color: var(--status-memorized);
}

/* Practice Mode */
.modal.fullscreen {
    padding: 0;
    /* z-index: 2 !important; */
    opacity: 100;
}

.practice-container {
    background: var(--bg-secondary);
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    /* z-index: 10001 !important; */ /* Ensure practice container is above everything */
}

.practice-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--shadow);
}

.practice-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.close-practice {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.practice-status {
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-bar-container {
    flex: 1;
    height: 8px;
    background-color: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-text {
    font-weight: 500;
    color: var(--text-secondary);
}

.card-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}
.practice-controls {
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 2px solid var(--shadow);
    background: var(--bg-primary);
    gap: 1rem;
    flex-wrap: wrap;
}

.navigation-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 2px solid var(--shadow);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.nav-btn:hover:not(:disabled) {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: scale(1.1);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.status-controls {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.status-controls .status-btn {
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 120px;
    transition: all 0.3s ease;
}

.status-controls .status-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.keyboard-hints {
    position: absolute;
    top: 1rem;
    right: 5rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.keyboard-hints:hover {
    opacity: 1;
}

.practice-progress {
    padding: 1.5rem 2rem;
    background: var(--bg-primary);
    border-bottom: 2px solid var(--shadow);
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.progress-bar-container {
    flex: 1;
    height: 12px;
    background-color: rgba(74, 144, 226, 0.1);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #3b82f6);
    border-radius: 6px;
    transition: width 0.5s ease;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.progress-text {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.session-stats {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* Mobile improvements */
@media (max-width: 768px) {
    .practice-controls {
        padding: 1.5rem 1rem;
        flex-direction: column;
        gap: 1.5rem;
    }
    .status-controls {
        width: 100%;
        gap: 0.5rem;
    }
    .status-controls .status-btn {
        flex: 1;
        min-width: auto;
        padding: 0.7rem 0.5rem;
        font-size: 0.8rem;
    }
    .status-controls .status-btn span:not(.material-symbols-sharp) {
        display: none;
    }
    .navigation-controls {
        width: 100%;
        justify-content: space-between;
    }
    .keyboard-hints {
        display: none;
    }
}

/* Responsive Styles */
@media (max-width: 900px) {
    .vocab-word-item {
        width: 100%;
    }
    .main-layout {
        flex-direction: column;
    }
    .vocabulary-container {
        padding: 0.5rem;
        margin: 0;
    }
    .sidebar {
        width: 100%;
        max-height: none;
        position: relative;
    }
    .action-bar,
    .list-actions-bar {
        align-items: flex-start;
    }
    .search-filter {
        flex-direction: column;
        width: 100%;
    }
    .search-input {
        width: 100%;
    }
    .words-grid {
        grid-template-columns: 1fr;
    }
    .status-controls {
        flex-wrap: wrap;
    }
    .words-list {
        gap: 1rem;
    }
    .vocab-word-item {
        width: 100% !important;
    }
}

@media (max-width: 600px) {
    .vocabulary-tabs {
        margin: 0;
    }
    .tab {
        padding: 0.5rem 0.5rem;
    }
}

@media (max-width: 768px) {
    .modal-content.large {
        margin: 0.5rem;
        max-width: calc(100vw - 1rem);
        max-height: calc(100vh - 1rem);
        border-radius: 12px;
    }
    .modal-header-with-actions {
        padding: 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .modal-header-with-actions h2 {
        width: 100%;
        margin-bottom: 0.5rem;
        font-size: 1.2rem;
        text-align: center;
    }
    .modal-header-with-actions .close-modal {
        position: absolute;
        top: 1rem;
        right: 1rem;
        width: 32px;
        height: 32px;
    }
    .header-actions {
        width: 100%;
        justify-content: center;
        gap: 0.5rem;
    }
    .header-actions .btn {
        flex: 1;
        max-width: 140px;
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }
    .search-filter-toggle {
        padding: 0.75rem 1rem;
    }
    .search-filter-content {
        padding: 1rem;
    }
    .filter-buttons-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 0.5rem;
    }
    .filter-chip {
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
    }
    .words-grid-container {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 0.75rem;
    }
    .word-selection-card {
        padding: 0.875rem;
    }
    .word-selection-content .greek-word {
        font-size: 1.1rem;
    }
    .word-selection-content .meaning {
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }
    .selection-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
        padding: 1rem;
    }
    .selection-controls {
        width: 100%;
        justify-content: center;
    }
    .modal-pagination {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    .pagination-buttons {
        width: 100%;
        justify-content: space-between;
    }
    .pagination-btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .modal-content.large {
        margin: 0.25rem;
        max-width: calc(100vw - 0.5rem);
        max-height: calc(100vh - 0.5rem);
        border-radius: 8px;
    }
    .filter-buttons-grid {
        grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    }
    .filter-chip {
        padding: 0.5rem 0.6rem;
        font-size: 0.75rem;
    }
    .word-selection-card {
        padding: 0.75rem;
    }
    .header-actions .btn {
        padding: 0.5rem 0.7rem;
        font-size: 0.8rem;
    }
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}