* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1a5490;
    --secondary-color: #2d6ba8;
    --accent-color: #4a90e2;
    --text-primary: #1a1a1a;
    --text-secondary: #666;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --border-color: #ddd;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --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;
    background-color: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Header Styles */
.site-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 2rem 2rem 1.5rem;
    box-shadow: var(--shadow);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
}

.logo-section {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.header-text {
    flex: 1;
}

.site-title {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 0.25rem;
}

.site-subtitle {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 400;
}

.stats-bar {
    display: flex;
    gap: 0.5rem;
    font-size: 0.95rem;
    opacity: 0.95;
}

.stat-item {
    font-weight: 500;
}

.stat-divider {
    opacity: 0.6;
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Search & Filter Section */
.search-filter-section {
    background: var(--bg-white);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.search-bar-container {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-input {
    width: 100%;
    padding: 0.875rem 3rem 0.875rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.clear-search {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
}

.clear-search:hover {
    color: var(--text-primary);
}

/* Filters */
.filters-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.filter-select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.95rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.reset-filters {
    grid-column: 1 / -1;
    padding: 0.5rem 1rem;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    max-width: 200px;
}

.reset-filters:hover {
    background: var(--border-color);
}

/* View Toggle */
.view-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.view-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.view-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.view-btn:not(.active):hover {
    background: var(--bg-light);
}

.results-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

/* Document Cards */
.documents-container.cards-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.document-card {
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    transition: all 0.2s;
    cursor: pointer;
}

.document-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.doc-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.75rem;
}

.doc-code {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-color);
}

.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.active {
    background: #d4edda;
    color: #155724;
}

.status-badge.historical {
    background: #d1ecf1;
    color: #0c5460;
}

.status-badge.superseded {
    background: #f8d7da;
    color: #721c24;
}

.status-badge.draft {
    background: #fff3cd;
    color: #856404;
}

.doc-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.doc-summary {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.doc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-secondary);
}

.meta-label {
    font-weight: 600;
}

.doc-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag-chip {
    padding: 0.25rem 0.5rem;
    background: var(--bg-light);
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.tag-chip:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.office-badges,
.program-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.badge-with-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.6rem;
    background: white;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    border: 1.5px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.2s;
}

.badge-with-logo:hover {
    border-color: var(--accent-color);
    box-shadow: 0 2px 6px rgba(74, 144, 226, 0.15);
    transform: translateY(-1px);
}

.badge-logo {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.detail-badge-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.doc-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.patch-indicator {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.patch-indicator.has-patches {
    color: var(--accent-color);
    font-weight: 600;
}

.doc-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Table View */
.documents-container.table-view {
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.documents-table {
    width: 100%;
    border-collapse: collapse;
}

.documents-table th {
    background: var(--bg-light);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: 0;
}

.documents-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.documents-table tr:hover {
    background: var(--bg-light);
    cursor: pointer;
}

/* Posters View */
.documents-container.posters-view,
.documents-container.rockets-view {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.image-count {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 0.5rem;
}

.posters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 2rem;
}

.poster-item {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
}

.poster-item:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
}

.poster-image-container {
    width: 100%;
    aspect-ratio: 841 / 1189;
    background: var(--bg-light);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.poster-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.poster-info,
.rocket-info {
    padding: 1.5rem;
}

.poster-title,
.rocket-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

.poster-meta,
.rocket-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.meta-badge {
    padding: 0.25rem 0.5rem;
    background: var(--bg-light);
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
}

.meta-badge.era-naca-cx {
    background: #d1ecf1;
    color: #0c5460;
    border-color: #bee5eb;
}

.meta-badge.era-nacx {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.meta-badge.type-ph {
    background: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
}

.poster-description,
.rocket-description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.poster-technical {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Rockets View */
.rockets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
    gap: 2rem;
}

.rocket-item {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
}

.rocket-item:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
}

.rocket-image-container {
    width: 100%;
    aspect-ratio: 4 / 3;
    background: var(--bg-light);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rocket-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rocket-details {
    background: var(--bg-light);
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.detail-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.detail-row:last-child {
    margin-bottom: 0;
}

.detail-row strong {
    min-width: 80px;
    color: var(--text-secondary);
}

.rocket-filename {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.rocket-filename code {
    background: var(--bg-light);
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.8rem;
    font-family: 'Courier New', monospace;
}

/* Schematics View */
.schematics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
    gap: 2rem;
}

.schematic-item {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
}

.schematic-item:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
}

.schematic-image-container {
    width: 100%;
    background: var(--bg-light);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.schematic-image {
    width: 100%;
    height: auto;
    object-fit: contain;
    max-height: 400px;
}

.schematic-info {
    padding: 1.5rem;
}

.schematic-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

.schematic-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.schematic-description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.schematic-details {
    background: var(--bg-light);
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.schematic-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.schematic-filename {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.schematic-filename code {
    background: var(--bg-light);
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.8rem;
    font-family: 'Courier New', monospace;
}

.naming-convention-info {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-top: 2rem;
}

.naming-convention-info h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.naming-convention-info p {
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.naming-convention-info code {
    background: var(--bg-light);
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

.convention-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.convention-item {
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 6px;
    font-size: 0.9rem;
    line-height: 1.6;
}

.convention-item strong {
    display: block;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

/* Image Modal */
.image-modal-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.modal-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.image-modal-info h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.image-modal-info p {
    line-height: 1.6;
    margin-bottom: 1rem;
}

.modal-details {
    background: var(--bg-light);
    padding: 1.5rem;
    border-radius: 6px;
    margin: 1rem 0;
}

.modal-details p {
    margin-bottom: 0.75rem;
}

.modal-details p:last-child {
    margin-bottom: 0;
}

.modal-details code {
    background: white;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* About View */
.documents-container.about-view {
    display: flex;
    justify-content: center;
}

.about-container {
    max-width: 800px;
    width: 100%;
}

.about-header {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    text-align: center;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.about-logo {
    width: 100px;
    height: 100px;
    object-fit: contain;
}

.about-header h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin: 0;
}

.about-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.about-section {
    margin-bottom: 2rem;
}

.about-section:last-of-type {
    margin-bottom: 1rem;
}

.about-section h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.about-section p {
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.about-section p:last-child {
    margin-bottom: 0;
}

.about-section ul {
    margin: 0;
    padding-left: 2rem;
    line-height: 1.8;
}

.about-section li {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.about-footer {
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.about-footer p {
    color: var(--text-secondary);
    margin: 0.5rem 0;
    line-height: 1.6;
}

.about-footer em {
    font-style: italic;
}

/* KSP View */
.documents-container.ksp-view {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.ksp-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.ksp-header {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    text-align: center;
}

.ksp-header h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.ksp-subtitle {
    color: var(--text-secondary);
    font-size: 1.05rem;
}

.ksp-download-card {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 3rem;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(45, 107, 168, 0.3);
}

.ksp-download-content {
    display: flex;
    align-items: center;
    gap: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.ksp-icon-large {
    color: white;
    flex-shrink: 0;
}

.ksp-download-info {
    flex: 1;
    color: white;
}

.ksp-download-info h3 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.ksp-download-info p {
    opacity: 0.9;
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
}

.ksp-download-btn-large {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: white;
    color: var(--primary-color);
    border: none;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.ksp-download-btn-large:hover {
    background: var(--bg-light);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

.ksp-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.ksp-info-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.ksp-info-card h3 {
    font-size: 1.25rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.ksp-info-card ul,
.ksp-info-card ol {
    margin: 0;
    padding-left: 1.5rem;
}

.ksp-info-card li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.ksp-info-card code {
    background: var(--bg-light);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.ksp-preview-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.ksp-preview-section h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.ksp-preview-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.ksp-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1.5rem;
}

.ksp-preview-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.ksp-preview-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
    background: var(--bg-light);
    padding: 0.5rem;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ksp-preview-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

.ksp-preview-grid-large {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 2rem;
    max-width: 600px;
    margin: 0 auto;
}

.ksp-preview-item-large {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.ksp-preview-image-large {
    width: 120px;
    height: 120px;
    object-fit: contain;
    background: var(--bg-light);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.ksp-preview-image-large:hover {
    transform: scale(1.05);
}

.ksp-preview-label-large {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
}

.ksp-note {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 1.5rem;
    border-radius: 6px;
    margin-top: 1rem;
}

.ksp-note p {
    margin: 0;
    color: #856404;
    line-height: 1.6;
}

/* Gallery View */
.documents-container.gallery-view {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.gallery-header {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    text-align: center;
}

.gallery-header h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.gallery-description {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-bottom: 1.5rem;
}

.ksp-download-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    margin-top: 1rem;
}

.ksp-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.75rem;
    background: linear-gradient(135deg, #2d6ba8, #1a5490);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(45, 107, 168, 0.3);
}

.ksp-download-btn:hover {
    background: linear-gradient(135deg, #3a7fc2, #2d6ba8);
    box-shadow: 0 6px 16px rgba(45, 107, 168, 0.4);
    transform: translateY(-2px);
}

.ksp-download-btn:active {
    transform: translateY(0);
}

.ksp-icon {
    width: 24px;
    height: 24px;
}

.ksp-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
}

.gallery-category {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.category-title {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 2rem;
}

.gallery-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.gallery-image-container {
    position: relative;
    width: 150px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.gallery-image-container:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.gallery-image {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.3s;
    padding: 0.5rem;
}

.gallery-image.active {
    opacity: 1;
}

.gallery-item-info {
    text-align: center;
    width: 100%;
}

.gallery-item-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.gallery-item-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.gallery-item-toggle {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.toggle-version,
.download-patch {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.toggle-version:hover,
.download-patch:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Patches View */
.documents-container.patches-view {
    display: grid;
    gap: 1rem;
}

.patch-card {
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.25rem;
    border-left: 4px solid var(--accent-color);
}

.patch-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.5rem;
}

.patch-id {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
}

.patch-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.patch-parent {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.patch-summary {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    padding: 2rem;
    overflow-y: auto;
}

.modal-overlay.active {
    display: flex;
    align-items: start;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    margin: 2rem auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-close {
    position: sticky;
    top: 0;
    right: 0;
    float: right;
    background: white;
    border: none;
    font-size: 2rem;
    padding: 1rem;
    cursor: pointer;
    color: var(--text-secondary);
    z-index: 10;
}

.modal-close:hover {
    color: var(--text-primary);
}

#modal-body {
    padding: 2rem;
    clear: both;
}

.detail-section {
    margin-bottom: 2rem;
}

.detail-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.detail-section h3 {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.detail-value {
    font-size: 1rem;
    color: var(--text-primary);
}

.patch-timeline {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.patch-timeline-item {
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 6px;
    border-left: 3px solid var(--accent-color);
}

.relationship-list {
    list-style: none;
    padding: 0;
}

.relationship-list li {
    padding: 0.5rem;
    background: var(--bg-light);
    margin-bottom: 0.5rem;
    border-radius: 4px;
}

.link-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.link-btn {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.link-btn:hover {
    background: var(--secondary-color);
}

.link-btn:disabled {
    background: var(--border-color);
    cursor: not-allowed;
}

/* Patch Gallery */
.patch-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 8px;
}

.patch-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
}

.patch-image {
    width: 100%;
    max-width: 100px;
    height: 100px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    transition: transform 0.2s;
}

.patch-image:hover {
    transform: scale(1.1);
}

.patch-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.patch-type {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }

    .documents-container.cards-view {
        grid-template-columns: 1fr;
    }

    .filters-container {
        grid-template-columns: 1fr;
    }

    .logo-section {
        gap: 1rem;
    }

    .header-logo {
        width: 60px;
        height: 60px;
    }

    .site-title {
        font-size: 1.75rem;
    }

    .site-subtitle {
        font-size: 0.9rem;
    }

    .modal-overlay {
        padding: 1rem;
    }

    #modal-body {
        padding: 1rem;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1.5rem;
    }

    .gallery-image-container {
        width: 120px;
        height: 120px;
    }

    .gallery-header h2 {
        font-size: 1.5rem;
    }

    .category-title {
        font-size: 1.25rem;
    }

    .ksp-download-btn {
        font-size: 0.9rem;
        padding: 0.75rem 1.5rem;
    }

    .ksp-download-section {
        padding-top: 0.75rem;
        margin-top: 0.75rem;
    }

    .ksp-download-content {
        flex-direction: column;
        text-align: center;
    }

    .ksp-download-card {
        padding: 2rem 1.5rem;
    }

    .ksp-info-grid {
        grid-template-columns: 1fr;
    }

    .ksp-preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
}

/* Loading State */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 1rem;
}
