/* Modern Design System - verbalbeurteilungen.de */

/* CSS Variables for consistent theming - Modern Pastel Palette */
:root {
    /* Primary colors - Soft purple/lavender tones */
    --color-primary: #8b7ec8;
    --color-primary-dark: #6b5ca5;
    --color-primary-light: #e8e5f6;
    --color-primary-lighter: #f3f1fa;
    
    /* Accent colors - Soft coral/peach */
    --color-accent: #f5a99d;
    --color-accent-light: #ffd4cc;
    
    /* Semantic colors with pastel touch */
    --color-success: #81c995;
    --color-warning: #f7c982;
    --color-error: #f5a3a3;
    
    /* Background colors - Warm pastels */
    --color-bg: #faf9fc;
    --color-bg-secondary: #f5f3f9;
    --color-bg-accent: #fef6f4;
    
    /* Surface colors */
    --color-surface: #ffffff;
    --color-surface-secondary: #f9f7fc;
    
    /* Text colors */
    --color-text: #3d3d4e;
    --color-text-muted: #6b6b7b;
    
    /* Border colors */
    --color-border: #e8e5f0;
    --color-border-light: #f0edf5;
    
    /* Shadows - softer and colored */
    --shadow-sm: 0 1px 3px 0 rgb(139 126 200 / 0.1);
    --shadow: 0 2px 6px 0 rgb(139 126 200 / 0.15);
    --shadow-md: 0 4px 12px 0 rgb(139 126 200 / 0.15);
    --shadow-lg: 0 10px 24px 0 rgb(139 126 200 / 0.2);
    
    /* Layout */
    --radius: 10px;
    --radius-lg: 16px;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.5;
    color: var(--color-text);
    background: linear-gradient(135deg, var(--color-bg) 0%, var(--color-bg-secondary) 50%, var(--color-primary-lighter) 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-primary-lighter) 100%);
    border-radius: var(--radius-lg);
    padding: 24px 32px;
    box-shadow: var(--shadow);
    margin-bottom: 32px;
    border: 1px solid var(--color-border-light);
}

header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 4px;
}

header p {
    color: var(--color-text-muted);
    font-size: 16px;
}

header > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
}

/* Main Content */
main {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow);
    border: 1px solid var(--color-border-light);
}

/* Section Styling */
.basic-info, .assessment-section, .notes-section, .settings-section {
    margin-bottom: 48px;
}

.basic-info h2, .assessment-section h2, .notes-section h2, .settings-section h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--color-border);
}

/* Form Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 15px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

/* Section Hint */
.section-hint {
    color: var(--color-text-muted);
    font-size: 15px;
    text-align: center;
    margin-bottom: 24px;
}

/* Assessment Container */
.assessment-container {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 32px;
    align-items: start;
}

/* Categories Grid */
.categories-simple {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* Category Cards */
.category-card {
    background: linear-gradient(135deg, var(--color-surface-secondary) 0%, var(--color-primary-lighter) 100%);
    border: 2px solid var(--color-border-light);
    border-radius: var(--radius);
    padding: 16px;
    transition: all 0.2s;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.category-card:hover {
    border-color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.category-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.category-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.category-card label {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    line-height: 1.4;
}

.category-select {
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    cursor: pointer;
}

/* Student Profile Sidebar */
.student-profile {
    background: linear-gradient(135deg, var(--color-bg-accent) 0%, var(--color-accent-light) 50%, var(--color-primary-lighter) 100%);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    box-shadow: var(--shadow-md);
}

.profile-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
}

.profile-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 4px;
}

.profile-subtitle {
    font-size: 14px;
    color: var(--color-text-muted);
}

.profile-basic-info {
    margin-bottom: 24px;
}

.profile-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
}

.profile-label {
    color: var(--color-text-muted);
}

.profile-value {
    color: var(--color-primary);
    font-weight: 500;
}

.profile-categories h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 16px;
    text-align: center;
}

.profile-selections {
    max-height: 400px;
    overflow-y: auto;
}

.empty-state {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 14px;
    font-style: italic;
    padding: 24px 0;
}

.selection-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 8px;
    box-shadow: var(--shadow-sm);
}

