/* CSS Reset und Grundstile */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    min-height: 100vh;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
    padding: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.header-content h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-content p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.header-controls {
    display: flex;
    gap: 1rem;
}

/* Button Styles */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #27ae60, #229954);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

/* Toolbar Styles */
.toolbar {
    background: #f8f9fa;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e9ecef;
}

.risk-form {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.risk-form input,
.risk-form select {
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    background: white;
}

.risk-form input:focus,
.risk-form select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

#riskName {
    flex: 1;
    min-width: 250px;
}

/* Main Content */
.main-content {
    padding: 2rem;
}

/* Matrix Styles */
.matrix-container {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.matrix-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.matrix-header h2 {
    color: #2c3e50;
    font-size: 1.8rem;
}

.matrix-legend {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid #333;
}

.legend-low { background: #27ae60; }
.legend-medium { background: #f39c12; }
.legend-high { background: #e67e22; }
.legend-critical { background: #e74c3c; }

/* Matrix Grid */
.matrix-wrapper {
    display: grid;
    grid-template-areas:
        ". x-labels"
        "y-title matrix-area"
        ". x-title";
    grid-template-columns: auto 1fr;
    grid-template-rows: auto 1fr auto;
    gap: 1rem;
    align-items: center;
}

.y-axis-label {
    grid-area: y-title;
    display: flex;
    align-items: center;
    justify-content: center;
}

.axis-title {
    writing-mode: vertical-lr;
    text-orientation: mixed;
    font-weight: bold;
    font-size: 1.1rem;
    color: #2c3e50;
}

.matrix-grid-container {
    grid-area: matrix-area;
    display: grid;
    grid-template-areas:
        "x-labels"
        "matrix-with-y";
    grid-template-rows: auto 1fr;
    gap: 0.5rem;
}

.x-axis-labels {
    grid-area: x-labels;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
}

.x-label, .y-label {
    font-weight: bold;
    font-size: 0.9rem;
    color: #2c3e50;
    text-align: center;
    padding: 0.5rem;
}

.matrix-with-y-labels {
    grid-area: matrix-with-y;
    display: grid;
    grid-template-areas: "y-labels matrix";
    grid-template-columns: auto 1fr;
    gap: 0.5rem;
}

.y-axis-labels {
    grid-area: y-labels;
    display: grid;
    grid-template-rows: repeat(5, 1fr);
    gap: 2px;
}

.y-label {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 80px;
}

.matrix-grid {
    grid-area: matrix;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 2px;
    min-height: 400px;
}

.matrix-cell {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.matrix-cell:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.matrix-cell.risk-low { background: linear-gradient(135deg, #d5f4e6, #27ae60); }
.matrix-cell.risk-medium { background: linear-gradient(135deg, #fdeaa7, #f39c12); }
.matrix-cell.risk-high { background: linear-gradient(135deg, #f8d7da, #e67e22); }
.matrix-cell.risk-critical { background: linear-gradient(135deg, #f5c6cb, #e74c3c); }

.risk-item {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 6px;
    padding: 0.3rem 0.5rem;
    margin: 0.1rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(0, 0, 0, 0.1);
    width: 100%;
    word-break: break-word;
}

.risk-item:hover {
    background: white;
    transform: scale(1.05);
}

.x-axis-title {
    grid-area: x-title;
    text-align: center;
    font-weight: bold;
    font-size: 1.1rem;
    color: #2c3e50;
    margin-top: 1rem;
}

/* List View Styles */
.list-container {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.list-header h2 {
    color: #2c3e50;
    font-size: 1.8rem;
}

.list-stats {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    display: block;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
}

.risk-table-container {
    overflow-x: auto;
}

.risk-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.risk-table th,
.risk-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.risk-table th {
    background: #f8f9fa;
    font-weight: bold;
    color: #2c3e50;
}

.risk-table tbody tr:hover {
    background: #f8f9fa;
}

.risk-level {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.8rem;
    text-align: center;
    color: white;
}

.risk-level.low { background: #27ae60; }
.risk-level.medium { background: #f39c12; }
.risk-level.high { background: #e67e22; }
.risk-level.critical { background: #e74c3c; }

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e9ecef;
}

.modal-header h3 {
    color: #2c3e50;
    font-size: 1.5rem;
}

.close {
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
    transition: color 0.3s ease;
}

.close:hover {
    color: #333;
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid #e9ecef;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .matrix-grid {
        min-height: 350px;
    }

    .matrix-cell {
        min-height: 70px;
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .header-content h1 {
        font-size: 2rem;
    }

    .risk-form {
        flex-direction: column;
    }

    .risk-form input,
    .risk-form select {
        width: 100%;
    }

    .matrix-legend {
        justify-content: center;
    }

    .matrix-grid {
        min-height: 300px;
    }

    .matrix-cell {
        min-height: 60px;
        padding: 0.3rem;
    }

    .y-label, .x-label {
        font-size: 0.8rem;
        padding: 0.3rem;
    }

    .axis-title {
        font-size: 1rem;
    }

    .x-axis-title {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        margin: 0;
        border-radius: 0;
    }

    .main-content {
        padding: 1rem;
    }

    .matrix-container,
    .list-container {
        padding: 1rem;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
    }

    .modal-body,
    .modal-header,
    .modal-footer {
        padding: 1rem;
    }
}

/* Animation für neue Risiken */
.risk-item.new {
    animation: riskFadeIn 0.5s ease;
}

@keyframes riskFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Drag and Drop Styles */
.risk-item.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

.matrix-cell.drag-over {
    border-color: #3498db;
    background: rgba(52, 152, 219, 0.1);
}

/* Accessibility */
.btn:focus,
.risk-form input:focus,
.risk-form select:focus,
.risk-item:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .toolbar,
    .header-controls,
    .modal {
        display: none;
    }

    .container {
        background: white;
        box-shadow: none;
    }

    .matrix-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
