:root {
    --bg-dark: #111113;
    --bg-card: #18181b;
    --border: #27272a;
    --text-main: #e4e4e7;
    --text-muted: #a1a1aa;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --hover-row: rgba(255, 255, 255, 0.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 14px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px;
    width: 100%;
}

/* Header */
header {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wishlist-link {
    font-size: 0.85rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(99, 102, 241, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(99, 102, 241, 0.3);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.wishlist-link:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: var(--accent);
    color: #ffffff;
    transform: translateY(-1px);
}

.wishlist-link svg { 
    width: 16px; 
    height: 16px; 
    stroke: var(--accent);
}

.wishlist-link:hover svg {
    stroke: #ffffff;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
}
.logo svg { stroke: var(--accent); width: 20px; height: 20px; }

/* Controls */
.controls {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    align-items: center;
}

select, input, .sort-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    outline: none;
    font-family: inherit;
    height: 38px;
}

select:focus, input:focus, .sort-btn:hover { border-color: var(--accent); }
select { min-width: 140px; }

.search-wrapper { position: relative; flex: 1; }
.search-wrapper input { width: 100%; padding-left: 36px; }
.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.sort-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s;
}
.sort-btn:hover { color: var(--text-main); }
.sort-btn svg { width: 16px; height: 16px; }

.count-badge {
    background: var(--border);
    padding: 0 12px;
    height: 38px;
    display: flex;
    align-items: center;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 60px;
    justify-content: center;
}

.tab-container {
    display: flex;
    background: var(--bg-card);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.tab-btn svg { width: 16px; height: 16px; }

.tab-btn.active {
    background: var(--accent);
    color: white;
}

.tab-btn:hover:not(.active) {
    color: var(--text-main);
    background: var(--hover-row);
}

.no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    gap: 12px;
}
.no-results svg {
    width: 48px;
    height: 48px;
    opacity: 0.3;
}

/* Wishlist Status Badges */
.status-badge {
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    border: 1px solid transparent;
}

.status-have { 
    background: rgba(34, 197, 94, 0.15); 
    color: #4ade80; 
    border-color: rgba(34, 197, 94, 0.2);
}
.status-partial { 
    background: rgba(250, 204, 21, 0.15); 
    color: #facc15; 
    border-color: rgba(250, 204, 21, 0.2);
}
.status-lacking { 
    background: rgba(249, 115, 22, 0.15); 
    color: #fb923c; 
    border-color: rgba(249, 115, 22, 0.2);
}
.status-none { 
    background: rgba(239, 68, 68, 0.15); 
    color: #f87171; 
    border-color: rgba(239, 68, 68, 0.2);
}

.actions, .status-badge {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}
.status-filters {
    display: flex;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 0 16px;
    height: 38px;
    border-radius: 6px;
    align-items: center;
}

.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 22px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    left: 0;
    height: 14px;
    width: 14px;
    background-color: #000;
    border: 1px solid var(--border);
    border-radius: 3px;
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--accent);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--accent);
    border-color: var(--accent);
}

