/* 主要樣式文件 - 引入所有CSS模塊 */
@import url('css/base.css');
@import url('css/navigation.css');
@import url('css/modals.css');
@import url('css/forms.css');
@import url('css/games.css');
@import url('css/social.css');
@import url('css/responsive.css');

/* 保留的核心樣式 */
/* 全局樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans TC', 'Noto Sans SC', 'Inter', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 連接狀態指示器 */
.connection-status {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 10px 15px;
    border-radius: 25px;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 1000;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.connection-status.connecting {
    background: rgba(255, 193, 7, 0.9);
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.connection-status.connected {
    background: rgba(40, 167, 69, 0.9);
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.connection-status.disconnected {
    background: rgba(220, 53, 69, 0.9);
    border: 1px solid rgba(220, 53, 69, 0.3);
}

/* 錯誤處理樣式 */
.critical-error {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.error-content {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.error-content h3 {
    color: #dc3545;
    margin-bottom: 1rem;
}

.error-content button {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 1rem;
}

/* 頭部樣式 */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
}

.logo {
    color: #667eea;
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    color: #333;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: #667eea;
}

/* 聊天容器樣式 */
.chat-container {
    height: 400px;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
    border: 1px solid #dee2e6;
}

.chat-input {
    display: flex;
    padding: 1rem;
    background: white;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 8px 8px;
}

.chat-input input {
    flex: 1;
    margin-right: 0.5rem;
}

.message {
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    border-radius: 5px;
}

.message.own {
    background: #e3f2fd;
    text-align: right;
}

.message.other {
    background: #f5f5f5;
}

/* 遊戲卡片樣式 */
.games-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.game-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.15);
}

.game-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.game-card h3 {
    margin-bottom: 1rem;
    color: white !important;
}

.game-card p {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav {
        flex-direction: column;
        gap: 1rem;
    }
    
    .games-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .connection-status {
        top: 10px;
        right: 10px;
        font-size: 0.8rem;
        padding: 8px 12px;
    }
}

.games-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.game-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.game-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.game-card h4 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.game-card p {
    color: #666;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.game-info {
    color: #667eea;
    font-weight: 500;
    font-size: 0.9rem;
}

/* 模態框樣式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 15px;
    width: 90%;
    max-width: 800px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 1rem;
}

.close:hover {
    color: #000;
}

/* 房間選項樣式 */
.room-options {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 2rem;
}

#create-room {
    padding: 1rem 2rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

#create-room:hover {
    background: #5a6fd8;
}

.join-room {
    display: flex;
    gap: 1rem;
    align-items: center;
}

#room-code {
    flex: 1;
    padding: 1rem;
    border: 2px solid #ddd;
    border-radius: 10px;
    outline: none;
    font-size: 1rem;
}

#room-code:focus {
    border-color: #667eea;
}

#join-room {
    padding: 1rem 2rem;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.3s ease;
}

#join-room:hover {
    background: #218838;
}

/* 遊戲容器樣式 */
#game-container {
    min-height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

/* 聊天模態框樣式 */
.chat-modal {
    width: 90%;
    max-width: 600px;
    height: 80vh;
    max-height: 700px;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-status {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    margin-bottom: 15px;
    color: white;
}

.status-icon {
    font-size: 2em;
    margin-bottom: 10px;
}

.status-text {
    font-size: 1.1em;
    font-weight: 500;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 15px;
    min-height: 300px;
}

.chat-message {
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 15px;
    max-width: 80%;
    word-wrap: break-word;
}

.chat-message.own {
    background: #007bff;
    color: white;
    margin-left: auto;
    text-align: right;
}

.chat-message.other {
    background: #e9ecef;
    color: #333;
}

.chat-message .sender {
    font-size: 0.8em;
    opacity: 0.7;
    margin-bottom: 3px;
}

.chat-input-area {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.chat-input-area input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    outline: none;
    font-size: 14px;
}

.chat-input-area input:focus {
    border-color: #007bff;
}

.chat-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* 匹配系統樣式 */
.matchmaking-container {
    padding: 20px;
}

.game-selection h3 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.game-option {
    text-align: center;
    padding: 20px;
    border: 2px solid #e9ecef;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.game-option:hover {
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,123,255,0.2);
}

.game-option.selected {
    border-color: #007bff;
    background: #e3f2fd;
}

.game-option .game-icon {
    font-size: 2em;
    margin-bottom: 10px;
}

.game-option span {
    display: block;
    font-weight: 500;
    color: #333;
}

.match-status {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 20px;
}

.match-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* 私人房間樣式 */
.private-room-container {
    padding: 20px;
}

.room-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.room-tab {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
}

.room-tab.active {
    color: #007bff;
    border-bottom: 2px solid #007bff;
}

.room-content {
    position: relative;
}

.room-panel {
    display: none;
}

.room-panel.active {
    display: block;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #007bff;
}

.btn-full {
    width: 100%;
}

