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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
}

/* Header */
.main-header {
    background: #fff;
    padding: 1.25rem 2rem;
    border-bottom: 1px solid #e0e0e0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.header-info .back-link {
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

.header-info .back-link:hover {
    color: #2c3e50;
}

.header-info .detail-title {
    font-size: 1.5rem;
    color: #2c3e50;
    font-weight: 700;
    margin: 0;
}

.header-info .detail-subtitle {
    color: #999;
    font-size: 1rem;
    margin: 0;
}

.header-info .detail-field {
    color: #666;
    font-size: 0.9rem;
    padding: 0.25rem 0.75rem;
    background: #f8f8f8;
    border-radius: 12px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.header-actions .view-toggle {
    display: flex;
    gap: 0.4rem;
}

.header-actions .toggle-btn {
    padding: 0.4rem 0.7rem;
    background: #f8f8f8;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.82rem;
    border: none;
    border-radius: 4px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.header-actions .toggle-icon {
    flex-shrink: 0;
    display: block;
}

.header-actions .toggle-text {
    display: inline;
}

.header-actions .toggle-btn:hover {
    background: #e0e0e0;
}

.header-actions .toggle-btn.active {
    background: #2c3e50;
    color: #fff;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    padding: 0.4rem;
    cursor: pointer;
    color: #2c3e50;
    transition: all 0.2s;
    border-radius: 4px;
    flex-shrink: 0;
}

.mobile-menu-btn:hover {
    background: #f8f9fa;
}

.mobile-menu-btn:active {
    transform: scale(0.95);
}

/* Desktop Main Navigation - Default Styles */
.main-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

/* Show hamburger menu on mobile devices */
@media (max-width: 1024px) {
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .main-nav {
        display: none;
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.6rem;
        background: #fff;
        border: 1px solid #e9ecef;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        position: absolute;
        top: calc(100% + 0.4rem);
        right: 0;
        min-width: 200px;
        z-index: 100;
        margin-left: 0;
    }

    .main-nav.active {
        display: flex;
    }

    .search-form {
        width: 100%;
        order: 1;
    }

    .search-input {
        width: 100%;
    }

    .nav-link {
        width: 100%;
        justify-content: center;
        order: 2;
    }

    .user-info {
        order: 3;
        width: 100%;
        text-align: center;
        background: #f8f9fa;
        padding: 0.5rem;
        border-radius: 4px;
    }

    .header-actions {
        display: flex;
    }
}

.header-info .site-title {
    font-size: 1.5rem;
    color: #2c3e50;
    font-weight: 700;
    margin: 0;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
}

.header-info .site-title:hover {
    color: #3498db;
}

.header-info .page-title {
    font-size: 1.5rem;
    color: #2c3e50;
    font-weight: 700;
    margin: 0;
}

.detail-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f0f0f0;
}

.detail-header .detail-title {
    font-size: 2rem;
    color: #2c3e50;
    font-weight: 700;
    margin: 0;
}

.detail-navigation {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nav-btn {
    flex: 1;
    min-width: 100px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.nav-btn:not([disabled]):hover {
    background: #e9ecef;
    border-color: #dee2e6;
    transform: translateY(-1px);
}

.nav-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.detail-header .detail-subtitle {
    color: #999;
    font-size: 1.1rem;
    margin: 0;
}

.detail-header .back-link {
    color: #3498db;
    text-decoration: none;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    margin-top: 0.5rem;
}

.detail-header .back-link:hover {
    color: #2980b9;
    text-decoration: underline;
}

.search-form {
    display: flex;
    align-items: center;
}

.search-input {
    padding: 0.6rem 1.2rem;
    background: #f8f9fa;
    color: #2c3e50;
    font-size: 0.9rem;
    border: 1px solid #e9ecef;
    border-radius: 24px;
    width: 240px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.search-input:focus {
    outline: none;
    background: #fff;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15), 0 2px 8px rgba(52, 152, 219, 0.2);
    width: 280px;
}

.search-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

.search-input:hover:not(:focus) {
    border-color: #cbd5e1;
    background: #fff;
}

.nav-link {
    color: #666;
    text-decoration: none;
    padding: 0.5rem 1rem;
    transition: color 0.2s;
}

.nav-link:hover {
    color: #2c3e50;
}

.user-info {
    color: #666;
    font-weight: 500;
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem 2rem 2rem;
    min-height: calc(100vh - 200px);
}

/* Field Filter Bar */
.field-filter-bar {
    margin-bottom: 0.75rem;
    padding-bottom: 0.25rem;
}

.field-filter-container {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.1rem 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #d0d0d0 transparent;
}

.field-filter-container::-webkit-scrollbar {
    height: 4px;
}

.field-filter-container::-webkit-scrollbar-track {
    background: transparent;
}

.field-filter-container::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 2px;
}

.field-filter-container::-webkit-scrollbar-thumb:hover {
    background: #b0b0b0;
}

.field-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: #f8f8f8;
    color: #666;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 20px;
    white-space: nowrap;
    transition: all 0.2s ease;
    border: 1px solid #e0e0e0;
}

.field-chip:hover {
    background: #e8e8e8;
    color: #2c3e50;
    border-color: #d0d0d0;
}

.field-chip.active {
    background: #2c3e50;
    color: #fff;
    border-color: #2c3e50;
}

.field-chip.active:hover {
    background: #34495e;
    border-color: #34495e;
}


/* Card Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.75rem;
}

.card-grid.masonry-grid {
    display: block;
    column-count: 3;
    column-gap: 1.75rem;
}

.card-grid.masonry-grid .masonry-item {
    display: inline-flex;
    width: 100%;
    margin: 0 0 1.75rem;
    break-inside: avoid;
}

.card {
    background: linear-gradient(180deg, #ffffff 0%, #fcfcfc 100%);
    border-radius: 12px;
    border: 1px solid #ececec;
    overflow: visible;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    display: flex;
    flex-direction: column;
}

.card-link {
    text-decoration: none;
    color: inherit;
}

.card-link:focus-visible {
    outline: 3px solid #3e6d8f;
    outline-offset: 4px;
}

.card:hover {
    transform: translateY(-6px);
    border-color: #d6e0ea;
    box-shadow: 0 12px 24px rgba(44, 62, 80, 0.12);
}

.card-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #f3f5f7;
    border-radius: 12px 12px 0 0;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.card:hover .card-image img {
    transform: scale(1.05);
}

.card-content {
    padding: 1.6rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.card-header-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

.card-title {
    font-size: 1.2rem;
    color: #1f2d3d;
    margin: 0;
    font-weight: 700;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
}

.card-field {
    display: inline-flex;
    align-self: flex-start;
    color: #3e5566;
    font-size: 0.75rem;
    margin: 0;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: #eef2f5;
    border: 1px solid #e1e6eb;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    flex-shrink: 0;
}

.card-field.clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.card-field.clickable:hover {
    background: #3498db;
    color: #fff;
    border-color: #3498db;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

/* Card Elements - Compact Horizontal Layout */
.card-elements-horizontal {
    display: flex;
    gap: 0.6rem;
    margin: 0.75rem 0 1.1rem 0;
    flex-wrap: wrap;
}

.element-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f7f9fb;
    padding: 0.7rem 0.85rem;
    border-radius: 10px;
    border: 1px solid #e1e6eb;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 0;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.element-badge span {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.35;
    text-align: center;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    word-break: break-word;
}

.element-badge:hover {
    border-color: #8fb0c7;
    background: #eef4f8;
    box-shadow: 0 6px 12px rgba(44, 62, 80, 0.12);
    transform: translateY(-2px);
}

.element-badge:hover span {
    color: #1f2d3d;
}

.card:hover .element-badge {
    border-color: #d0dde7;
    background: #f7f9fb;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8);
}

.card-preview {
    color: #4a5a6a;
    font-size: 0.92rem;
    margin-bottom: 1.1rem;
    line-height: 1.7;
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    gap: 1rem;
    color: #7a8a99;
    font-size: 0.85rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #edf1f4;
    align-items: center;
    justify-content: space-between;
}

.card-cta {
    margin-left: auto;
    font-weight: 600;
    color: #2c3e50;
    letter-spacing: 0.2px;
}

.agree-count,
.comment-count {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 500;
    transition: color 0.2s;
}

.meta-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 6px;
    background: #eef2f5;
    color: #2c3e50;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.card:hover .agree-count,
.card:hover .comment-count {
    color: #2c3e50;
}

.card-loader {
    display: none;
    text-align: center;
    color: #667080;
    margin-top: 1rem;
}

.card-loader.active {
    display: block;
}

.card-sentinel {
    height: 1px;
}

/* Table */
.table-container {
    background: #fff;
    overflow-x: auto;
    border: 1px solid #e6ecf1;
    border-radius: 12px;
    box-shadow: 0 10px 22px rgba(44, 62, 80, 0.08);
}

.table-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #edf1f4;
    color: #666;
    font-size: 0.9rem;
    font-weight: 500;
}

.table-info span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    flex-wrap: wrap;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.75rem;
    background: #fff;
    color: #2c3e50;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.pagination-btn:hover:not(.disabled) {
    background: #2c3e50;
    color: #fff;
    border-color: #2c3e50;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(44, 62, 80, 0.15);
}

