/* ===========================================
   SA (Schriftlicher Ausdruck) Assessment System
   Styles for TELC C1 Hochschule Writing Section
   =========================================== */

/* ========== SA TAB BUTTON ========== */
.sa-tab-btn {
    background: linear-gradient(135deg, #111827 0%, #dc2626 55%, #f59e0b 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.sa-tab-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(220, 38, 38, 0.4);
}

/* ========== SA MAIN CONTAINER ========== */
.sa-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.sa-container.hidden {
    display: none;
}

/* Header */
.sa-header {
    text-align: center;
    margin-bottom: 30px;
}

.sa-header h2 {
    font-size: 2rem;
    background: linear-gradient(135deg, #111827 0%, #dc2626 55%, #f59e0b 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.sa-header p {
    color: #6b7280;
    font-size: 1rem;
}

/* ========== TOPIC LIST VIEW ========== */
.sa-topics-view {
    display: block;
}

/* Search and Filter Bar */
.sa-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
    padding: 16px;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
    border-radius: 12px;
    border: 1px solid #fee2e2;
}

.sa-search-input {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border: 2px solid #fee2e2;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.sa-search-input:focus {
    outline: none;
    border-color: #dc2626;
}

.sa-category-select {
    padding: 12px 16px;
    border: 2px solid #fee2e2;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    background: white;
}

/* Progress Bar */
.sa-progress {
    background: white;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

.sa-progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
}

.sa-progress-bar {
    height: 12px;
    background: #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
}

.sa-progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 6px;
    transition: width 0.5s ease;
}

/* Topic Grid */
.sa-topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 16px;
}

/* Topic Card */
.sa-topic-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.sa-topic-card:hover {
    border-color: #dc2626;
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(220, 38, 38, 0.15);
}

.sa-topic-card.has-attempt {
    border-left: 4px solid;
}

.sa-topic-card.score-high {
    border-left-color: #10b981;
}

.sa-topic-card.score-medium {
    border-left-color: #f59e0b;
}

.sa-topic-card.score-low {
    border-left-color: #ef4444;
}

.sa-topic-number {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #f3f4f6;
    color: #6b7280;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.sa-topic-zitat {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.5;
    margin-bottom: 12px;
    padding-right: 50px;
}

.sa-topic-bedeutung {
    font-size: 0.9rem;
    color: #6b7280;
    line-height: 1.5;
    margin-bottom: 12px;
}

.sa-topic-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f3f4f6;
}

.sa-topic-category {
    background: linear-gradient(135deg, #111827 0%, #dc2626 55%, #f59e0b 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.sa-topic-score {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.sa-topic-score.high {
    color: #10b981;
}

.sa-topic-score.medium {
    color: #f59e0b;
}

.sa-topic-score.low {
    color: #ef4444;
}

.sa-topic-score.new {
    color: #9ca3af;
}

/* ========== TOPIC DETAIL VIEW ========== */
.sa-detail-view {
    display: none;
}

.sa-detail-view.active {
    display: block;
}

.sa-back-btn {
    background: #f3f4f6;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    color: #374151;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.sa-back-btn:hover {
    background: #e5e7eb;
}

/* Topic Header in Detail */
.sa-detail-header {
    background: linear-gradient(135deg, #111827 0%, #dc2626 55%, #f59e0b 100%);
    color: white;
    padding: 30px;
    border-radius: 16px;
    margin-bottom: 24px;
}

.sa-detail-zitat {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 16px;
}

.sa-detail-bedeutung {
    font-size: 1rem;
    opacity: 0.9;
    line-height: 1.6;
}

/* Arguments Section */
.sa-arguments {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.sa-arg-box {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #e5e7eb;
}

.sa-arg-box.pro {
    border-color: #d1fae5;
    background: #f0fdf4;
}

.sa-arg-box.contra {
    border-color: #fee2e2;
    background: #fef2f2;
}

.sa-arg-title {
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sa-arg-box.pro .sa-arg-title {
    color: #059669;
}

.sa-arg-box.contra .sa-arg-title {
    color: #dc2626;
}

.sa-arg-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sa-arg-list li {
    padding: 8px 0;
    padding-left: 20px;
    position: relative;
    line-height: 1.5;
    color: #374151;
}

.sa-arg-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    font-weight: bold;
}

.sa-arg-box.pro .sa-arg-list li::before {
    color: #059669;
}

.sa-arg-box.contra .sa-arg-list li::before {
    color: #dc2626;
}

/* Previous Attempts */
.sa-attempts-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid #e5e7eb;
}

.sa-attempts-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: #1f2937;
}

.sa-attempt-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sa-attempt-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.sa-attempt-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sa-attempt-date {
    font-weight: 500;
    color: #374151;
}

.sa-attempt-score {
    font-size: 0.9rem;
    color: #6b7280;
}

.sa-attempt-actions {
    display: flex;
    gap: 8px;
}

.sa-attempt-btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.sa-attempt-btn.view {
    background: #fee2e2;
    color: #991b1b;
}

.sa-attempt-btn.retry {
    background: #dc2626;
    color: white;
}

.sa-attempt-btn:hover {
    transform: translateY(-1px);
}

/* Writing Section */
.sa-write-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #e5e7eb;
}

.sa-write-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: #1f2937;
}

