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

:root {
    --primary-color: #e74c3c;
    --secondary-color: #c0392b;
    --accent-color: #f39c12;
    --success-color: #27ae60;
    --warning-color: #e67e22;
    --text-color: #333;
    --light-text: #666;
    --bg-color: #f5f5f5;
    --white: #fff;
    --border-color: #ddd;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    padding: 40px 0;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

header .subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

nav {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav .container {
    display: flex;
    gap: 20px;
}

nav a {
    padding: 15px 25px;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

nav a:hover,
nav a.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

main {
    padding: 40px 0;
}

.filter-section {
    background: var(--white);
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 15px;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-group label {
    font-weight: 500;
    color: var(--light-text);
    white-space: nowrap;
}

select, input[type="text"] {
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

select:focus, input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-box {
    flex: 1;
    min-width: 200px;
}

.search-box input {
    width: 100%;
}

.stats-bar {
    color: var(--light-text);
    font-size: 0.95rem;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.cases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
}

.case-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    cursor: pointer;
}

.case-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.case-header {
    padding: 20px;
    color: var(--white);
    position: relative;
}

.case-header.success {
    background: linear-gradient(135deg, var(--success-color), #2ecc71);
}

.case-header.failure {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.case-header.warning {
    background: linear-gradient(135deg, var(--warning-color), var(--accent-color));
}

.case-badge {
    display: inline-block;
    padding: 5px 15px;
    background: rgba(255,255,255,0.25);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.case-title {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.4;
}

.case-body {
    padding: 20px;
}

.case-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    color: var(--light-text);
}

.meta-label {
    font-weight: 600;
    color: var(--text-color);
}

.case-summary {
    color: var(--light-text);
    font-size: 0.95rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: var(--white);
    margin: 3% auto;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    border-radius: 16px;
    overflow: hidden;
    animation: slideUp 0.3s;
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close {
    color: var(--white);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.close:hover {
    opacity: 1;
}

.modal-header {
    padding: 25px 30px;
    color: var(--white);
    position: relative;
}

.modal-header.success {
    background: linear-gradient(135deg, var(--success-color), #2ecc71);
}

.modal-header.failure {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.modal-header.warning {
    background: linear-gradient(135deg, var(--warning-color), var(--accent-color));
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 10px;
}

.modal-body {
    padding: 30px;
    max-height: calc(85vh - 120px);
    overflow-y: auto;
}

.modal-section {
    margin-bottom: 25px;
}

.modal-section h3 {
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-section h3::before {
    content: '';
    display: block;
    width: 4px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 2px;
}

.modal-section p {
    color: var(--light-text);
    line-height: 1.8;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag {
    display: inline-block;
    padding: 6px 14px;
    background: var(--bg-color);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-color);
}

.summary-page {
    padding-bottom: 60px;
}

.summary-hero {
    text-align: center;
    padding: 40px 0;
}

.summary-hero h2 {
    font-size: 2rem;
    margin-bottom: 15px;
    color: var(--text-color);
}

.summary-hero p {
    color: var(--light-text);
    font-size: 1.1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--white);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.stat-label {
    color: var(--light-text);
    font-size: 0.95rem;
}

.summary-section {
    background: var(--white);
    padding: 35px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.summary-section h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.summary-section h2::before {
    content: '';
    display: block;
    width: 6px;
    height: 28px;
    background: var(--primary-color);
    border-radius: 3px;
}

.principles-list {
    list-style: none;
}

.principles-list li {
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 15px;
}

.principles-list li:last-child {
    border-bottom: none;
}

.principle-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.principle-content h4 {
    font-size: 1.05rem;
    margin-bottom: 5px;
    color: var(--text-color);
}

.principle-content p {
    color: var(--light-text);
    font-size: 0.95rem;
}

.pitfalls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.pitfall-card {
    background: #fff5f5;
    border-left: 4px solid var(--primary-color);
    padding: 20px;
    border-radius: 8px;
}

.pitfall-card h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.05rem;
}

.pitfall-card p {
    color: var(--light-text);
    font-size: 0.95rem;
}

footer {
    background: var(--text-color);
    color: var(--white);
    text-align: center;
    padding: 25px 0;
    margin-top: 60px;
}

footer p {
    opacity: 0.8;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--light-text);
}

.empty-state p {
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }

    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group select {
        width: 100%;
    }

    .cases-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        margin: 5% auto;
        max-height: 90vh;
    }

    .modal-body {
        padding: 20px;
        max-height: calc(90vh - 120px);
    }

    nav .container {
        justify-content: center;
    }
}