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

:root {
    --primary-color: #4361ee;
    --primary-dark: #3a56d4;
    --secondary-color: #7209b7;
    --success-color: #4cc9f0;
    --danger-color: #f72585;
    --warning-color: #f8961e;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --gray-color: #6c757d;
    --border-color: #dee2e6;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    min-height: 100vh;
    align-items: start;
}

/* Dokument-Panel */
.document-panel {
    background: white;
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.document-title {
    font-size: 2.2em;
    margin-bottom: 30px;
    color: var(--dark-color);
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 15px;
    word-break: break-word;
}

/* Absätze */
.paragraph {
    margin-bottom: 40px;
    padding: 25px;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    border-left: 5px solid var(--primary-color);
    transition: all 0.3s ease;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.paragraph:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.paragraph-number {
    position: absolute;
    top: -15px;
    left: 20px;
    background: var(--primary-color);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2em;
}

.paragraph-content {
    font-size: 1.1em;
    line-height: 1.8;
    color: var(--dark-color);
    margin-bottom: 20px;
    white-space: pre-wrap;
}

.paragraph-content p {
    margin-bottom: 1em;
}

/* Kommentar-Panel */
.comments-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-size: 1em;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(67, 97, 238, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(72, 187, 120, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #f72585 0%, #b5179e 100%);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(247, 37, 133, 0.3);
}

/* Formulare */
.comment-form {
    margin-top: 20px;
    padding: 25px;
    background: white;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border-color);
    display: none;
    animation: slideDown 0.3s ease;
}

.comment-form.active {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--dark-color);
    font-weight: 600;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1em;
    font-family: inherit;
    transition: all 0.3s ease;
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

/* Kommentare */
.comments-title {
    font-size: 1.5em;
    margin-bottom: 20px;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.comment-item {
    background: white;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: var(--radius-sm);
    border-left: 4px solid #4cc9f0;
    box-shadow: var(--shadow);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.comment-author {
    font-weight: bold;
    color: var(--dark-color);
}

.comment-author.anonymous {
    color: var(--gray-color);
    font-style: italic;
}

.comment-time {
    font-size: 0.85em;
    color: var(--gray-color);
    white-space: nowrap;
}

.comment-content {
    color: var(--dark-color);
    line-height: 1.6;
    white-space: pre-wrap;
}

.comment-content a {
    color: var(--primary-color);
    text-decoration: none;
    word-break: break-all;
}

.comment-content a:hover {
    text-decoration: underline;
}

.no-comments {
    text-align: center;
    color: var(--gray-color);
    padding: 40px 20px;
    font-style: italic;
}

/* Loading & Error */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--primary-color);
    font-size: 1.2em;
}

.error {
    background: #fed7d7;
    color: #c53030;
    padding: 20px;
    border-radius: var(--radius-sm);
    margin: 20px 0;
    text-align: center;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: slideIn 0.3s ease;
    max-width: 400px;
    word-wrap: break-word;
}

.notification.success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.notification.error {
    background: linear-gradient(135deg, #f72585 0%, #b5179e 100%);
    color: white;
}

.notification.warning {
    background: linear-gradient(135deg, #f8961e 0%, #f3722c 100%);
    color: white;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Mobile Optimierungen */
@media (max-width: 1200px) {
    .container {
        grid-template-columns: 3fr 2fr;
        gap: 20px;
        padding: 15px;
    }
    
    .document-panel,
    .comments-panel {
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 10px;
    }
    
    .comments-panel {
        position: static;
        max-height: none;
        order: -1;
    }
    
    .document-title {
        font-size: 1.8em;
        margin-bottom: 20px;
    }
    
    .paragraph {
        padding: 20px;
        margin-bottom: 30px;
    }
    
    .paragraph-number {
        width: 35px;
        height: 35px;
        font-size: 1em;
        top: -12px;
        left: 15px;
    }
    
    .paragraph-content {
        font-size: 1em;
        line-height: 1.7;
    }
    
    .comment-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .comment-time {
        font-size: 0.8em;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
    }
    
    .comment-form {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .document-title {
        font-size: 1.6em;
    }
    
    .paragraph {
        padding: 15px;
    }
    
    .paragraph-content {
        font-size: 0.95em;
    }
    
    .comments-panel {
        padding: 15px;
    }
    
    .comment-item {
        padding: 15px;
    }
    
    .notification {
        left: 10px;
        right: 10px;
        max-width: none;
    }
}

/* Druckoptimierungen */
@media print {
    body {
        background: white !important;
    }
    
    .container {
        grid-template-columns: 1fr;
        gap: 0;
        padding: 0;
    }
    
    .comments-panel,
    .comment-btn,
    .comment-form {
        display: none !important;
    }
    
    .document-panel {
        box-shadow: none;
        padding: 0;
    }
    
    .paragraph {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}