.pagination-btn.active {
    background: #2c3e50;
    color: #fff;
    border-color: #2c3e50;
    font-weight: 600;
}

.pagination-btn.disabled {
    color: #ccc;
    cursor: not-allowed;
    background: #f8f8f8;
}

.pagination-ellipsis {
    color: #999;
    padding: 0 0.5rem;
    font-weight: 500;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.data-table th,
.data-table td {
    padding: 0.9rem 1.1rem;
    text-align: left;
    border-bottom: 1px solid #edf1f4;
}

.data-table th {
    background: #f2f6f9;
    color: #2c3e50;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.2px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table tbody tr {
    cursor: pointer;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}

.data-table tbody tr:nth-child(even) {
    background: #fafcfe;
}

.data-table tbody tr:hover {
    background: #eef5fb;
}

.data-table tbody tr:focus-visible {
    outline: 3px solid #3e6d8f;
    outline-offset: -2px;
    background: #e7f1f9;
}

.data-table.dense th,
.data-table.dense td {
    padding: 0.5rem 0.75rem;
}

.table-name {
    font-weight: 600;
    color: #2c3e50;
}

.data-table td {
    color: #4a5a6a;
    font-size: 0.92rem;
}

.data-table td:last-child,
.data-table th:last-child {
    white-space: nowrap;
}

.table-link {
    color: #2c3e50;
    text-decoration: none;
    font-weight: 500;
}

.table-link:hover {
    text-decoration: underline;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.8rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    box-shadow: none;
}

.btn-primary {
    background: #2c3e50;
    color: #fff;
}

.btn-primary:hover {
    background: #34495e;
}

.btn-secondary {
    background: #f8f9fa;
    color: #2c3e50;
    border: 1px solid #e9ecef;
}

.btn-secondary:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

.btn-danger {
    background: #e74c3c;
    color: #fff;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-success {
    background: #27ae60;
    color: #fff;
}

.btn-success:hover {
    background: #229954;
}

.btn-info {
    background: #3498db;
    color: #fff;
}

.btn-info:hover {
    background: #2980b9;
}

.btn-full {
    width: 100%;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    margin-right: 0.3rem;
    box-shadow: none;
}

.btn-small:hover {
    transform: none;
    background: var(--hover-bg, currentColor);
    opacity: 0.85;
}

.btn-edit {
    background: #f8f9fa;
    color: #2c3e50;
    --hover-bg: #e9ecef;
}

.btn-delete {
    background: #f8f9fa;
    color: #e74c3c;
    --hover-bg: #ffe5e5;
}

/* Detail Page Action Buttons */
.detail-action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-agree {
    background: #27ae60;
    color: #fff;
    border: none;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
}

.btn-agree:hover {
    background: #229954;
}

.btn-edit-detail {
    background: #3498db;
    color: #fff;
    border: none;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 4px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
}

.btn-edit-detail:hover {
    background: #2980b9;
}

.btn-delete-detail {
    background: #e74c3c;
    color: #fff;
    border: none;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
}

.btn-delete-detail:hover {
    background: #c0392b;
}

/* Admin Page Action Buttons */
.admin-action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #999;
}