.sa-textarea {
    width: 100%;
    min-height: 400px;
    padding: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    line-height: 1.8;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.sa-textarea:focus {
    outline: none;
    border-color: #dc2626;
}

.sa-write-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f3f4f6;
}

.sa-word-count {
    font-size: 0.95rem;
    color: #6b7280;
}

.sa-word-count.warning {
    color: #f59e0b;
}

.sa-word-count.good {
    color: #10b981;
}

.sa-submit-btn {
    background: linear-gradient(135deg, #111827 0%, #dc2626 55%, #f59e0b 100%);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sa-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(220, 38, 38, 0.4);
}

.sa-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========== RESULTS VIEW ========== */
.sa-results-view {
    display: none;
}

.sa-results-view.active {
    display: block;
}

.sa-results-header {
    text-align: center;
    padding: 30px;
    background: linear-gradient(135deg, #111827 0%, #dc2626 55%, #f59e0b 100%);
    border-radius: 16px;
    color: white;
    margin-bottom: 24px;
}

.sa-total-score {
    font-size: 4rem;
    font-weight: 700;
}

.sa-total-score span {
    font-size: 1.5rem;
    opacity: 0.8;
}

.sa-score-label {
    font-size: 1.2rem;
    margin-top: 8px;
    opacity: 0.9;
}

/* Score Cards */
.sa-scores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.sa-score-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #e5e7eb;
}

.sa-score-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.sa-score-card-title {
    font-weight: 600;
    color: #1f2937;
}

.sa-score-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #dc2626;
}

.sa-score-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.sa-score-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.sa-score-bar-fill.high {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.sa-score-bar-fill.medium {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.sa-score-bar-fill.low {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.sa-score-card-desc {
    font-size: 0.9rem;
    color: #6b7280;
    line-height: 1.5;
}

/* Feedback Section */
.sa-feedback-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid #e5e7eb;
}

.sa-feedback-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sa-feedback-content {
    line-height: 1.8;
    color: #374151;
}

.sa-feedback-content h4 {
    color: #1f2937;
    margin-top: 16px;
    margin-bottom: 8px;
}

.sa-feedback-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.sa-feedback-content li {
    margin-bottom: 6px;
}

.sa-error-item {
    background: #fef2f2;
    border-left: 4px solid #ef4444;
    padding: 12px 16px;
    margin: 8px 0;
    border-radius: 0 8px 8px 0;
}

.sa-error-original {
    color: #dc2626;
    text-decoration: line-through;
}

.sa-error-corrected {
    color: #059669;
    font-weight: 500;
}

.sa-error-explanation {
    font-size: 0.9rem;
    color: #6b7280;
    margin-top: 6px;
}

/* Results Actions */
.sa-results-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.sa-action-btn {
    padding: 14px 28px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.sa-action-btn.primary {
    background: linear-gradient(135deg, #111827 0%, #dc2626 55%, #f59e0b 100%);
    color: white;
}

.sa-action-btn.secondary {
    background: #f3f4f6;
    color: #374151;
}

.sa-action-btn:hover {
    transform: translateY(-2px);
}

/* ========== LOADING STATE ========== */
.sa-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.sa-loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #e5e7eb;
    border-top-color: #dc2626;
    border-radius: 50%;
    animation: sa-spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.sa-loading-text {
    font-size: 1.1rem;
    color: #6b7280;
}

/* ========== EMPTY STATE ========== */
.sa-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.sa-empty-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .sa-filter-bar {
        flex-direction: column;
    }

    .sa-topic-grid {
        grid-template-columns: 1fr;
    }

    .sa-arguments {
        grid-template-columns: 1fr;
    }

    .sa-detail-header {
        padding: 20px;
    }

    .sa-detail-zitat {
        font-size: 1.2rem;
    }

    .sa-total-score {
        font-size: 3rem;
    }

    .sa-write-meta {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .sa-submit-btn {
        justify-content: center;
    }
}

/* Feedback Analysis Cards */
.sa-analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.sa-analysis-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.sa-analysis-card.strengths {
    border-top: 4px solid #10b981;
    background: white;
}

.sa-analysis-card.improvements {
    border-top: 4px solid #f59e0b;
    background: white;
}

.sa-analysis-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sa-analysis-card.strengths .sa-analysis-title {
    color: #059669;
}

.sa-analysis-card.improvements .sa-analysis-title {
    color: #d97706;
}

.sa-analysis-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sa-analysis-list li {
    position: relative;
    padding: 12px 16px 12px 40px;
    margin-bottom: 10px;
    line-height: 1.5;
    color: #374151;
    border-radius: 8px;
    font-size: 0.95rem;
}

.sa-analysis-list li::before {
    position: absolute;
    left: 12px;
    top: 12px;
    font-weight: bold;
    font-size: 1.1rem;
}

.sa-analysis-card.strengths .sa-analysis-list li::before {
    content: "✓";
    color: #10b981;
}

.sa-analysis-card.improvements .sa-analysis-list li::before {
    content: "!";
    color: #f59e0b;
}

.sa-analysis-card.improvements .sa-analysis-list li {
    background: #fffbeb;
    border: 1px solid #fef3c7;
}

.sa-analysis-card.strengths .sa-analysis-list li {
    background: #ecfdf5;
    border: 1px solid #d1fae5;
}

@media (max-width: 768px) {
    .sa-analysis-grid {
        grid-template-columns: 1fr;
    }
}