@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;700;800&display=swap");

:root {
    --bg: #050506;
    --surface: #0f0f11;
    --accent: #007aff;
    --border: rgba(255, 255, 255, 0.06);
    --text-main: #ffffff;
    --text-muted: #6e6e73;
    --tag-general: #007aff;
    --tag-artist: #ff3b30;
    --tag-character: #34c759;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text-main);
    font-family: "Plus Jakarta Sans", sans-serif;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* --- Header & Search --- */
header {
    height: 64px;
    background: rgba(5, 5, 6, 0.8);
    backdrop-filter: saturate(180%) blur(20px);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
    justify-content: space-between;
    z-index: 100;
}

.logo {
    font-weight: 800;
    font-size: 18px;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff 0%, #888 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.search-container {
    flex-grow: 1;
    max-width: 600px;
    margin: 0 40px;
}

.search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 16px;
    color: white;
    font-size: 14px;
    transition: all 0.2s ease;
}

.search-input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15);
}

/* --- Source Picker --- */
.source-picker {
    position: relative;
    display: inline-block;
}

.source-icon-circle {
    width: 36px;
    height: 36px;
    background: #1a1a1c;
    border-radius: 50%;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    transition: border-color 0.2s;
}

.source-icon-circle:hover {
    border-color: var(--accent);
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 45px;
    background: #161618;
    min-width: 180px;
    border: 1px solid var(--border);
    border-radius: 12px;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.dropdown-content.show {
    display: block;
}

.dropdown-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* --- Main Layout --- */
.wrapper {
    display: flex;
    flex-grow: 1;
    overflow: hidden;
}

aside {
    width: 260px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: 32px;
}

.sidebar-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.tag {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin: 2px -12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.2s;
}

.tag:hover {
    background: rgba(255, 255, 255, 0.04);
}

/* --- Grid --- */
main {
    flex-grow: 1;
    padding: 24px;
    overflow-y: scroll;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    grid-auto-rows: 320px;
    gap: 20px;
    background: radial-gradient(at top left, #111115, #050506);
}

.card {
    background: var(--surface);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border);
    transition:
        transform 0.4s cubic-bezier(0.2, 0, 0, 1),
        border-color 0.3s;
    cursor: zoom-in;
}

.card:hover {
    transform: scale(1.03) translateY(-5px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

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

.res-badge {
    font-size: 10px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(4px);
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
}

/* --- Modal --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
}

.modal-content {
    position: relative;
    width: 95%;
    height: 90%;
    margin: 2% auto;
    background: var(--surface);
    border-radius: 20px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 30px;
    color: white;
    cursor: pointer;
    z-index: 10;
}

.modal-body {
    display: flex;
    height: 100%;
}

.modal-viewport {
    flex: 3;
    background: #050505;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 20px;
}

.modal-viewport img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
}

.modal-panel {
    flex: 1;
    border-left: 1px solid var(--border);
    padding: 24px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.02);
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 30px;
}

.comment-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 12px;
    font-size: 13px;
    border: 1px solid var(--border);
    margin-bottom: 10px;
}
