/* TransCard - Modern CSS Styling */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --background: #f8fafc;
    --surface: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
}

[x-cloak] {
    display: none !important;
}

/* Login Screen */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-card {
    background: var(--surface);
    padding: 3rem;
    border-radius: 1rem;
    box-shadow: 0 20px 60px var(--shadow);
    width: 100%;
    max-width: 400px;
}

.login-card h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
    text-align: center;
}

.subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 2rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* App Container */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    background: var(--surface);
    padding: 1.5rem 2rem;
    box-shadow: 0 2px 8px var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-header h1 {
    color: var(--primary);
    font-size: 1.75rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.username {
    color: var(--text-light);
}

/* Tabs */
.tabs {
    background: var(--surface);
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border);
    flex-wrap: wrap;
}

.active-section-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
}

.section-badge {
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    font-weight: 700;
}

.section-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text);
}

.tab-group {
    display: flex;
    gap: 0.5rem;
}

.tab {
    padding: 1.25rem 1.5rem;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tab:hover:not(:disabled) {
    color: var(--primary);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-back {
    color: var(--secondary);
}

.tab-back:hover {
    color: var(--text);
}

.tab:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.view {
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.view-header h2 {
    font-size: 1.5rem;
    color: var(--text);
}

/* Sections Grid */
.sections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.section-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px var(--shadow);
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.section-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px var(--shadow);
}

.section-card h3 {
    margin-bottom: 0.5rem;
    color: var(--text);
}

.lang-pair {
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.phrase-count {
    color: var(--text-light);
    font-size: 0.9rem;
}

.section-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
}

/* Translation */
.translate-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.translate-input,
.translate-result {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px var(--shadow);
}

.translate-input label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.translate-input textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-family: inherit;
    resize: vertical;
}

.translate-lang-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
}

.translation-text {
    background: var(--background);
    padding: 1rem;
    border-radius: 0.5rem;
    margin: 1rem 0;
    font-size: 1.1rem;
}

/* Phrases List */
.phrases-list {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px var(--shadow);
}

.phrases-list h3 {
    margin-bottom: 1rem;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.phrases-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
    min-width: 600px;
}

.phrases-table th,
.phrases-table td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.phrases-table th {
    font-weight: 600;
    color: var(--text-light);
    background: var(--surface);
    white-space: nowrap;
    border-bottom: 2px solid var(--border);
}

.phrases-table th:last-child {
    text-align: right;
}

.phrases-table td:last-child {
    text-align: right;
    width: 1%;
    white-space: nowrap;
}

.phrases-table tbody tr {
    background: var(--surface);
}

.phrases-table tbody tr:nth-child(even) {
    background: var(--background);
}

.phrases-table tbody tr:hover {
    background: #f1f5f9;
    transition: background 0.3s;
}

.flashcard-meta {
    margin-bottom: 0.5rem;
}

.lang-tag {
    background: var(--secondary);
    color: white;
    padding: 0.1rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.phrase-source {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.phrase-target {
    color: var(--text-light);
}

.phrase-notes {
    font-size: 0.85rem;
    color: var(--secondary);
    font-style: italic;
    margin-top: 0.25rem;
}

.phrase-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.header-tools {
    display: flex;
    gap: 0.5rem;
}

/* Learning */
.learning-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px var(--shadow);
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    display: block;
    color: var(--text-light);
    margin-top: 0.5rem;
}

.learning-start {
    text-align: center;
    padding: 2rem;
}

.learning-modes {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px var(--shadow);
    margin-bottom: 2rem;
}

.learning-modes h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.mode-options {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.mode-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.mode-option input {
    cursor: pointer;
}

/* Flashcard */
.flashcard-container {
    max-width: 600px;
    margin: 2rem auto;
}

.flashcard-progress {
    text-align: center;
    margin-bottom: 1rem;
    color: var(--text-light);
}

.flashcard {
    background: var(--surface);
    border-radius: 1rem;
    box-shadow: 0 4px 16px var(--shadow);
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
}

.flashcard-front,
.flashcard-back {
    text-align: center;
}

.flashcard:not(.flipped) .flashcard-back {
    display: none;
}

.flashcard.flipped .flashcard-front {
    display: none;
}

.flashcard-text {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    line-height: 1.8;
}

.quality-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-top: 2rem;
}

.learning-complete {
    text-align: center;
    padding: 3rem;
    background: var(--surface);
    border-radius: 1rem;
    box-shadow: 0 2px 8px var(--shadow);
}

.learning-complete h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

/* Forms */
.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text);
}

.form-group input,
.form-group textarea {
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

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

.btn-secondary:hover {
    background: #475569;
}

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

.btn-success:hover {
    background: #059669;
}

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

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

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

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

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.25rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    transition: transform 0.2s;
}

.btn-icon:hover {
    transform: scale(1.2);
}

/* 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: var(--surface);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 20px 60px var(--shadow);
    width: 100%;
    max-width: 500px;
}

.modal-content h2 {
    margin-bottom: 1.5rem;
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.checkbox-group {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-group input {
    width: auto;
}

.modal-help {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 1rem;
    background: var(--background);
    padding: 0.5rem;
    border-radius: 0.25rem;
}

/* Utilities */
.empty-state {
    text-align: center;
    color: var(--text-light);
    padding: 3rem;
}

.error-message {
    color: var(--danger);
    text-align: center;
    margin-top: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .translate-container {
        grid-template-columns: 1fr;
    }

    .sections-grid {
        grid-template-columns: 1fr;
    }

    .quality-buttons {
        grid-template-columns: 1fr 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}