.empty-state p {
    margin-bottom: 1rem;
}

/* Detail Page */
.detail-page {
    max-width: 900px;
    margin: 0 auto;
}

.detail-body {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
}

.feature-image {
    width: 100%;
    margin-bottom: 2rem;
}

.feature-image img {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
}

.description-section,
.elements-section,
.meta-section,
.actions-section,
.comments-section {
    margin-bottom: 2rem;
}

.section-hint {
    color: #999;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* Tooltip Styles */
.tooltip-container {
    position: relative;
}

.tooltip-content {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: #2c3e50;
    color: #fff;
    padding: 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    line-height: 1.5;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    margin-bottom: 0.5rem;
    max-width: 400px;
}

.tooltip-content.card-tooltip {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    min-width: 220px;
    max-width: 320px;
}

.tooltip-content strong {
    display: block;
    margin-bottom: 0.5rem;
    color: #fff;
}

.tooltip-container:hover .tooltip-content {
    display: block;
    animation: fadeIn 0.2s ease-in-out;
}

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

.description-section h2,
.elements-section h2,
.comments-section h2 {
    font-size: 1.5rem;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.description-text {
    color: #666;
    line-height: 1.8;
    margin: 0;
}

.sacrifice-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sacrifice-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

.sacrifice-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
}

.sacrifice-desc {
    font-size: 0.9rem;
    color: #6c757d;
    line-height: 1.6;
}

.elements-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.element-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

.element-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
    background: #e9ecef;
    border-radius: 6px;
}

