/* ============================================================
   TFA Lernapp - Component Styles
   ============================================================ */

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0.625rem 1.25rem;
    font-family: var(--font-family);
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1;
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    opacity: 0;
    transition: opacity var(--transition-fast);
}
.btn:hover::after { opacity: 1; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-400));
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-600), var(--success-500));
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}
.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.btn-error {
    background: linear-gradient(135deg, var(--error-600), var(--error-500));
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}
.btn-error:hover {
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.btn-ghost:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color-hover);
}

.btn-outline {
    background: transparent;
    color: var(--primary-400);
    border: 1px solid var(--primary-500);
}
.btn-outline:hover {
    background: rgba(99, 102, 241, 0.1);
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: var(--text-base);
    border-radius: var(--radius-xl);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: var(--text-xs);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-lg);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ---- Cards ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    backdrop-filter: blur(12px);
    transition: all var(--transition-base);
}

.card-hover:hover {
    border-color: var(--border-color-hover);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-glow {
    box-shadow: var(--shadow-glow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.card-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-top: var(--space-xs);
}

/* ---- Inputs ---- */
.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.input-label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

.input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-family: var(--font-family);
    font-size: var(--text-base);
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    outline: none;
}

.input:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.input::placeholder {
    color: var(--text-tertiary);
}

textarea.input {
    min-height: 120px;
    resize: vertical;
    line-height: var(--leading-relaxed);
}

.input-error {
    border-color: var(--error-500) !important;
}

.input-help {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.input-error-msg {
    font-size: var(--text-xs);
    color: var(--error-400);
}

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.2rem 0.6rem;
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    line-height: 1.4;
}

.badge-primary {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-400);
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-400);
}

.badge-error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error-400);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-400);
}

.badge-neutral {
    background: rgba(148, 163, 184, 0.15);
    color: var(--neutral-400);
}

/* ---- Progress Bar ---- */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, var(--primary-600), var(--primary-400));
    transition: width var(--transition-slow);
    animation: progressFill 0.8s ease-out;
}

.progress-bar-fill.success {
    background: linear-gradient(90deg, var(--success-600), var(--success-400));
}

.progress-bar-fill.warning {
    background: linear-gradient(90deg, var(--warning-600), var(--warning-400));
}

.progress-bar-fill.error {
    background: linear-gradient(90deg, var(--error-600), var(--error-400));
}

/* ---- Modal ---- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal-backdrop);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    animation: fadeIn 0.2s ease-out;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl);
    padding: var(--space-xl);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    z-index: var(--z-modal);
    animation: scaleIn 0.25s ease-out;
    box-shadow: var(--shadow-xl);
}

.modal-lg {
    max-width: 900px;
}

.modal-fullscreen {
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    font-size: var(--text-xl);
}
.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    margin-top: var(--space-xl);
}

/* ---- Toast ---- */
.toast-container {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-width: 280px;
    max-width: 420px;
    animation: slideInRight 0.3s ease-out;
    box-shadow: var(--shadow-lg);
}

.toast-success {
    background: var(--success-700);
    color: white;
    border: 1px solid var(--success-600);
}

.toast-error {
    background: var(--error-700);
    color: white;
    border: 1px solid var(--error-600);
}

.toast-info {
    background: var(--primary-700);
    color: white;
    border: 1px solid var(--primary-600);
}

/* ---- Tabs ---- */
.tabs {
    display: flex;
    gap: 2px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    padding: 3px;
}

.tab {
    flex: 1;
    padding: 0.5rem 1rem;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-family);
    text-align: center;
}
.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* ---- Checkbox / Radio ---- */
.option-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
}

.option-item:hover {
    border-color: var(--primary-500);
    background: rgba(99, 102, 241, 0.05);
}

.option-item.selected {
    border-color: var(--primary-500);
    background: rgba(99, 102, 241, 0.1);
}

.option-item.correct {
    border-color: var(--success-500);
    background: rgba(16, 185, 129, 0.1);
}

.option-item.incorrect {
    border-color: var(--error-500);
    background: rgba(239, 68, 68, 0.1);
}

.option-marker {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border: 2px solid var(--neutral-500);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    margin-top: 1px;
}

.option-item.selected .option-marker {
    background: var(--primary-500);
    border-color: var(--primary-500);
    color: white;
}

.option-item.correct .option-marker {
    background: var(--success-500);
    border-color: var(--success-500);
    color: white;
}

.option-item.incorrect .option-marker {
    background: var(--error-500);
    border-color: var(--error-500);
    color: white;
}

.option-text {
    font-size: var(--text-base);
    color: var(--text-primary);
    line-height: var(--leading-relaxed);
}

/* ---- Stat Cards ---- */
.stat-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.stat-value {
    font-size: var(--text-3xl);
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-400), var(--primary-200));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-weight: 500;
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-xl);
    color: var(--text-tertiary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.empty-state-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

/* ---- Loading Skeleton ---- */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-card) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

/* ---- Chip / Filter Tag ---- */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.3rem 0.75rem;
    font-size: var(--text-xs);
    font-weight: 500;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.chip:hover, .chip.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-400);
    border-color: var(--primary-500);
}

/* ---- Divider ---- */
.divider {
    height: 1px;
    background: var(--border-color);
    margin: var(--space-lg) 0;
}

/* ---- Avatar ---- */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-600), var(--primary-400));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: var(--text-sm);
    text-transform: uppercase;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: var(--text-xs);
}

.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: var(--text-xl);
}