.selection-category {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.selection-rating {
    font-size: 14px;
    color: var(--color-primary);
    font-weight: 500;
    margin-bottom: 4px;
}

.selection-description {
    font-size: 12px;
    color: var(--color-text-muted);
    line-height: 1.4;
}

/* Settings Section */
.settings-section {
    background: var(--color-bg-secondary);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--color-border-light);
    transition: all 0.3s ease;
    margin-bottom: 24px;
}

.settings-toggle-container {
    text-align: center;
    margin-bottom: 24px;
}

.settings-toggle-btn {
    background: var(--color-surface);
    border: 1px dashed var(--color-border);
    padding: 12px 24px;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.settings-toggle-btn:hover {
    background: var(--color-bg-secondary);
    border-color: var(--color-primary);
    border-style: solid;
}

.settings-header {
    position: relative;
}

.settings-toggle {
    font-size: 18px;
    transition: transform 0.2s;
    color: var(--color-primary);
}

.length-preset-select {
    width: 100%;
    padding: 10px 14px;
    font-size: 15px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    transition: all 0.2s;
}

.length-preset-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

#currentLimitsDisplay {
    padding: 8px 12px;
    background: var(--color-primary-lighter);
    border-radius: var(--radius);
    border: 1px solid var(--color-primary-light);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    border: 1px solid var(--color-primary-dark);
}

.btn-primary:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--color-accent) 0%, #e89c90 100%);
    color: white;
    border: 1px solid #e89c90;
}

.btn-secondary:hover {
    background: #111827;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.btn-outline:hover {
    background: var(--color-bg);
    color: var(--color-text);
    border-color: var(--color-text-muted);
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--color-border);
}

/* Result Section */
.result-section {
    margin-top: 48px;
    padding: 32px;
    background: linear-gradient(135deg, var(--color-surface-secondary) 0%, var(--color-accent-light) 100%);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-md);
}

.result-section h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 24px;
}

.assessment-display {
    background: var(--color-surface);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    font-size: 15px;
    line-height: 1.7;
    white-space: pre-wrap;
    min-height: 150px;
    box-shadow: var(--shadow-sm);
}

.result-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 24px;
}

/* Character Info */
.char-info {
    margin-top: 12px;
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    text-align: right;
}

.char-info.success {
    background: var(--color-success);
    color: white;
    opacity: 0.9;
}

.char-info.error {
    background: var(--color-error);
    color: white;
    opacity: 0.9;
}

/* Warning Info */
.warning-info {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: var(--radius);
    padding: 12px 16px;
    margin: 12px 0;
    font-size: 14px;
}

.warning-header {
    font-weight: 600;
    color: #92400e;
    margin-bottom: 4px;
}

.warning-message {
    color: #92400e;
    margin-bottom: 8px;
}

.warning-details {
    font-size: 13px;
    color: #78350f;
}

/* Alerts */
.error, .success {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 15px;
}

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

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

/* Loading Animation */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--color-white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Footer */
footer {
    text-align: center;
    margin-top: 48px;
    padding: 24px;
    color: var(--color-text-muted);
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .assessment-container {
        grid-template-columns: 1fr 340px;
    }
}

