/* ================================================
   즐겨찾기 페이지 CSS
   ================================================ */

.favorites-main {
    background: #FBFFF1;
    min-height: calc(100vh - 120px);
    padding: 40px 0;
}

.page-title {
    font-size: 32px;
    font-weight: 700;
    color: #2C2C2C;
    margin-bottom: 30px;
}

/* 서버 필터 바 */
.server-filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.server-filter-btn {
    padding: 10px 24px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    color: #666;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.server-filter-btn:hover {
    background: #f8f9fa;
    border-color: #B4C5E4;
}

.server-filter-btn.active {
    background: #3C3744;
    border-color: #3C3744;
    color: white;
}

/* 즐겨찾기 테이블 */
#favoritesTableContainer {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
}

.favorites-table {
    width: 100%;
    border-collapse: collapse;
}

.favorites-table thead {
    background: #3C3744;
    color: white;
}

.favorites-table th {
    padding: 16px 20px;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
}

.favorites-table th:nth-child(1) { width: 25%; } /* 아이템 */
.favorites-table th:nth-child(2) { width: 10%; text-align: center; } /* 서버 */
.favorites-table th:nth-child(3) { width: 15%; text-align: right; } /* 현재가 */
.favorites-table th:nth-child(4) { width: 12%; text-align: center; } /* 변동 */
.favorites-table th:nth-child(5) { width: 25%; } /* 그래프 */
.favorites-table th:nth-child(6) { width: 13%; text-align: center; } /* 삭제 */

.favorites-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.favorites-table tbody tr:hover {
    background: #f8f9fa;
}

.favorites-table tbody tr:last-child {
    border-bottom: none;
}

.favorites-table td {
    padding: 16px 20px;
    vertical-align: middle;
}

/* 아이템 셀 */
.item-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.item-image-small {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    background: #f8f9fa;
    padding: 4px;
}

.item-name {
    font-size: 15px;
    font-weight: 600;
    color: #2C2C2C;
}

/* 서버 뱃지 */
.server-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11px; /* 폰트 크기 미세 축소 */
    font-weight: 700;
    text-align: center;
    line-height: 1.3; /* 줄 간격 조정 */
    vertical-align: middle;
}

.server-badge.scania {
    background: #E3F2FD;
    color: #1976D2;
}

.server-badge.challengers {
    background: #FCE4EC;
    color: #C2185B;
}

/* 가격 */
.price-cell {
    text-align: right;
    font-size: 16px;
    font-weight: 700;
    color: #2C2C2C;
}

/* 변동 */
.change-cell {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
}

.change-up {
    color: #FF6B6B;
}

.change-down {
    color: #1E90FF;
}

/* 검색 드롭다운 상세 스타일 */
#favoritesSearchDropdown .search-dropdown-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
}

#favoritesSearchDropdown .search-dropdown-item:hover {
    background: #f8f9fa;
}

#favoritesSearchDropdown .add-fav-btn {
    padding: 6px 12px;
    border-radius: 15px;
    border: none;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

/* 미니 그래프 */
.mini-chart-container {
    height: 40px;
    padding: 0 10px;
}

.mini-chart-container canvas {
    width: 100% !important;
    height: 40px !important;
}

/* 삭제 버튼 */
.delete-cell {
    text-align: center;
}

.delete-btn {
    padding: 8px 20px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    color: #666;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.delete-btn:hover {
    background: #FF6B6B;
    border-color: #FF6B6B;
    color: white;
}

/* 빈 상태 */
.empty-state-card {
    background: white;
    border-radius: 12px;
    padding: 80px 40px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.empty-message {
    font-size: 18px;
    font-weight: 600;
    color: #666;
    margin-bottom: 24px;
}

.add-item-btn {
    padding: 14px 32px;
    background: #B4C5E4;
    border: none;
    border-radius: 8px;
    color: #3C3744;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.add-item-btn:hover {
    background: #A0B3D8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(180, 197, 228, 0.4);
}

/* ================================================
   모바일 및 6.1인치 최적화 (Phase 1)
   ================================================ */

@media (max-width: 768px) {
    .favorites-main { padding: 20px 0 !important; }
    .page-title { font-size: 24px !important; margin-bottom: 20px !important; }

    /* 서버 필터 바 최적화 (한 줄 배치 강제) */
    .server-filter-bar { 
        display: flex !important;
        flex-wrap: nowrap !important; 
        gap: 5px !important; 
        margin-bottom: 20px !important;
        width: 100%;
    }
    .server-filter-btn { 
        padding: 8px 5px !important; /* 좌우 여백 축소 */
        font-size: 12px !important; /* 폰트 미세 축소 */
        flex: 1; 
        text-align: center;
        min-width: 0 !important; /* 압축 허용 */
        white-space: nowrap; /* 텍스트 줄바꿈 방지 */
    }

    /* 본 서버 -> 본 서버 로 축약 */
    .server-name-detail { display: none; }

    /* ★ 테이블을 카드 리스트로 변환 */
    .favorites-table thead { display: none; } /* 헤더 숨김 */
    
    .favorites-table, .favorites-table tbody, .favorites-table tr, .favorites-table td {
        display: block;
        width: 100%;
    }

    .favorites-table tr {
        background: white;
        margin-bottom: 15px;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.05);
        padding: 15px;
        border: 1px solid #eee !important;
    }

    .favorites-table td {
        padding: 5px 0 !important;
        border: none !important;
        text-align: left !important;
    }

    /* 아이템 정보 행 */
    .favorites-table td:nth-child(1) { order: 1; }
    .item-cell { gap: 15px !important; }
    .item-image-small { width: 50px !important; height: 50px !important; }
    .item-name { font-size: 16px !important; }

    /* 서버 뱃지 행 */
    .favorites-table td:nth-child(2) { 
        order: 2; 
        display: inline-block; 
        width: auto; 
        margin-top: 5px;
    }

    /* 가격 및 변동 정보 가로 배치 */
    .favorites-table td:nth-child(3), 
    .favorites-table td:nth-child(4) { 
        display: inline-block;
        width: auto;
        vertical-align: middle;
    }
    
    .price-cell { font-size: 15px !important; margin-right: 10px; }
    .change-cell { font-size: 13px !important; }

    /* 그래프 행 (모바일에서는 간소화하거나 필요시 표시) */
    .favorites-table td:nth-child(5) { 
        display: block !important; 
        margin-top: 10px; 
        padding-top: 10px !important;
        border-top: 1px solid #f0f0f0 !important;
    }

    /* 삭제 버튼 우측 상단 배치 */
    .favorites-table td:nth-child(6) {
        position: absolute;
        top: 15px;
        right: 15px;
        width: auto !important;
    }
    .delete-btn {
        padding: 5px 12px !important;
        font-size: 11px !important;
        background: #fdf2f2 !important;
        color: #FF6B6B !important;
        border-color: #ffebeb !important;
    }

    /* 호버 효과 제거 */
    .favorites-table tr:hover { background: white !important; }
    .delete-btn:hover { background: #FF6B6B !important; color: white !important; }
}
