body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #0f1214 0%, #171a1d 100%);
    color: var(--text-color, #e0e0e0);
    padding-top: 70px;
    /* Space for fixed header */
}

/* Glassmorphism Header */
.navbar {
    background: var(--glass-bg) !important;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--glass-border);
    height: 64px;
    z-index: 1050;
    /* Ensure it stays on top */
}

/* Tree Menu Dropdown */
.navbar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.nav-link {
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7) !important;
    transition: color 0.2s, background-color 0.2s;
    padding: 8px 12px;
    border-radius: 5px;
    white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
    color: #fff !important;
    background-color: rgba(255, 255, 255, 0.1); /* Subtle hover background */
}

.dropdown-menu {
    background: #252528;
    border: 1px solid var(--glass-border);
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3); /* Softer shadow */
    border-radius: 8px; /* Rounded corners */
    max-height: 80vh;
    overflow-y: auto;
}

.dropdown-item {
    color: #ccc;
    font-size: 0.9rem;
    padding: 10px 16px; /* Slightly more vertical padding */
    border-radius: 5px; /* Match nav-link */
    transition: background-color 0.2s, color 0.2s;
}

.dropdown-item:hover,
.dropdown-item.active {
    background-color: rgba(255, 255, 255, 0.15); /* Slightly more pronounced hover */
    color: #fff;
}

/* Calendar-like Grid Layout */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 0;
    padding: 0;
}

@media (min-width: 576px) {
    .calendar-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 900px) {
    .calendar-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1200px) {
    .calendar-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1500px) {
    .calendar-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

.grid-item {
    overflow: hidden;
}

/* Card Styling */
.card {
    background: #1e2124;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
}

/* Group ID別の枠線色はJavaScriptで動的に設定 */

.card-img-wrapper {
    width: 100%;
    background-color: #111;
    overflow: hidden;
    position: relative;
}

.card-img-top {
    width: 100%;
    height: auto;
    display: block;
}

.card-body {
    padding: 0.5rem;
    position: relative;
}

/* Overlay Captions for Image Cards */
.card.has-image .card-body {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.6) 60%, transparent);
    padding: 0.5rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    z-index: 10;
}

/* Ensure text is readable */
.card.has-image .card-title {
    color: #fff;
    font-weight: 600;
}

.card-title {
    font-size: 0.7rem;
    line-height: 1.3;
    margin-bottom: 0.25rem;
    color: #fff;
    font-weight: 500;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card.text-only .card-title {
    font-size: 0.8rem;
    font-weight: 400;
    -webkit-line-clamp: 5;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.7);
}

.domain-badge {
    background: rgba(255, 255, 255, 0.05);
    padding: 1px 4px;
    border-radius: 2px;
    font-family: monospace;
    font-size: 0.55rem;
}

/* Text Only Card specific */
.card.text-only {
    display: flex;
    align-items: center;
    justify-content: center;
}

.card.text-only .card-body {
    padding: 0.5rem;
}

/* Tweet-specific styling */
.grid-item.is-tweet .card-body {
    padding-top: 0;
    padding-bottom: 0;
}

.grid-item.is-tweet .card-title {
    margin-bottom: 0;
}

#loading {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    display: none;
    z-index: 1000;
    color: white;
    font-size: 0.9rem;
}

/* Search Bar Styling */
.search-input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 40px;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.search-input:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.1);
}

#search-btn {
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
}

#search-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}

/* Search Highlight */
.search-highlight {
    background: linear-gradient(to bottom, rgba(255, 230, 0, 0.4) 0%, rgba(255, 200, 0, 0.5) 100%);
    color: #fff;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 600;
}

/* Keyword Highlights */
.keyword-ok {
    background: linear-gradient(to bottom, rgba(0, 200, 100, 0.4) 0%, rgba(0, 180, 80, 0.5) 100%);
    color: #fff;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 600;
}

.keyword-ng {
    background: rgba(255, 100, 100, 0.3);
    color: #fff;
    padding: 0 2px;
    border-radius: 2px;
}

/* NG Card - Grayed out */
.card.ng-content {
    opacity: 0.4;
    filter: grayscale(80%);
}

.card.ng-content:hover {
    opacity: 0.7;
    filter: grayscale(40%);
}

/* Favorite Star */
.favorite-star {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    z-index: 20;
    opacity: 0.6;
    transition: opacity 0.2s, transform 0.2s;
}

.favorite-star:hover {
    opacity: 1;
    transform: scale(1.2);
}

.favorite-star.active {
    opacity: 1;
}

.favorite-star svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
        }

/* Favorites Toggle Button */
.favorites-toggle {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.7);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.favorites-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
}

.favorites-toggle.active {
    background: rgba(255, 193, 7, 0.2);
    border-color: #ffc107;
    color: #ffc107;
}

/* Thumbnail mode button active state */
#thumb-mode-btn.active {
    background: rgba(100, 180, 255, 0.2);
    border-color: #64b4ff;
}

/* Stats button active state */
#stats-btn.active {
    background: rgba(100, 180, 255, 0.2);
    border-color: #64b4ff;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .nav-link {
        padding: 4px 6px;
        font-size: 0.75rem;
    }

    .search-input {
        min-width: 120px;
    }

    .favorites-toggle {
        padding: 4px 8px;
    }

    #user-display {
        display: none;
    }

    #logoutBtn {
        font-size: 0.7rem;
        padding: 2px 6px;
    }
}
