/* 現代化模態框樣式 - 基於 Uiverse.io 設計風格 */

/* 模態框背景遮罩 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    animation: modalFadeIn 0.3s ease-out;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(10px);
    }
}

/* 模態框內容容器 */
.modal-content {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    margin: 0;
    padding: 0;
    border-radius: 24px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: center;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 模態框標題區域 */
.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 24px 32px;
    border-bottom: none;
    position: relative;
    overflow: hidden;
}

.modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.modal-title i {
    font-size: 1.25rem;
    opacity: 0.9;
}

/* 關閉按鈕 */
.btn-close, .close, .close-btn {
    position: absolute;
    top: 20px;
    right: 24px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    font-size: 18px;
    backdrop-filter: blur(10px);
}

.btn-close:hover, .close:hover, .close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* 模態框主體內容 */
.modal-body {
    padding: 32px;
    background: linear-gradient(145deg, #ffffff, #f8fafc);
}

/* 表單樣式增強 */
.form-label {
    font-weight: 600;
    color: var(--text-color, #1f2937);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
    color: var(--text-color, #1f2937);
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 
        0 0 0 4px rgba(102, 126, 234, 0.1),
        inset 0 2px 4px rgba(0,0,0,0.06);
    background: white;
    transform: translateY(-1px);
    color: var(--text-color, #1f2937);
}

.form-control::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

/* 輸入組樣式 */
.input-group {
    position: relative;
    margin-bottom: 24px;
}

.input-group .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: none;
    height: 54px;
}

/* 按鈕樣式增強 */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    text-decoration: none;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 
        0 4px 14px 0 rgba(102, 126, 234, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 25px 0 rgba(102, 126, 234, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-secondary {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
    box-shadow: 
        0 4px 14px 0 rgba(107, 114, 128, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 25px 0 rgba(107, 114, 128, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-outline-primary {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    border: 2px solid rgba(102, 126, 234, 0.3);
    backdrop-filter: blur(10px);
}

.btn-outline-primary:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
}

/* 複選框樣式 */
.form-check {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
}

.form-check-input {
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-check-input:checked {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
}

.form-check-label {
    color: #374151;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

/* 網格佈局 */
.d-grid {
    display: grid;
    gap: 16px;
}

/* 文本對齊 */
.text-center {
    text-align: center;
}

/* 間距工具類 */
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mt-3 { margin-top: 16px; }
.me-2 { margin-right: 8px; }

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

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

.chat-status {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    margin-bottom: 20px;
    color: white;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.3);
}

.status-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.9;
}

.status-text {
    font-size: 1.1rem;
    font-weight: 600;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: linear-gradient(145deg, #f8fafc, #ffffff);
    border-radius: 16px;
    margin-bottom: 20px;
    min-height: 300px;
    border: 1px solid rgba(0,0,0,0.05);
}

.chat-message {
    margin-bottom: 12px;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
    position: relative;
    animation: messageSlideIn 0.3s ease-out;
}

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

.chat-message.own {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-left: auto;
    text-align: right;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.chat-message.other {
    background: linear-gradient(145deg, #ffffff, #f1f5f9);
    color: #374151;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chat-message .sender {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-bottom: 4px;
    font-weight: 600;
}

.chat-input-area {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.chat-input-area input {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 25px;
    outline: none;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.chat-input-area input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    background: white;
}

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

/* 大型模態框 */
.large-modal .modal-content {
    width: 95%;
    max-width: 900px;
    height: 85vh;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 20px auto;
        border-radius: 20px;
    }
    
    .modal-header {
        padding: 20px 24px;
    }
    
    .modal-body {
        padding: 24px;
    }
    
    .modal-title {
        font-size: 1.25rem;
    }
    
    .btn {
        padding: 12px 24px;
        font-size: 0.95rem;
    }
    
    .form-control {
        padding: 14px 16px;
    }
}

/* 暗色主題支持 */
@media (prefers-color-scheme: dark) {
    .modal-content {
        background: linear-gradient(145deg, #1f2937, #111827);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .modal-body {
        background: linear-gradient(145deg, #1f2937, #111827);
    }
    
    .form-control {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.1);
        color: white;
    }
    
    .form-control:focus {
        background: rgba(255, 255, 255, 0.1);
        border-color: #667eea;
    }
    
    .form-label {
        color: #e5e7eb;
    }
    
    .chat-messages {
        background: linear-gradient(145deg, #374151, #1f2937);
    }
    
    .chat-message.other {
        background: linear-gradient(145deg, #4b5563, #374151);
        color: #e5e7eb;
        border-color: rgba(255, 255, 255, 0.1);
    }
}