.checkbox-container input:checked ~ .status-have-bg { background-color: #4ade80; }
.checkbox-container input:checked ~ .status-partial-bg { background-color: #facc15; }
.checkbox-container input:checked ~ .status-lacking-bg { background-color: #fb923c; }
.checkbox-container input:checked ~ .status-none-bg { background-color: #f87171; }

/* Table */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

thead {
    background: rgba(0,0,0,0.4);
    font-size: 0.75rem;
    color: var(--text-muted);
}

th { text-align: left; padding: 10px 16px; font-weight: 700; }
.text-right { text-align: right; }

td {
    height: 2.4rem;
    padding: 0 16px;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

tr:hover { background-color: var(--hover-row); }

.date-col {
    font-family: 'Pretendard', sans-serif;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.streamer-name {
    font-weight: 700;
    color: #e4e4e7;
    font-size: 0.8rem;
}

.filename {
    color: #d4d4d8;
}
.filename, .streamer-name, .date-col {
    line-height: 1.2;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Actions */
.actions {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
}

.btn-icon {
    background: transparent;
    border: 1px solid transparent;
    color: #71717a;
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.btn-icon svg { width: 16px; height: 16px; }

.btn-icon:hover { background: var(--border); color: var(--text-main); }
.btn-icon:disabled { opacity: 0.2; cursor: default; }
.btn-icon:disabled:hover { background: transparent; }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 24px;
    padding-bottom: 40px;
}

.page-buttons {
    display: flex;
    gap: 4px;
    align-items: center;
    background: var(--bg-card);
    padding: 6px;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.page-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* Numeric Input Styling */
#pageInput {
    background: #000;
    border: 1px solid var(--border);
    color: var(--accent);
    width: 45px;
    height: 28px;
    padding: 0;
    text-align: center;
    border-radius: 4px;
    font-weight: 800;
    font-family: inherit;
}

#pageInput::-webkit-outer-spin-button,
#pageInput::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
#pageInput[type=number] {
    -moz-appearance: textfield;
}

#pageInput:focus {
    border-color: var(--accent);
}

.divider {
    color: var(--border);
    font-weight: 400;
}

#totalPages {
    min-width: 20px;
}

/* Button Styling */
.page-buttons button {
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.page-buttons button svg {
    width: 18px;
    height: 18px;
}

.page-buttons button:hover:not(:disabled) {
    background: var(--border);
    color: var(--accent);
}

.page-buttons button:disabled {
    opacity: 0.15;
    cursor: default;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.85);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modal.show { display: flex; opacity: 1; }

.modal-content { position: relative; max-width: 90%; max-height: 90vh; }
.modal-content img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
}

.close-modal {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
}
.close-modal svg { width: 32px; height: 32px; }

@media (max-width: 768px) {
    .container {
        padding: 8px;
    }

    .header-content {
        flex-direction: column;
        gap: 8px;
    }
    .tab-container { width: 100%; }
    .tab-btn { flex: 1; padding: 6px; font-size: 0.8rem; }

    .controls {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
    }
    #streamerSelect {
        flex: 0 0 110px;
        font-size: 0.8rem;
        padding: 0 8px;
    }
    .search-wrapper {
        flex: 1;
    }
    .search-wrapper input {
        height: 38px;
    }

    #sortBtn, #countBadge {
        display: none !important;
    }

    .status-filters {
        width: 100%;
        height: 34px;
        padding: 0 8px;
        order: 3;
    }

    .table-container {
        background: transparent;
        border: none;
        box-shadow: none;
    }

    table, tbody, tr, td {
        display: block;
        width: 100%;
    }

    thead { display: none; }

    tr {
        background: var(--bg-card);
        margin-bottom: 6px;
        border: 1px solid var(--border);
        border-radius: 6px;
        padding: 8px 10px;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
    }

    td {
        padding: 0 !important;
        border: none !important;
        height: auto !important;
    }

    td:nth-child(2) {
        order: 1;
        width: auto;
        margin-right: 8px;
    }
    .streamer-name {
        font-size: 0.8rem;
        color: var(--accent);
        max-width: 80px;
    }

    td:nth-child(1) {
        order: 2;
        width: auto;
        flex: 1;
    }
    .date-col {
        font-size: 0.75rem;
        opacity: 0.6;
    }

    td:nth-child(4) {
        order: 3;
        width: auto;
        display: flex;
        justify-content: flex-end;
    }
    .actions { gap: 6px; }
    .btn-icon {
        padding: 2px 6px;
        background: var(--border);
    }
    .status-badge {
        font-size: 0.7rem;
        padding: 1px 6px;
    }

    td:nth-child(3) {
        order: 4;
        width: 100%;
        margin-top: 4px;
    }
    .filename {
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.85rem;
        color: var(--text-main);
        width: 100%;
    }

    .pagination { margin-top: 16px; }
    .page-info { font-size: 0.75rem; gap: 4px; }
    #pageInput { width: 35px; height: 24px; }
}