:root {
    --bg-color: #eaeff5;
    /* 조금 더 진하고 차분한 파스텔톤 회파랑 배경 */
    --card-bg: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #5f6368;
    --accent-color: #4285f4;
    --card-border: #d5d9e0;
    /* 카드 테두리도 배경에 맞게 살짝 진하게 */
    --gap: 24px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Roboto', 'Noto Sans KR', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    width: 98%;
    /* Full width */
    max-width: none !important;
    /* No limit */
    margin: 20px auto;
    padding: 0 20px;
}

.site-header {
    background-color: rgba(255, 255, 255, 0.95);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
    letter-spacing: 1px;
}

.logo a {
    text-decoration: none;
    color: inherit;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--gap);
    padding: 40px 0;
    align-items: start;
}

.grid-column {
    display: flex;
    flex-direction: column;
    gap: 40px;
    /* 카드의 상하 간격을 넓혀줌 (원래 24px) */
}

.card {
    background-color: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--card-border);
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    width: 100%;
    opacity: 0;
    /* 카드가 더 도드라져 보이도록 그림자 강도를 약간 올림 */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    animation: fadeIn 0.5s ease-out forwards;

    /* Performance optimization for grid reflows */
    content-visibility: auto;
    contain-intrinsic-size: 350px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.1);
    border-color: rgba(66, 133, 244, 0.3);
}

.card-image-wrapper {
    position: relative;
    max-height: 500px;
    overflow: hidden;
    background-color: #f0f2f5;
    border-bottom: 1px solid var(--card-border);
}

.card-image {
    width: 100%;
    height: auto;
    /* Maintain aspect ratio */
    display: block;
    transition: transform 0.5s ease;
}

.card:hover .card-image {
    transform: scale(1.02);
    /* Slight zoom on hover */
}

.card-content {
    padding: 15px;
    /* Removed flex properties since display is now inline-block/block flow */
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-source {
    font-weight: 600;
    color: var(--accent-color);
}

.card-likes {
    font-weight: 600;
    color: #ff6b6b;
}

/* Loading Sentinel */
.loading-sentinel {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    grid-column: 1 / -1;
    min-height: 100px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Admin UI */
.admin-login-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 200;
    background: #ffffff;
    color: var(--text-primary);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 6px 14px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    opacity: 0.6;
    transition: all 0.2s;
}

.admin-login-btn:hover {
    opacity: 1;
}

.hidden {
    display: none !important;
}

.admin-toolbar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #222;
    padding: 15px;
    display: flex;
    justify-content: center;
    gap: 15px;
    z-index: 200;
    border-top: 1px solid #444;
    align-items: center;
}

.btn-danger {
    background: #ff4444;
    color: white;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 4px;
}

.btn-warning {
    background: #ffbb33;
    color: black;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 4px;
}

.btn-secondary {
    background: #666;
    color: white;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 4px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 300;
}

.modal-content {
    background: #ffffff;
    padding: 24px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    min-width: 320px;
}

.modal-content input {
    width: 100%;
    padding: 12px;
    margin: 20px 0;
    background: #f7f9fc;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1rem;
}

.modal-actions {
    display: flex;
    justify-content: space-around;
}

/* Checkboxes on Cards */
.admin-checkbox {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 20px;
    height: 20px;
    z-index: 10;
    cursor: pointer;
    transform: scale(1.5);
}

.card.selected {
    border: 2px solid #ff4444;
}