/* style.css (Final Version) */

/* =========================================
   1. 기본 설정 & 변수 (Design System)
   ========================================= */
:root {
    /* 브랜드 컬러: 강렬한 레드 vs 쿨한 블루 */
    --color-a: #c04842;       /* A팀 (Red) */
    --color-a-bg: #fff5f5;    /* A팀 배경 (연한 레드) */
    --color-b: #3d84c2;       /* B팀 (Blue) */
    --color-b-bg: #e7f5ff;    /* B팀 배경 (연한 블루) */
    
    --bg-main: #dadee2;       /* 전체 배경색 (연회색) */
    --text-main: #212529;     /* 기본 검은 글씨 */
    --text-gray: #868e96;     /* 회색 글씨 */
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); /* 그림자 */
}

/* 폰트 설정 */
body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: var(--bg-main); /* 이미지가 로드되지 않을 경우를 대비한 배경색 */
    color: var(--text-main);
    margin: 0;
    padding: 0;
    line-height: 1.6;

    /* 배경 이미지 설정 */
    background-image: url('background.jpg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.7);
    z-index: -1;
}
.logo, .badge {
    font-family: 'Black Han Sans', sans-serif; /* 제목용 임팩트 폰트 */
}

h1, h2, h3 {
    font-family: sans-serif;
    font-weight: bold;
}



/* 공통 유틸리티 */
.container {
    max-width: 600px; /* 모바일 최적화 너비 */
    margin: 0 auto;
    padding: 20px;
}

.hidden { display: none !important; }

/* =========================================
   2. 헤더 (App Bar)
   ========================================= */
