/* ============================================
   컴포넌트 스타일 (Reusable Components)
   여러 페이지에서 재사용되는 UI 컴포넌트
   ============================================ */

/* --- 1. 캐릭터 카드 (Character Card) --- */
.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
}

.card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.character-card {
    background-color: var(--color-bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-align: center;
    padding-bottom: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: transform var(--transition-fast), background var(--transition-fast);
    border: 1px solid var(--color-border-dark);
    position: relative;
}

.character-card:hover {
    transform: translateY(-5px);
    background-color: var(--color-bg-elevated);
    border-color: var(--color-border-light);
}

.character-card img {
    width: 100%;
    aspect-ratio: 1 / 1.1;
    object-fit: cover;
    border-bottom: 1px solid #333;
    margin-bottom: 10px;
}

.character-card h3 {
    margin: 5px 0;
    font-size: 1.1em;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 5px;
}

.character-card p {
    font-size: 0.85em;
    color: #888;
    margin: 0;
}

/* 계역 태그 */
.relems-tag {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75em;
    font-weight: bold;
    color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.relems-tag.chaos {
    background-color: var(--color-chaos);
}

.relems-tag.aequor {
    background-color: var(--color-aequor);
}

.relems-tag.caro {
    background-color: var(--color-caro);
}

.relems-tag.ultra {
    background-color: var(--color-ultra);
}

/* 태그 스타일 (등급, 클래스) */
.tag {
    padding: 5px 12px;
    border-radius: 15px;
    font-weight: bold;
    color: #fff;
}

.tag.ssr {
    background-color: var(--color-ssr);
    color: #333;
}

.tag.sr {
    background-color: var(--color-sr);
}

.tag.chaos {
    background-color: var(--color-chaos);
}

.tag.aequor {
    background-color: var(--color-aequor);
}

.tag.caro {
    background-color: var(--color-caro);
}

.tag.ultra {
    background-color: var(--color-ultra);
}

.tag.assault {
    background-color: var(--color-assault);
}

.tag.warden {
    background-color: var(--color-warden);
}

.tag.chorus {
    background-color: var(--color-chorus);
}

/* --- 2. 북마크 링크 카드 (Notion-style) --- */
.notion-bookmark {
    display: flex;
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: #eee;
    margin-bottom: 16px;
    transition: all 0.2s;
    height: 120px;
    /* 🔧 카드 높이 고정 */
    overflow: hidden;
}

.notion-bookmark:hover {
    background-color: #353535;
    border-color: #888;
    transform: translateY(-2px);
}

.bookmark-content {
    flex: 1;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}

.bookmark-title {
    font-size: 1.1em;
    font-weight: bold;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #444;
    /* 🔧 제목 아래 구분선 */
    line-height: 1.3;
}

.bookmark-desc {
    font-size: 0.9em;
    color: #aaa;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    /* 표준 속성 */
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.bookmark-image {
    width: 120px;
    /* 🔧 사진 크기 고정 1:1 */
    height: 120px;
    background-color: #111;
    flex-shrink: 0;
}

.bookmark-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bookmark-url {
    font-size: 0.75em;
    color: #666;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* --- 3. 모달 (공통) --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--color-overlay);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    width: min(90%, 500px);
    background-color: #222;
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--color-border);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    text-align: left;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #444;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.2em;
    color: var(--color-accent);
}

.close-btn {
    background: none;
    border: none;
    color: #aaa;
    font-size: 1.5em;
    cursor: pointer;
}

.close-btn:hover {
    color: #fff;
}

/* --- 4. 메뉴 그리드 (공통) --- */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    width: 100%;
}

.menu-wrapper {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.menu-item {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    aspect-ratio: 1.6 / 0.8;
    background: #333;
    border-radius: 12px;
    font-size: 2.2em;
    border: 1px solid #444;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    transition: background 0.2s, transform 0.2s;
}

.menu-wrapper:hover .menu-item {
    background: #444;
    border-color: #666;
    transform: scale(0.98);
}

.menu-label {
    margin-top: 8px;
    font-size: 1.0em;
    font-weight: bold;
    color: #ccc;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* --- 5. 검색 & 필터 컨트롤 --- */
.controls-container {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-bar {
    flex: 1;
    min-width: 200px;
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background-color: var(--color-bg-input);
    color: #fff;
    font-size: 1em;
}

.search-bar:focus {
    outline: none;
    border-color: var(--color-accent);
}

.filter-container {
    display: flex;
    gap: 8px;
}

select {
    padding: 12px;
    background-color: var(--color-bg-elevated);
    color: #eee;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-weight: bold;
    cursor: pointer;
    font-size: 1em;
}

select:focus {
    outline: none;
    border-color: var(--color-accent);
}

/* --- 신고 모달 폼 스타일 (공통) --- */
.form-title {
    color: var(--color-accent);
    border-bottom: 2px solid #444;
    padding-bottom: 10px;
    margin-top: 0;
}

.form-field-label {
    display: block;
    margin-top: 15px;
    margin-bottom: 5px;
    font-weight: bold;
    color: #ccc;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    background-color: var(--color-bg-form);
    color: #eee;
    font-size: 1em;
    box-sizing: border-box;
    font-family: inherit;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-accent);
}

.form-textarea {
    min-height: 120px;
    max-height: 400px;
    /* 🔧 최대 높이 제한 - 화면 뚫고 내려가는 버그 방지 */
    resize: vertical;
}

.form-submit-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin-top: 20px;
    background-color: var(--color-link-blue);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.form-submit-btn:hover {
    background-color: var(--color-link-blue-hover);
}

/* 버그 제보 모달 콤팩트 스타일 전역 적용 */
#report-modal .modal-content {
    width: fit-content !important;
    min-width: 300px;
    max-width: 90vw;
    margin: 0 auto;
    transition: all 0.3s ease;
}

.report-modal-content {
    position: relative;
}

.report-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
}

.report-modal-description {
    color: #aaa;
    font-size: 0.9em;
}

.report-modal-help {
    display: block;
    margin-top: 5px;
    color: #ff9f43;
    font-size: 0.9em;
    font-weight: normal;
}

.report-modal-status {
    display: none;
    margin-top: 15px;
    color: #ffc107;
    text-align: center;
}
