/* Base styles */
:root {
    --primary-red: #e60023;
    --light-gray: #efefef;
    --dark-gray: #767676;
    --pinterest-bg: #fff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Noto Sans KR", sans-serif;
    background-color: var(--pinterest-bg);
    color: #333;
    height: 100dvh;
    overflow: hidden;
}

/* 1. Header (Top Navigation) */
.header {
    width: calc(100% - 120px);
    display: flex;
    align-items: center;
    padding: 20px 14px 20px 0;
    gap: 10px;
    position: fixed;
    top: 0;
    background-color: var(--pinterest-bg);
    z-index: 1000; /* Ensure it stays on top */
    margin-bottom: 30px;
}

.header .logo {
    width: 32px;
    height: 32px;
    background-color: var(--primary-red);
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 20px;
    color: white;
    font-weight: bold;
    cursor: pointer;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 64px;
    margin-bottom: 16px;
}

.nav-links .nav-item {
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    text-decoration: none;
    color: #111;
    white-space: nowrap; /* Prevents text from wrapping */
}

.nav-links .nav-item.active {
    background-color: #111;
    color: white;
}

/* Search Bar */
.header .search-bar {
    flex-grow: 1; /* Takes up available space */
    position: relative;
}

.header .search-bar input {
    width: 100%;
    padding: 12px 40px; /* Space for icon */
    border: none;
    border-radius: 30px;
    background-color: var(--light-gray);
    font-size: 16px;
    outline: none;
}

.header .search-bar .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--dark-gray);
    pointer-events: none; /* Allows clicks to pass through */
}

/* Right Icons */
.header .right-icons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header .right-icons .icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--light-gray);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.header .right-icons .icon-btn:hover {
    background-color: #ddd;
}

.header .right-icons .profile-pic {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #ccc;
    cursor: pointer;
}

/* 2. Main Container for Sidebar and Content */
.main-container {
    display: flex;
    height: 100%; /* Adjust based on header height */
}

/* 3. Left Sidebar */
.sidebar {
    width: 80px;
    padding-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    border-right: 1px solid var(--light-gray);
}

.sidebar .icon-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: transparent;
    display: grid;
    place-items: center;
    cursor: pointer;
    color: #777;
    transition: background-color 0.2s;
}

.sidebar .icon-btn:hover {
    background-color: #ddd;
}

.sidebar .icon-btn.active {
    background-color: #333;
    color: white;
}

/* 4. Main Content Grid */
.content {
    flex-grow: 1;
    overflow-y: scroll; /* Enable scrolling */
    padding: 20px;
    padding-top: 82px;
}

.grid {
    position: relative; /* Required for Masonry */
}

/* Masonry Sizers for column and gutter width */
.grid-sizer,
.grid-item {
    /* 5열 (5 columns) layout for desktop */
    width: calc(20% - 16px);
}

.gutter-sizer {
    width: 20px; /* Space between columns */
}

.grid-item {
    margin-bottom: 20px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    background-color: #fff;
    cursor: pointer;
}

.grid-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.grid-item img {
    display: block;
    width: 100%;
    height: auto;
}

/* Card with Text Content */
.grid-item .card-content {
    padding: 12px;
}

.grid-item .card-content h3 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
}

.grid-item .card-content .source {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #888;
}

.grid-item .card-content .source .profile-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #eee;
}

/* 5. Floating Button */
.floating-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #f2f2f2;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: grid;
    place-items: center;
    cursor: pointer;
    font-size: 24px;
    color: #333;
    border: none;
    transition: background-color 0.2s;
    z-index: 999;
}

.floating-btn:hover {
    background-color: #ddd;
}

/* 6. Responsive Design */
@media (max-width: 1200px) {
    .grid-sizer,
    .grid-item {
        width: calc(25% - 15px);
    } /* 4 columns */
    .gutter-sizer {
        width: 20px;
    }
}

@media (max-width: 992px) {
    .grid-sizer,
    .grid-item {
        width: calc(33.333% - 13.333px);
    } /* 3 columns */
    .gutter-sizer {
        width: 20px;
    }
}

@media (max-width: 768px) {
    .header .nav-links {
        display: none;
    } /* Hide nav links */
    .grid-sizer,
    .grid-item {
        width: calc(50% - 10px);
    } /* 2 columns */
    .gutter-sizer {
        width: 20px;
    }
    .sidebar {
        display: none;
    } /* Hide sidebar on mobile */
    .main-container {
        height: auto;
    }
    .content {
        padding-top: 10px;
    }
}

@media (max-width: 480px) {
    .grid-sizer,
    .grid-item {
        width: 100%;
    } /* 1 column */
    .gutter-sizer {
        width: 0;
    }
}

/* Custom icons (using Material Symbols) */
.material-symbols-outlined {
    font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}
