/* UI 컴포넌트 스타일 */

/* 게임 메뉴 */
.game-menu {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px;
}

.game-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 20px;
    min-height: 120px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    -webkit-tap-highlight-color: transparent;
}

.game-card:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.game-card h3 {
    margin: 0 0 10px 0;
    color: #1f2937;
}

.game-card p {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}

/* 닉네임 입력 폼 */
.nickname-form {
    text-align: center;
    padding: 20px;
}

.nickname-form input {
    padding: 10px 12px;
    min-height: 40px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    margin: 0 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
    -webkit-appearance: none;
}

.nickname-form input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.1);
}

/* 닉네임 입력 컨테이너 */
.nickname-input-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 16px 0;
}

/* 연결 상태 표시 */
.connection-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 10px;
    animation: fadeIn 0.3s ease-in;
}

.connection-status.disconnected {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.connection-status.reconnecting {
    background-color: #fffbeb;
    color: #d97706;
    border: 1px solid #fed7aa;
}

.connection-status.reconnecting #connectionIcon {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 연결 상태 표시 */
.connection-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 10px;
    animation: fadeIn 0.3s ease-in;
}

.connection-status.disconnected {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.connection-status.reconnecting {
    background-color: #fffbeb;
    color: #d97706;
    border: 1px solid #fed7aa;
}

.connection-status.reconnecting #connectionIcon {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.nickname-form button {
    padding: 10px 16px !important;
    min-height: 40px !important;
    min-width: 80px !important;
    border: 1px solid #3b82f6 !important;
    border-radius: 6px !important;
    background: #3b82f6 !important;
    color: white !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.nickname-form button:hover {
    background: #2563eb !important;
    border-color: #2563eb !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 게임 상태 표시 */
.game-status {
    background: #f3f4f6;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 14px;
}

.game-status.waiting {
    background: #fef3c7;
    color: #92400e;
}

.game-status.playing {
    background: #d1fae5;
    color: #065f46;
}

.game-status.ended {
    background: #fee2e2;
    color: #991b1b;
}

/* 게임 정보 패널 */
.game-info-panel {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.game-info-panel h4 {
    margin: 0 0 8px 0;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 6px;
}

.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 6px;
    background: white;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.player-item.active {
    border-color: #3b82f6;
    background: #eff6ff;
}

.player-item.my-turn {
    border-color: #10b981;
    background: #ecfdf5;
}

.player-name {
    font-weight: 500;
    color: #1f2937;
}

.player-stone {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #6b7280;
}

.stone-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid #d1d5db;
}

.stone-indicator.black {
    background: #000;
}

.stone-indicator.white {
    background: #fff;
}

.game-stats {
    display: flex;
    gap: 8px;
    justify-content: space-between;
    margin-top: 8px;
    flex-wrap: nowrap;
}

.stat-item {
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    min-width: 0; /* flex 아이템 축소 허용 */
}

.stat-value {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.2;
}

.stat-label {
    font-size: 10px;
    color: #6b7280;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 채팅 패널 토글 기능 (PC에서도 적용) */
.chat-panel {
    position: relative;
}

.chat-panel h4 {
    cursor: pointer;
    position: relative;
}

.chat-panel::after {
    content: '▼';
    position: absolute;
    right: 12px;
    top: 12px;
    font-size: 10px;
    transition: transform 0.3s;
    color: #6b7280;
}

.chat-panel.collapsed::after {
    transform: rotate(-90deg);
}

.chat-panel.collapsed .chat-messages,
.chat-panel.collapsed .chat-input-container {
    display: none;
}


/* 플레이어 정보 */
.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    border-radius: 4px;
    margin-bottom: 4px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.player-item.active {
    background: #fef3c7;
    border-color: #f59e0b;
}

.player-item.my-turn {
    background: #dbeafe;
    border-color: #3b82f6;
}

.player-name {
    font-size: 12px;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.player-stone {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: #6b7280;
}

.stone-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid #333;
}

.stone-indicator.black {
    background: #000;
}

.stone-indicator.white {
    background: #fff;
}

/* 현재 턴 표시 */
#currentTurn {
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    padding: 4px 0;
}

/* 게임 버튼 스타일 (PC용) */
.game-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.game-buttons button {
    padding: 10px 16px;
    min-height: 40px;
    min-width: 80px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.game-buttons button:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #9ca3af;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.game-buttons button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.game-buttons button:disabled {
    background: #f3f4f6;
    color: #9ca3af;
    border-color: #e5e7eb;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 재시작 버튼 강조 (PC용) */
.game-buttons button#restartButton {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.game-buttons button#restartButton:hover:not(:disabled) {
    background: #2563eb;
    border-color: #2563eb;
}

/* 전역 버튼 스타일 - 오목 게임과 일관성 */
button:not(.excel-toolbar button):not(.quick-hide) {
    padding: 10px 16px;
    min-height: 40px;
    min-width: 80px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

button:not(.excel-toolbar button):not(.quick-hide):hover:not(:disabled) {
    background: #f9fafb;
    border-color: #9ca3af;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

button:not(.excel-toolbar button):not(.quick-hide):active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

button:not(.excel-toolbar button):not(.quick-hide):disabled {
    background: #f3f4f6;
    color: #9ca3af;
    border-color: #e5e7eb;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 특수 버튼 스타일 */
button.primary,
button[onclick*="joinRoomAsHost"],
button[onclick*="joinRoomByLink"] {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

button.primary:hover:not(:disabled),
button[onclick*="joinRoomAsHost"]:hover:not(:disabled),
button[onclick*="joinRoomByLink"]:hover:not(:disabled) {
    background: #2563eb;
    border-color: #2563eb;
}

/* 링크 복사 버튼 */
button[onclick*="copyToClipboard"] {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

button[onclick*="copyToClipboard"]:hover:not(:disabled) {
    background: #059669;
    border-color: #059669;
}

/* 전역 입력 필드 스타일 */
input[type="text"]:not(.opacity-slider),
input[type="range"]:not(.opacity-slider),
textarea {
    padding: 10px 12px;
    min-height: 40px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
    -webkit-appearance: none;
}

input[type="text"]:focus:not(.opacity-slider),
textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.1);
}

/* 메인 페이지 입력 필드 스타일 */
.room-link-input,
.room-url-input,
.nickname-input {
    width: 300px;
    max-width: 80%;
    margin: 10px;
    text-align: center;
}

.room-url-input {
    background: #f9fafb;
    color: #374151;
}

/* 메인 페이지 버튼 클래스 */
.back-button {
    margin: 10px 5px !important;
}

.join-room-button,
.join-game-button {
    background: #3b82f6 !important;
    color: white !important;
    border-color: #3b82f6 !important;
    margin: 5px !important;
}

.join-room-button:hover:not(:disabled),
.join-game-button:hover:not(:disabled) {
    background: #2563eb !important;
    border-color: #2563eb !important;
}

.copy-link-button {
    background: #10b981 !important;
    color: white !important;
    border-color: #10b981 !important;
    margin: 5px !important;
}

.copy-link-button:hover:not(:disabled) {
    background: #059669 !important;
    border-color: #059669 !important;
}

/* 위험한 액션 버튼 */
button[onclick*="confirmLeaveRoom"],
button[onclick*="leave"],
button[onclick*="exit"] {
    background: #ef4444 !important;
    color: white !important;
    border-color: #ef4444 !important;
}

button[onclick*="confirmLeaveRoom"]:hover:not(:disabled),
button[onclick*="leave"]:hover:not(:disabled),
button[onclick*="exit"]:hover:not(:disabled) {
    background: #dc2626 !important;
    border-color: #dc2626 !important;
}