.element-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.element-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #2c3e50;
    flex: 1;
}

/* Keep old styles for compatibility */
.elements-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: visible;
}

.element-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e0e0e0;
    background: #fff;
}

.element-item:last-child {
    border-bottom: none;
}

.element-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 6px;
}

.element-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.element-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.element-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 1rem;
    font-weight: 600;
    color: #666;
    background: #f0f0f0;
    border-radius: 4px;
}

.element-text {
    font-size: 1rem;
    font-weight: 500;
    color: #333;
    margin: 0;
}

.meta-section {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

.meta-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.meta-key {
    color: #6c757d;
    font-weight: 500;
    min-width: 80px;
}

.meta-val {
    color: #2c3e50;
    font-weight: 600;
    flex: 1;
}

/* Keep old styles for compatibility */
.meta-item {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.meta-label {
    color: #999;
    font-weight: 500;
}

.meta-value {
    color: #666;
}

.meta-link {
    color: #3498db;
    text-decoration: none;
}

.meta-link:hover {
    text-decoration: underline;
}

.actions-section {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Comments */
.comments-list {
    margin-bottom: 2rem;
}

.comment-item {
    padding: 1rem;
    margin-bottom: 1rem;
    background: #f8f8f8;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.comment-author {
    font-weight: 600;
    color: #2c3e50;
}

.comment-time {
    color: #999;
    font-size: 0.85rem;
}

.comment-content {
    color: #666;
    margin: 0;
}

.no-comments {
    color: #999;
    margin-bottom: 1rem;
}

.comment-form {
    padding: 1.5rem;
    background: #f8f8f8;
}

.comment-form h3 {
    font-size: 1.2rem;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.comment-form textarea {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    font-family: inherit;
    resize: vertical;
}

.comment-prompt {
    text-align: center;
    padding: 1rem;
}

/* Form Page */
.form-page {
    max-width: 800px;
    margin: 0 auto;
}

.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.form-header h1 {
    font-size: 2rem;
    color: #2c3e50;
}

.form-container {
    background: #fff;
    padding: 2rem;
}

.form-section {
    margin-bottom: 2rem;
}

.form-section h2 {
    font-size: 1.3rem;
    color: #2c3e50;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    background: #f8f8f8;
    border: none;
    font-family: inherit;
    font-size: 0.95rem;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    background: #f0f0f0;
}

.form-actions {
    display: flex;
    gap: 1rem;
}

/* Auth Page */
.auth-page {
    max-width: 400px;
    margin: 2rem auto;
}

.auth-container {
    background: #fff;
    padding: 2rem;
}

.auth-title {
    font-size: 1.8rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    text-align: center;
}

.auth-subtitle {
    color: #666;
    text-align: center;
    margin-bottom: 2rem;
}

.auth-footer {
    margin-top: 2rem;
    text-align: center;
    color: #666;
}

.auth-footer a {
    color: #3498db;
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Dashboard */
.dashboard-page {
    max-width: 1400px;
    margin: 0 auto;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.dashboard-title {
    font-size: 2rem;
    color: #2c3e50;
}

.dashboard-actions {
    display: flex;
    gap: 1rem;
}

.dashboard-content h2 {
    font-size: 1.5rem;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.inline-form {
    display: inline;
}

/* Flash Messages */
.flash-messages {
    margin-bottom: 2rem;
}

.flash-message {
    padding: 1rem;
    background: #f0f0f0;
    color: #333;
    margin-bottom: 0.5rem;
}

/* Footer */
.main-footer {
    text-align: center;
    padding: 2rem;
    color: #999;
    font-size: 0.9rem;
}

/* Responsive */
/* Extra Small - iPhone SE and small phones (up to 480px) */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }

    .main-header {
        padding: 0.6rem 0.75rem;
        flex-direction: row;
        gap: 0.5rem;
    }

    .header-content {
        flex-direction: row;
        gap: 0.6rem;
        width: 100%;
        justify-content: space-between;
        align-items: center;
    }

    .header-info {
        gap: 0.4rem;
        width: auto;
        flex-shrink: 1;
        align-items: center;
        flex-wrap: nowrap;
    }

    .header-info .site-title {
        font-size: 0.95rem;
        font-weight: 600;
        flex-shrink: 0;
        line-height: 1.2;
    }

    .header-info .detail-title {
        font-size: 0.95rem;
    }

    .header-info .detail-subtitle {
        font-size: 0.8rem;
    }

    .header-right {
        gap: 0.4rem;
        flex-shrink: 0;
    }

    .header-actions {
        width: auto;
        justify-content: flex-end;
        margin-bottom: 0;
    }

    /* View toggle buttons - icon only on extra small screens */
    .toggle-btn {
        padding: 0.45rem;
        font-size: 0;
        border-radius: 6px;
        border: 1px solid #e9ecef;
        font-weight: 500;
        min-width: 32px;
        height: 32px;
    }

    .toggle-icon {
        width: 16px;
        height: 16px;
    }

    .toggle-text {
        display: none;
    }

    .view-toggle {
        gap: 0.3rem;
    }

    .mobile-menu-btn {
        padding: 0.35rem;
    }

    .mobile-menu-btn svg {
        width: 20px;
        height: 20px;
    }

    .main-content {
        padding: 0.5rem 0.6rem;
        min-height: calc(100vh - 180px);
    }

    .search-form {
        width: 100%;
        order: 1;
    }

    .search-input {
        width: 100%;
        padding: 0.45rem 0.7rem;
        font-size: 0.8rem;
        border-radius: 8px;
    }

    .nav-link {
        width: 100%;
        justify-content: center;
        order: 2;
    }

    .user-info {
        order: 3;
        width: 100%;
        text-align: center;
        background: #f8f9fa;
        padding: 0.35rem 0.6rem;
        border-radius: 4px;
        border: 1px solid #e9ecef;
    }

    .field-filter-bar {
        margin-bottom: 0.5rem;
        padding-bottom: 0.1rem;
    }

    .field-chip {
        padding: 0.35rem 0.7rem;
        font-size: 0.75rem;
    }

    .card-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .card-grid.masonry-grid {
        column-count: 1;
        column-gap: 0.75rem;
    }

    .card-grid.masonry-grid .masonry-item {
        margin: 0 0 0.75rem;
    }

    .card-content {
        padding: 1rem;
    }

    .card-header-row {
        gap: 0.4rem;
    }

    .card-title {
        font-size: 1rem;
    }

    .card-field {
        font-size: 0.65rem;
        padding: 0.2rem 0.5rem;
    }

    .card-elements-horizontal {
        gap: 0.4rem;
        margin: 0.5rem 0 0.75rem 0;
    }

    .element-badge {
        padding: 0.5rem 0.6rem;
    }

    .element-badge span {
        font-size: 0.8rem;
    }

    .card-preview {
        font-size: 0.85rem;
        margin-bottom: 0.75rem;
    }

    .card-meta {
        padding-top: 0.75rem;
        gap: 0.6rem;
        font-size: 0.75rem;
    }

    .btn {
        padding: 0.35rem 0.6rem;
        font-size: 0.75rem;
    }

    .btn-small {
        padding: 0.2rem 0.4rem;
        font-size: 0.7rem;
    }

    .pagination {
        padding: 1rem 0.5rem;
        gap: 0.3rem;
    }

    .pagination-btn {
        min-width: 32px;
        height: 32px;
        padding: 0 0.5rem;
        font-size: 0.85rem;
    }

    .table-container {
        border-radius: 8px;
    }

    .data-table.dense th,
    .data-table.dense td {
        padding: 0.4rem 0.5rem;
        font-size: 0.8rem;
    }

    .detail-header {
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
    }

    .detail-header .detail-title {
        font-size: 1.3rem;
    }

    .detail-body {
        padding: 1rem;
    }

    .element-item {
        padding: 0.75rem 0.8rem;
        gap: 0.6rem;
    }

    .element-image {
        width: 60px;
        height: 60px;
    }

    .detail-navigation {
        flex-wrap: nowrap;
        gap: 0.3rem;
    }

    .nav-btn {
        min-width: 80px;
        padding: 0.4rem 0.5rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .nav-btn svg {
        width: 14px;
        height: 14px;
    }

    .dashboard-header {
        margin-bottom: 1rem;
    }

    .dashboard-title {
        font-size: 1.5rem;
    }

    .dashboard-actions {
        width: 100%;
        display: flex;
        flex-wrap: nowrap;
        gap: 0.4rem;
    }

    .dashboard-actions .btn,
    .dashboard-actions button {
        flex: 1;
        text-align: center;
        justify-content: center;
        width: auto;
        display: inline-flex;
        align-items: center;
        padding: 0.5rem 0.6rem;
        font-size: 0.75rem;
        font-weight: 500;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        text-decoration: none;
        transition: all 0.2s ease;
        white-space: nowrap;
    }

    .dashboard-actions .inline-form {
        display: flex;
        flex: 1;
        width: auto;
    }

    .dashboard-actions .inline-form button {
        width: 100%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0.5rem 0.6rem;
        font-size: 0.75rem;
        font-weight: 500;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        transition: all 0.2s ease;
        text-decoration: none;
        white-space: nowrap;
    }

    .dashboard-actions .btn svg,
    .dashboard-actions button svg {
        margin-right: 0.3rem;
        flex-shrink: 0;
        width: 14px;
        height: 14px;
    }

    .form-container,
    .auth-container {
        padding: 1rem;
    }

    .form-section,
    .comments-section {
        margin-bottom: 1rem;
    }

    .empty-state {
        padding: 2rem 1rem;
    }

    .main-footer {
        padding: 1rem;
        font-size: 0.8rem;
    }
}

/* Small - Standard iPhones and small Android (481-640px) */
@media (min-width: 481px) and (max-width: 640px) {
    body {
        font-size: 15px;
    }

    .main-header {
        padding: 0.7rem 0.85rem;
        flex-direction: row;
        gap: 0.5rem;
    }

    .header-content {
        flex-direction: row;
        gap: 0.7rem;
        width: 100%;
        justify-content: space-between;
        align-items: center;
    }

    .header-info {
        gap: 0.5rem;
        width: auto;
        flex-shrink: 1;
        align-items: center;
    }

    .header-info .site-title {
        font-size: 1.05rem;
        font-weight: 600;
        line-height: 1.2;
    }

    .header-info .detail-title {
        font-size: 1rem;
    }

    .header-actions {
        flex-shrink: 0;
    }

    /* View toggle buttons - icon only to prevent overlap */
    .toggle-btn {
        padding: 0.45rem;
        font-size: 0;
        border-radius: 6px;
        min-width: 32px;
        height: 32px;
    }

    .toggle-icon {
        width: 16px;
        height: 16px;
    }

    .toggle-text {
        display: none;
    }

    .view-toggle {
        gap: 0.3rem;
    }

    .mobile-menu-btn {
        padding: 0.4rem;
    }

    .mobile-menu-btn svg {
        width: 22px;
        height: 22px;
    }

    .search-form {
        width: 100%;
        order: 1;
    }

    .search-input {
        width: 100%;
        padding: 0.48rem 0.8rem;
        font-size: 0.82rem;
        border-radius: 8px;
    }

    .nav-link {
        width: 100%;
        justify-content: center;
        order: 2;
    }

    .user-info {
        order: 3;
        width: 100%;
        text-align: center;
        background: #f8f9fa;
        padding: 0.38rem 0.6rem;
        border-radius: 4px;
        border: 1px solid #e9ecef;
    }

    .main-content {
        padding: 0.75rem 1rem;
    }

    .field-chip {
        padding: 0.4rem 0.85rem;
        font-size: 0.8rem;
    }

    .card-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .card-grid.masonry-grid {
        column-count: 1;
        column-gap: 1rem;
    }

    .card-grid.masonry-grid .masonry-item {
        margin: 0 0 1rem;
    }

    .card-content {
        padding: 1.2rem;
    }

    .card-title {
        font-size: 1.1rem;
    }

    .card-field {
        font-size: 0.7rem;
        padding: 0.2rem 0.6rem;
    }

    .element-badge {
        padding: 0.6rem 0.7rem;
    }

    .element-badge span {
        font-size: 0.85rem;
    }

    .card-preview {
        font-size: 0.88rem;
    }

    .card-meta {
        font-size: 0.8rem;
    }

    .btn {
        padding: 0.4rem 0.7rem;
        font-size: 0.78rem;
    }

    .btn-small {
        padding: 0.25rem 0.5rem;
        font-size: 0.72rem;
    }

    .pagination-btn {
        min-width: 34px;
        height: 34px;
    }

    .data-table.dense th,
    .data-table.dense td {
        padding: 0.45rem 0.6rem;
        font-size: 0.85rem;
    }

    .detail-body {
        padding: 1.3rem;
    }

    .element-item {
        padding: 0.85rem 1rem;
    }

    .form-container,
    .auth-container {
        padding: 1.3rem;
    }
}

/* Medium - Large phones and iPad portrait (641-768px) */
@media (min-width: 641px) and (max-width: 768px) {
    .main-header {
        padding: 0.8rem 1rem;
        flex-direction: row;
        gap: 0.6rem;
    }

    .header-content {
        flex-direction: row;
        gap: 0.8rem;
        width: 100%;
        justify-content: space-between;
        align-items: center;
    }

    .header-info {
        gap: 0.6rem;
        width: auto;
        flex-shrink: 1;
        align-items: center;
    }

    .header-info .detail-title {
        font-size: 1.2rem;
    }

    .header-info .detail-subtitle {
        font-size: 0.9rem;
    }

    .header-actions {
        flex-shrink: 0;
    }

    /* View toggle buttons - icon only to prevent overlap */
    .toggle-btn {
        padding: 0.45rem;
        font-size: 0;
        border-radius: 6px;
        min-width: 32px;
        height: 32px;
    }

    .toggle-icon {
        width: 16px;
        height: 16px;
    }

    .toggle-text {
        display: none;
    }

    .view-toggle {
        gap: 0.3rem;
    }

    .mobile-menu-btn {
        padding: 0.45rem;
    }

    .mobile-menu-btn svg {
        width: 22px;
        height: 22px;
    }

    .search-form {
        width: 100%;
        order: 1;
    }

    .search-input {
        width: 100%;
        padding: 0.5rem 0.9rem;
        font-size: 0.84rem;
        border-radius: 8px;
    }

    .nav-link {
        width: 100%;
        justify-content: center;
        order: 2;
    }

    .user-info {
        order: 3;
        width: 100%;
        text-align: center;
        background: #f8f9fa;
        padding: 0.4rem 0.65rem;
        border-radius: 4px;
        border: 1px solid #e9ecef;
    }

    .main-content {
        padding: 0.8rem 1.25rem;
    }

    .field-chip {
        padding: 0.45rem 0.9rem;
        font-size: 0.82rem;
    }

    .card-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }

    .card-grid.masonry-grid {
        column-count: 1;
        column-gap: 1.2rem;
    }

    .card-grid.masonry-grid .masonry-item {
        margin: 0 0 1.2rem;
    }

    .card-content {
        padding: 1.4rem;
    }

    .card-title {
        font-size: 1.15rem;
    }

    .element-badge {
        padding: 0.65rem 0.75rem;
    }

    .element-badge span {
        font-size: 0.87rem;
    }

    .card-preview {
        font-size: 0.9rem;
    }

    .btn {
        padding: 0.42rem 0.75rem;
        font-size: 0.79rem;
    }

    .btn-small {
        padding: 0.28rem 0.55rem;
        font-size: 0.74rem;
    }

    .data-table.dense th,
    .data-table.dense td {
        padding: 0.5rem 0.7rem;
        font-size: 0.88rem;
    }

    .detail-body {
        padding: 1.5rem;
    }

    .dashboard-header {
        flex-direction: column;
        gap: 0.8rem;
        align-items: flex-start;
    }

    .dashboard-actions {
        width: 100%;
        display: flex;
        flex-wrap: nowrap;
        gap: 0.5rem;
    }

    .dashboard-actions .btn,
    .dashboard-actions button {
        flex: 1;
        text-align: center;
        justify-content: center;
        width: auto;
        display: inline-flex;
        align-items: center;
        padding: 0.5rem 0.7rem;
        font-size: 0.8rem;
        font-weight: 500;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        text-decoration: none;
        transition: all 0.2s ease;
        white-space: nowrap;
    }

    .dashboard-actions .inline-form {
        display: flex;
        flex: 1;
        width: auto;
    }

    .dashboard-actions .inline-form button {
        width: 100%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0.5rem 0.7rem;
        font-size: 0.8rem;
        font-weight: 500;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        transition: all 0.2s ease;
        text-decoration: none;
        white-space: nowrap;
    }

    .dashboard-actions .btn svg,
    .dashboard-actions button svg {
        margin-right: 0.4rem;
        flex-shrink: 0;
        width: 15px;
        height: 15px;
    }

    .form-container,
    .auth-container {
        padding: 1.5rem;
    }
}

/* Large - iPad landscape (769-1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .main-header {
        padding: 1rem 1.5rem;
    }

    .header-content {
        gap: 1rem;
    }

    .header-info {
        gap: 0.9rem;
    }

    .main-content {
        padding: 0.9rem 1.5rem 1.5rem 1.5rem;
    }

    .field-chip {
        padding: 0.48rem 0.95rem;
        font-size: 0.83rem;
    }

    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.3rem;
    }

    .card-grid.masonry-grid {
        column-count: 2;
        column-gap: 1.3rem;
    }

    .card-grid.masonry-grid .masonry-item {
        margin: 0 0 1.3rem;
    }

    .card-content {
        padding: 1.4rem;
    }

    .card-title {
        font-size: 1.15rem;
    }

    .element-badge {
        padding: 0.65rem 0.8rem;
    }

    .element-badge span {
        font-size: 0.88rem;
    }

    .card-preview {
        font-size: 0.9rem;
    }

    .btn {
        padding: 0.42rem 0.78rem;
        font-size: 0.8rem;
    }

    .btn-small {
        padding: 0.28rem 0.55rem;
        font-size: 0.75rem;
    }

    .data-table.dense th,
    .data-table.dense td {
        padding: 0.5rem 0.7rem;
        font-size: 0.88rem;
    }

    .detail-body {
        padding: 1.6rem;
    }

    .element-item {
        padding: 0.9rem 1.1rem;
    }

    .dashboard-actions {
        gap: 0.6rem;
    }

    .form-container,
    .auth-container {
        padding: 1.6rem;
    }
}

/* XLarge - Small laptops and large tablets (1025-1200px) */
@media (min-width: 1025px) and (max-width: 1200px) {
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }

    .card-grid.masonry-grid {
        column-count: 3;
        column-gap: 1.5rem;
    }
}

/* View toggle buttons - show icons and text on larger screens (above 900px) */
@media (min-width: 900px) {
    .toggle-btn {
        padding: 0.4rem 0.7rem;
        font-size: 0.82rem;
        gap: 0.4rem;
    }

    .toggle-icon {
        width: 16px;
        height: 16px;
    }

    .toggle-text {
        display: inline;
    }

    .view-toggle {
        gap: 0.4rem;
    }
}

/* Original medium breakpoint - Tablets and small laptops (up to 1100px) */
@media (min-width: 769px) and (max-width: 1100px) {
    .card-grid.masonry-grid {
        column-count: 2;
    }
}

/* Hide tooltips on touch devices for better UX */
@media (hover: none) and (pointer: coarse) {
    .tooltip-container:hover .tooltip-content {
        display: none;
    }
}
