/**
 * CSS Components - Wiederverwendbare UI-Elemente
 * 
 * - Buttons
 * - Cards
 * - Form Elements
 * - Stat Cards
 * - Info Lists
 */

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    text-decoration: none;
}

.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Button Variants */
.btn-primary {
    background: var(--gradient-primary);
    color: var(--text-inverse);
    box-shadow: 0 4px 14px 0 rgba(233, 30, 99, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(233, 30, 99, 0.45);
}

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

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

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--text-inverse);
}

/* Button Sizes */
.btn-sm {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
}

.btn-lg {
    padding: var(--space-md) var(--space-xl);
    font-size: var(--font-size-lg);
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
}

/* Button with Icon */
.btn svg {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
}

/* ========================================
   CARDS
   ======================================== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.card-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
}

.card-title-icon {
    width: 36px;
    height: 36px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-lg);
}

.card-actions {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.card-body {
    padding: var(--space-lg);
}

/* ========================================
   FORM ELEMENTS
   ======================================== */
textarea,
input[type="text"],
input[type="email"],
input[type="search"] {
    width: 100%;
    padding: var(--space-md);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: var(--font-size-base);
    line-height: var(--line-height-relaxed);
    background: var(--bg-input);
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

/* Textarea immer weiß - unabhängig vom Theme */
#textInput {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: #e2e8f0 !important;
}

#textInput::placeholder {
    color: #64748b !important;
}

#textInput:focus {
    border-color: var(--primary) !important;
    box-shadow: var(--shadow-focus);
}

/* Editor Card komplett weiß - unabhängig vom Theme */
#editorCard {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
}

#editorCard .card-header {
    background: #ffffff !important;
    border-bottom-color: #e2e8f0 !important;
}

#editorCard .card-title {
    color: #0f172a !important;
}

#editorCard .card-title-icon {
    background: #f1f5f9 !important;
}

#editorCard .card-body {
    background: #ffffff !important;
}

#editorCard .btn-secondary {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    border-color: #e2e8f0 !important;
}

#editorCard .btn-secondary:hover {
    background: #e2e8f0 !important;
}

#editorCard .btn-danger {
    background: rgba(239, 68, 68, 0.1) !important;
    color: #ef4444 !important;
}

#editorCard .limits-section .info-list-title {
    color: #0f172a !important;
    border-bottom-color: #e2e8f0 !important;
}

#editorCard .limit-item {
    background: #f8fafc !important;
}

#editorCard .limit-name {
    color: #475569 !important;
}

textarea:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="search"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--shadow-focus);
}

textarea::placeholder,
input::placeholder {
    color: var(--text-muted);
}

textarea {
    resize: vertical;
    min-height: 200px;
}

/* ========================================
   STAT CARDS
   ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.stat-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: var(--space-lg);
    text-align: center;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    border: 1px solid transparent;
}

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

.stat-value {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-extrabold);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-xs);
}

.stat-label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: var(--font-weight-medium);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ========================================
   INFO LISTS
   ======================================== */
.info-list {
    margin-top: var(--space-lg);
}

.info-list-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--border-color);
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-light);
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-secondary);
    font-size: var(--font-size-base);
}

.info-value {
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

/* ========================================
   LIMIT INDICATORS
   ======================================== */
.limits-section {
    margin-top: var(--space-lg);
}

.limits-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
}

@media (max-width: 640px) {
    .limits-grid {
        grid-template-columns: 1fr;
    }
}

.limit-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    font-size: var(--font-size-sm);
}

.limit-name {
    color: var(--text-secondary);
}

.limit-value {
    font-weight: var(--font-weight-semibold);
}

.limit-ok {
    color: var(--success);
}

.limit-warn {
    color: var(--warning);
}

.limit-over {
    color: var(--danger);
}

/* ========================================
   KEYWORD ANALYSIS
   ======================================== */
.keyword-section {
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-color);
}

.keyword-input-group {
    display: flex;
    gap: var(--space-sm);
}

.keyword-input-group input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
}

.keyword-result {
    margin-top: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    display: none;
}

.keyword-result.visible {
    display: block;
}

.density-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: var(--radius-full);
    margin-top: var(--space-sm);
    overflow: hidden;
}

.density-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width var(--transition-normal) var(--ease-out);
}

.density-hint {
    font-size: var(--font-size-sm);
    margin-top: var(--space-sm);
}

.density-good {
    color: var(--success);
}

.density-warning {
    color: var(--warning);
}

.density-high {
    color: var(--danger);
}