.main-header, .app-header {
    background: #fff;
    padding: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content {
    max-width: 600px;
    margin: 0 auto;
}

.logo {
    margin: 0;
    cursor: pointer;
    line-height: 0; /* 이미지 하단 여백 제거 */
}

.logo img {
    height: 80px; /* 헤더 높이에 맞춰 조정 */
    width: auto;
    display: block; /* 이미지 하단 여백 제거 */
}

.back-btn {
    text-decoration: none;
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

/* =========================================
   3. 메인 광장 (index.php) - 카드 디자인
   ========================================= */
.debate-card {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s;
}

.debate-card:hover {
    transform: translateY(-2px); /* 살짝 떠오르는 효과 */
}

.card-topic {
    font-size: 20px;
    margin: 0 0 15px 0;
    line-height: 1.3;
}

.badge {
    display: inline-block;
    background: #333;
    color: #fff;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 5px;
    vertical-align: middle;
}


.versus-summary {
    display: flex;
    justify-content: space-between;
    align-items: flex-start; /* 위쪽 정렬 */
    margin-bottom: 15px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 12px;
}

.side { 
    flex: 1; 
    display: flex;
    flex-direction: column;
    gap: 4px; /* 제목과 내용 사이 간격 */
}

.side.a-side { text-align: left; }
.side.b-side { text-align: right; }

/* 🔥 핵심: 결론(Stance) 스타일 */
.stance-title {
    font-size: 16px;
    font-weight: 900; /* 아주 두껍게 */
    font-family: sans-serif; /* 제목 폰트 사용 */
    font-weight: bold;
    margin-bottom: 2px;
}

.a-side .stance-title { color: var(--color-a); }
.b-side .stance-title { color: var(--color-b); }

/* 📄 핵심: 이유(Logic) 스타일 */
.logic-text {
    font-size: 12px;
    color: #868e96; /* 회색으로 차분하게 */
    font-weight: normal;
    word-break: keep-all; /* 단어 단위 줄바꿈 */
    line-height: 1.4;
}

.vs-divider {
    font-family: 'Black Han Sans';
    font-size: 20px;
    margin: 10px 15px; /* 간격 조정 */
    color: #ddd;
    align-self: center; /* VS는 중앙 정렬 */
}


/* =========================================
   4. 투표 그래프 & 블라인드 모드 (핵심 수정!)
   ========================================= */
.vote-result-bar {
    height: 30px; /* 높이 약간 키움 */
    background: #eee;
    border-radius: 8px; /* 모서리 둥글게 */
    overflow: hidden;
    display: flex;
    margin-bottom: 15px;
    position: relative; /* 블라인드 텍스트 배치를 위해 */
}

.bar-fill {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #fff;
    font-weight: bold;
    transition: width 1s ease-in-out; /* 그래프 늘어나는 애니메이션 */
    white-space: nowrap; /* 글자 줄바꿈 방지 */
}

.bar-fill.a { background-color: var(--color-a); }
.bar-fill.b { background-color: var(--color-b); }

/* ▼▼▼ [수정됨] 블라인드 모드 스타일 ▼▼▼ */
.vote-result-bar.blind {
    background-color: #e9ecef !important; /* 배경색 회색 고정 */
    border: 1px solid #dee2e6; /* 외곽선 살짝 */
    cursor: help;
}

/* 블라인드 상태일 때는 그래프 바를 아예 숨김 (공간 차지 X) */
.vote-result-bar.blind .bar-fill {
    display: none !important;
}

/* 평소에는 블라인드 텍스트 숨김 */
.blind-text {
    display: none;
}

/* 블라인드 상태일 때만 텍스트 등장 & 중앙 정렬 */
.vote-result-bar.blind .blind-text {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: bold;
    color: #495057;
}
/* ▲▲▲ -------------------------------- ▲▲▲ */


/* 투표 버튼 그룹 */
.vote-actions {
    display: flex;
    gap: 10px;
}

.btn-vote-action {
    flex: 1;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-a { background-color: var(--color-a); }
.btn-b { background-color: var(--color-b); }

.btn-vote-action:active { filter: brightness(0.9); transform: scale(0.98); }

.count-badge {
    background: rgba(255,255,255,0.3);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
}

/* =========================================
   5. 생성 페이지 (create.php)
   ========================================= */
.create-container {
    height: 90vh;
    display: flex;
    flex-direction: column;
}

/* 입력 섹션 */
.input-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.guide-text { font-size: 28px; margin-bottom: 30px; word-break: keep-all; }

.input-wrapper { width: 100%; margin-bottom: 20px; }

input[type="text"] {
    width: 100%;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 12px;
    font-size: 16px;
    margin-bottom: 15px;
    box-sizing: border-box;
}

input[type="text"]:focus {
    border-color: #333;
    outline: none;
}

.btn-primary, .btn-create {
    background: #333;
    color: #fff;
    border: none;
    padding: 15px 25px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    box-sizing: border-box;
}

.btn-create { width: auto; font-size: 14px; padding: 10px 15px; }

/* 로딩 섹션 */
.loading-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #eee;
    border-top: 5px solid var(--color-a);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* =========================================
   6. 배틀 필드 (Chat UI)
   ========================================= */
.battle-section {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.topic-display {
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.5;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* A팀 말풍선 */
.bubble.a {
    align-self: flex-start;
    background-color: var(--color-a-bg);
    border: 1px solid #ffc9c9;
    border-top-left-radius: 4px;
    color: #c92a2a;
}

/* A팀 말풍선 라벨 */
.bubble.a::before {
    /* ▼▼▼ [수정] 고정 텍스트 대신 HTML의 data-label 값을 가져옴 ▼▼▼ */
    content: attr(data-label); 
    display: block;
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 5px;
    opacity: 0.8; /* 살짝 진하게 */
    color: #c92a2a; /* 텍스트 색상 명시 */
}

/* B팀 말풍선 */
.bubble.b {
    align-self: flex-end;
    background-color: var(--color-b-bg);
    border: 1px solid #d0ebff;
    border-top-right-radius: 4px;
    color: #1864ab;
}

/* B팀 말풍선 라벨 */
.bubble.b::before {
    /* ▼▼▼ [수정] 동일하게 attr 사용 ▼▼▼ */
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 5px;
    opacity: 0.8;
    text-align: right;
    color: #1864ab; /* 텍스트 색상 명시 */
}

/* 판결 영역 */
.judgment-area {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #eee;
    background: #fff;
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.btn-vote {
    flex: 1;
    padding: 15px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    transition: transform 0.1s;
}
.btn-vote:active { transform: scale(0.95); }

.btn-text {
    background: none;
    border: none;
    color: #888;
    text-decoration: underline;
    cursor: pointer;
    font-size: 13px;
    margin-top: 10px;
}

/* 플로팅 버튼 */
.fab-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: #333;
    color: #fff;
    border-radius: 50%;
    text-align: center;
    line-height: 60px;
    font-size: 30px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    text-decoration: none;
    transition: transform 0.2s;
    z-index: 200;
}
.fab-btn:active { transform: scale(0.9); }

/* style.css 추가 */

/* 목록의 [자세히 보기] 버튼 */
.view-detail-btn-area {
    display: grid;
    grid-template-columns: 1fr auto 1fr; /* [왼쪽 공간] [가운데 버튼] [오른쪽 공간] */
    align-items: center;
    margin-bottom: 15px;
}

.btn-view-detail {
    display: inline-block;
    padding: 8px 16px;
    grid-column: 2; /* 그리드의 2번째(가운데) 칸에 위치 */
    justify-self: center; /* 칸 안에서 가운데 정렬 */
    background-color: #f1f3f5;
    color: #495057;
    text-decoration: none;
    font-size: 13px;
    font-weight: bold;
    border-radius: 20px;
    transition: background 0.2s;
}

.btn-view-detail:hover {
    background-color: #e9ecef;
    color: #212529;
}

/* --- eeitso 게시물 신고 버튼용 스타일 --- */
.btn-report {
    grid-column: 3; /* 그리드의 3번째(오른쪽) 칸에 위치 */
    justify-self: end; /* 칸 안에서 오른쪽 끝으로 정렬 */
    background-color: #6a0a0a;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background-color 0.2s;
}

.btn-report img {
    width: 60%;
    height: 60%;
}

/* 상세 페이지(view.php) 전용 스타일 */
.debate-view-card {
    min-height: 80vh; /* 화면 꽉 차게 */
    display: flex;
    flex-direction: column;
}

.static-chat {
    flex: 1; /* 남은 공간 차지 */
    background: #f8f9fa; /* 채팅창 배경 */
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* 검색 섹션 */
.search-section {
    margin-bottom: 20px;
}

.search-form {
    display: flex;
    gap: 10px;
}

.search-form input[type="text"] {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 25px; /* 둥글게 */
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
    margin-bottom: 0; /* 기존 input 스타일 덮어쓰기 */
}

.search-form input[type="text"]:focus {
    border-color: #333;
}

.search-form button {
    background: #333;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%; /* 동그라미 버튼 */
    cursor: pointer;
    transition: transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.search-form button img {
    width: 32px;
    height: 32px;
}

.search-form button:active {
    transform: scale(0.95);
}

/* [추가] 카테고리 네비게이션 */
.category-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid #dee2e6;
}

.category-item {
    padding: 10px 5px;
    text-decoration: none;
    color: var(--text-gray);
    font-weight: bold;
    font-size: 15px;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease-in-out;
}

.category-item.active {
    color: var(--text-main);
    border-bottom-color: var(--text-main);
}

/* [추가] 추천 토론 새로고침 버튼 */
.refresh-section {
    text-align: center;
    margin-bottom: 20px;
}

.btn-refresh-list {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background-color: #fff;
    color: var(--text-main);
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    border-radius: 25px;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.2s;
}

.btn-refresh-list:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}

.btn-refresh-list img {
    width: 18px;
    height: 18px;
    filter: invert(1); /* 흰색 아이콘을 검은색으로 변경 */
}

/* 검색 결과 메시지 */
.search-result-msg {
    margin-top: 10px;
    font-size: 14px;
    color: #555;
    text-align: center;
}

.btn-reset {
    display: inline-block;
    margin-left: 5px;
    color: #e03131; /* 빨간색 X */
    text-decoration: none;
    font-weight: bold;
    font-size: 12px;
    background: #fff5f5;
    padding: 2px 8px;
    border-radius: 10px;
}

/* 검색 결과 없음 (Empty State) 스타일 보강 */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    color: #888;
}

/* [추가] 헤더 새로고침 버튼 */
.btn-refresh {
    background: #333;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    margin-right: 15px; /* 오른쪽 여백 추가 */
    flex-shrink: 0; /* 버튼이 찌그러지지 않도록 함 */
}
.btn-refresh img {
    width: 20px;
    height: 20px;
}
.btn-refresh:active { transform: rotate(180deg); }

/* [추가] 슬라이드 오버 (Slide Over) */
.slide-over {
    position: fixed;
    top: 0;
    right: -100%; /* 처음엔 화면 밖 */
    width: 100%;
    max-width: 600px; /* 모바일 풀화면, PC에선 적당히 */
    height: 100%;
    background: #fff;
    z-index: 1000;
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    transition: right 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
}

.slide-over.open { right: 0; } /* 열릴 때 */

.slide-over-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
    backdrop-filter: blur(2px);
}
.slide-over-backdrop.open { display: block; }

.slide-over-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
}

.slide-header-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-share-slide {
    background: #333;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background-color 0.2s;
}

.btn-share-slide img {
    width: 32px;
    height: 32px;
}

.btn-close-slide {
    background: none;
    border: none;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    padding: 5px 10px;
}

.slide-over-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

/* 기존 view.php 스타일 재활용 */
.slide-debate-card {
    background: #fff;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* 무한 스크롤 로딩바 */
.loading-spinner.hidden { display: none; }


/* 리플레이 대기 상태 (숨김) */
.bubble.wait {
    opacity: 0;
    transform: translateY(20px); /* 아래에서 대기 */
}

/* 리플레이 등장 상태 (애니메이션) */
.bubble.reveal {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* 쫀득한 효과 */
}


/* 광고 영역 스타일 */
.ad-section {
    align-items: center;
}
.ad-title {
    font-size: 13px;
    font-weight: bold;
    color: #555;
    margin-bottom: 10px;
}
.ad-section.list-ad {
    width: 90%; /* 너비 90% */
    margin: 0 auto 20px; /* 상단 0, 좌우 auto (중앙 정렬), 하단 20px */
    border-top: none;    /* 리스트 안에서는 구분선 제거가 더 깔끔함 */
    background: #e9ecef; /* 살짝 다른 배경색으로 구분 */
    border-radius: 16px;
}

/* [추가] 신고 모달 스타일 */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1999; /* 슬라이드 오버보다 아래 */
}

.modal-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 400px;
    background: #fff;
    border-radius: 16px;
    z-index: 2000;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    padding: 25px;
}

.modal-content .modal-title {
    font-size: 20px;
    margin-top: 0;
    margin-bottom: 10px;
    text-align: center;
}

.modal-content .modal-description {
    font-size: 13px;
    color: var(--text-gray);
    text-align: center;
    margin-bottom: 20px;
}

.report-reason-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
}

.report-reason-group label {
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.report-reason-group input[type="radio"] {
    margin-right: 10px;
    accent-color: var(--color-a); /* A팀 컬러 사용 */
}

#reportDetails {
    width: 100%;
    height: 80px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    margin-bottom: 20px;
    box-sizing: border-box;
}

.modal-actions {
    display: flex;
    gap: 10px;
}

.btn-modal-cancel, .btn-modal-submit {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
}

.btn-modal-cancel { background-color: #e9ecef; color: #495057; }
.btn-modal-submit { background-color: var(--color-a); color: #fff; }
	margin: 10px;
}