/* 公開房間樣式 */
.large-modal {
    width: 95%;
    max-width: 900px;
    height: 85vh;
}

.room-filters {
    display: flex;
    gap: 10px;
    align-items: center;
}

.room-filters select {
    padding: 8px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    outline: none;
}

.public-rooms-container {
    height: calc(100% - 60px);
    overflow-y: auto;
}

.rooms-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
    padding: 20px;
}

.room-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.room-card:hover {
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,123,255,0.1);
}

.room-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.room-name {
    font-weight: 600;
    color: #333;
    font-size: 1.1em;
}

.room-game {
    background: #007bff;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
}

.room-info {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 10px;
}

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

.player-count {
    color: #28a745;
    font-weight: 500;
}

.room-status {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
}

.room-status.waiting {
    background: #ffc107;
    color: #856404;
}

.room-status.playing {
    background: #dc3545;
    color: white;
}

/* 好友系統樣式 */
.friends-container {
    padding: 20px;
}

.friends-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.friends-tab {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
}

.friends-tab.active {
    color: #007bff;
    border-bottom: 2px solid #007bff;
}

.friends-content {
    position: relative;
    min-height: 400px;
}

.friends-panel {
    display: none;
}

.friends-panel.active {
    display: block;
}

.friends-list {
    max-height: 400px;
    overflow-y: auto;
}

.friend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    margin-bottom: 10px;
    background: white;
}

.friend-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.friend-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.friend-details h4 {
    margin: 0;
    color: #333;
    font-size: 1em;
}

.friend-details p {
    margin: 2px 0 0 0;
    color: #666;
    font-size: 0.8em;
}

.friend-status {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
}

.friend-status.online {
    background: #28a745;
    color: white;
}

.friend-status.offline {
    background: #6c757d;
    color: white;
}

.friend-actions {
    display: flex;
    gap: 8px;
}

.search-results {
    margin-top: 20px;
}

.search-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 8px;
}

.friend-requests {
    max-height: 400px;
    overflow-y: auto;
}

.friend-request-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    margin-bottom: 10px;
    background: #f8f9fa;
}

.request-actions {
    display: flex;
    gap: 8px;
}

/* 按鈕樣式增強 */
.btn-small {
    padding: 6px 12px;
    font-size: 0.8em;
}

.btn-warning {
    background: #ffc107;
    color: #856404;
    border: 2px solid #ffc107;
}

.btn-warning:hover {
    background: #e0a800;
    border-color: #e0a800;
}

.btn-success {
    background: #28a745;
    color: white;
    border: 2px solid #28a745;
}

.btn-success:hover {
    background: #218838;
    border-color: #218838;
}

/* 設置模態框樣式 */
.settings-container {
    padding: 1rem;
}

.settings-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-section h3 {
    margin: 0 0 1rem 0;
    color: #fff;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.setting-item {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.setting-item label {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.setting-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #007bff;
}

.setting-item input[type="range"] {
    flex: 1;
    max-width: 150px;
    accent-color: #007bff;
}

.setting-item select {
    padding: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1rem;
}

.setting-item select option {
    background: #2c3e50;
    color: #fff;
}

.settings-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-actions .btn {
    min-width: 120px;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .setting-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .setting-item input[type="range"] {
        width: 100%;
        max-width: none;
    }
    
    .settings-actions {
        flex-direction: column;
    }
    
    .settings-actions .btn {
        width: 100%;
    }
}
    .chat-modal,
    .large-modal {
        width: 95%;
        height: 90vh;
    }
    
    .game-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .rooms-list {
        grid-template-columns: 1fr;
        padding: 10px;
    }
    
    .friends-tabs,
    .room-tabs {
        flex-direction: column;
    }
    
    .friends-tab,
    .room-tab {
        border-bottom: 1px solid #e9ecef;
        border-radius: 0;
    }
    
    .friends-tab.active,
    .room-tab.active {
        border-bottom: 1px solid #007bff;
        background: #e3f2fd;
    }
    
    .header .container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav {
        flex-direction: column;
        gap: 1rem;
    }

    .hero h2 {
        font-size: 2rem;
    }

    .games-row {
        grid-template-columns: 1fr;
    }

    .join-room {
        flex-direction: column;
    }

    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
}

/* 連線狀態指示器 */
.connection-status {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    color: white;
    font-weight: 500;
    z-index: 1001;
}

.connection-status.connected {
    background: #28a745;
}

.connection-status.disconnected {
    background: #dc3545;
}

.connection-status.connecting {
    background: #ffc107;
    color: #333;
}

/* 動畫效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.game-card {
    animation: fadeIn 0.5s ease-out;
}

.game-card:nth-child(1) { animation-delay: 0.1s; }
.game-card:nth-child(2) { animation-delay: 0.2s; }
.game-card:nth-child(3) { animation-delay: 0.3s; }
.game-card:nth-child(4) { animation-delay: 0.4s; }