@media (max-width: 1024px) {
    .container {
        padding: 16px;
    }
    
    .assessment-container {
        grid-template-columns: 1fr;
    }
    
    .student-profile {
        position: static;
        max-height: none;
        order: -1;
        margin-bottom: 24px;
    }
    
    .categories-simple {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 768px) {
    header > div {
        flex-direction: column;
        gap: 16px;
    }
    
    header h1 {
        font-size: 24px;
    }
    
    main {
        padding: 24px;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .categories-simple {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .result-actions {
        flex-direction: column;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

/* Form Validation Styles */
.field-valid {
    border-color: var(--color-success) !important;
    box-shadow: 0 0 0 3px rgba(129, 201, 149, 0.2) !important;
}

.field-invalid {
    border-color: var(--color-error) !important;
    box-shadow: 0 0 0 3px rgba(245, 163, 163, 0.2) !important;
}

.field-feedback {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 500;
}

.field-feedback-error {
    color: var(--color-error);
}

.field-feedback-success {
    color: var(--color-success);
}

/* Character Counter */
.character-counter {
    font-size: 12px;
    color: var(--color-text-muted);
    text-align: right;
    margin-top: 4px;
    transition: color 0.2s;
}


/* Section Completion Badges */
.section-completion-badge {
    margin-left: 12px;
    font-size: 16px;
    color: var(--color-border);
    transition: all 0.3s ease;
}

/* Auto-Save Indicator */
.auto-save-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--color-primary);
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    transform: translateY(-100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Loading States */
.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius);
    padding: 12px 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
    max-width: 350px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    pointer-events: auto;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.success {
    border-left: 4px solid var(--color-success);
}

.toast.error {
    border-left: 4px solid var(--color-error);
}

.toast.warning {
    border-left: 4px solid var(--color-warning);
}

.toast.info {
    border-left: 4px solid var(--color-primary);
}

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.toast-content {
    flex-grow: 1;
}

.toast-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 2px;
}

.toast-message {
    font-size: 13px;
    color: var(--color-text-muted);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 2px;
    font-size: 16px;
    line-height: 1;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.toast-close:hover {
    background: var(--color-border);
    color: var(--color-text);
}

/* Enhanced Loading Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading-pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Better Form Focus States */
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
    transform: translateY(-1px);
}

/* Improved Button States */
.btn:active {
    transform: translateY(1px);
}

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

/* Mobile Responsive Enhancements */
@media (max-width: 640px) {
    .auto-save-indicator {
        right: 10px;
        top: 10px;
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .toast-container {
        right: 10px;
        top: 10px;
        left: 10px;
    }
    
    .toast {
        min-width: auto;
        max-width: none;
    }
    
}

/* Focus Visible for Accessibility */
:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
    border-radius: var(--radius);
}

/* Subject Modal Styles */
.subject-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(3px);
    animation: modalFadeIn 0.3s ease-out;
}

.subject-modal {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 580px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-border-light);
    animation: modalSlideIn 0.3s ease-out;
}

.subject-modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--color-border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--color-primary-lighter) 0%, var(--color-surface) 100%);
}

.subject-modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.modal-close-btn:hover {
    background: var(--color-error);
    color: white;
    transform: rotate(90deg);
}

.subject-modal-content {
    padding: 24px;
    max-height: calc(80vh - 100px);
    overflow-y: auto;
}

.modal-subtitle {
    color: var(--color-text-muted);
    margin-bottom: 20px;
    text-align: center;
    font-size: 14px;
}

.subject-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.subject-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border: 2px solid var(--color-border-light);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    background: var(--color-surface);
    position: relative;
}

.subject-option:hover:not(.current) {
    border-color: var(--color-primary);
    background: var(--color-primary-lighter);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.subject-option.current {
    border-color: var(--color-success);
    background: linear-gradient(135deg, var(--color-success) 0%, #6cb076 100%);
    color: white;
    cursor: default;
}

.subject-option.current .subject-option-desc {
    color: rgba(255, 255, 255, 0.9);
}

.subject-option-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.subject-option-info {
    flex-grow: 1;
}

.subject-option-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.subject-option-desc {
    font-size: 13px;
    color: var(--color-text-muted);
    line-height: 1.4;
}

.current-indicator {
    font-size: 14px;
    font-weight: 600;
    color: white;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: var(--radius);
    font-size: 12px;
}

/* Modal Animations */
@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes modalSlideOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
}

/* Subject Selector Button */
.subject-switch-btn {
    position: relative;
}

/* Mobile Responsive for Modal */
@media (max-width: 640px) {
    .subject-modal {
        width: 95%;
        max-height: 85vh;
    }
    
    .subject-modal-header {
        padding: 20px 20px 16px;
    }
    
    .subject-modal-content {
        padding: 20px;
    }
    
    .subject-option {
        padding: 14px;
        gap: 12px;
    }
    
    .subject-option-icon {
        font-size: 24px;
    }
    
    .subject-option-name {
        font-size: 15px;
    }
    
    .subject-option-desc {
        font-size: 12px;
    }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .btn, .form-actions, .result-actions, header > div > div:last-child {
        display: none;
    }
    
    .assessment-display {
        border: none;
        padding: 0;
    }
}