/* OK111 Submission Modal - 樣式表 */

/* Modal 觸發按鈕 - 不覆蓋原有樣式，僅添加基本功能 */
.ok111-modal-trigger {
    cursor: pointer;
}

/* Modal 容器 */
.ok111-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modal 遮罩層 */
.ok111-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: ok111-fadeIn 0.3s ease;
}

/* Modal 主容器 */
.ok111-modal-container {
    position: relative;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: ok111-slideUp 0.3s ease;
    z-index: 1;
}

/* Modal Header */
.ok111-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
}

.ok111-modal-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
}

.ok111-modal-close {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.ok111-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* Modal Body */
.ok111-modal-body {
    padding: 24px;
    max-height: calc(90vh - 80px);
    overflow-y: auto;
}

/* 表單樣式 */
.ok111-modal-form .ok111-form-group {
    margin-bottom: 20px;
}

.ok111-modal-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333333;
    font-size: 14px;
}

.ok111-modal-form label .required {
    color: #e53e3e;
    margin-left: 2px;
}

.ok111-modal-form input[type="text"],
.ok111-modal-form input[type="tel"],
.ok111-modal-form input[type="number"],
.ok111-modal-form select,
.ok111-modal-form textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s ease;
    box-sizing: border-box;
    font-family: inherit;
}

.ok111-modal-form input:focus,
.ok111-modal-form select:focus,
.ok111-modal-form textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.ok111-modal-form textarea {
    resize: vertical;
    min-height: 100px;
}

.ok111-modal-form .form-hint {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: #718096;
}

.ok111-modal-form .form-notice {
    color: #e53e3e;
    font-size: 14px;
    margin: 0;
}

/* Checkbox Grid 樣式 */
.ok111-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.ok111-checkbox-label {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
    position: relative;
}

.ok111-checkbox-label:hover {
    border-color: #cbd5e0;
    background: #f7fafc;
}

.ok111-checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ok111-checkbox-label input[type="checkbox"]:checked + span {
    font-weight: 600;
    color: #667eea;
}

.ok111-checkbox-label input[type="checkbox"]:checked ~ * {
    border-color: #667eea;
}

.ok111-checkbox-label input[type="checkbox"]:checked {
    opacity: 1;
    position: relative;
    width: auto;
    height: auto;
}

/* 自訂 checkbox 樣式 */
.ok111-checkbox-label span {
    flex: 1;
    font-size: 14px;
    color: #4a5568;
    transition: all 0.2s ease;
}

.ok111-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    position: relative;
    opacity: 1;
    cursor: pointer;
    accent-color: #667eea;
}

/* 選中狀態的整個 label */
.ok111-checkbox-label:has(input[type="checkbox"]:checked) {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
}

/* 表單按鈕 */
.ok111-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    justify-content: flex-end;
}

.ok111-btn {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
}

.ok111-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.3);
}

.ok111-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
}

.ok111-btn-primary:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ok111-btn-secondary {
    background: #ffffff;
    color: #4a5568;
    border: 2px solid #e2e8f0;
}

.ok111-btn-secondary:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

/* 結果訊息 */
.ok111-modal-result {
    margin-top: 20px;
    padding: 16px 20px;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.6;
    animation: ok111-slideDown 0.3s ease;
}

.ok111-modal-result.success {
    background: #f0fdf4;
    color: #166534;
    border: 2px solid #86efac;
}

.ok111-modal-result.error {
    background: #fef2f2;
    color: #991b1b;
    border: 2px solid #fca5a5;
}

.ok111-modal-result strong {
    display: block;
    margin-bottom: 4px;
    font-size: 16px;
}

/* 響應式設計 */
@media (max-width: 640px) {
    .ok111-modal-container {
        width: 95%;
        max-height: 95vh;
        margin: 10px;
    }

    .ok111-modal-header {
        padding: 16px 20px;
    }

    .ok111-modal-title {
        font-size: 18px;
    }

    .ok111-modal-body {
        padding: 20px;
        max-height: calc(95vh - 70px);
    }

    .ok111-form-actions {
        flex-direction: column-reverse;
    }

    .ok111-btn {
        width: 100%;
    }
}

/* 動畫效果 */
@keyframes ok111-fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes ok111-slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* 表單驗證錯誤樣式 */
.ok111-modal-form input:invalid:not(:focus):not(:placeholder-shown),
.ok111-modal-form select:invalid:not(:focus):not(:placeholder-shown) {
    border-color: #f87171;
}

.ok111-modal-form input:valid:not(:placeholder-shown),
.ok111-modal-form select:valid:not(:placeholder-shown) {
    border-color: #86efac;
}

/* 載入動畫 */
.ok111-btn-primary.loading {
    position: relative;
    color: transparent;
}

.ok111-btn-primary.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: ok111-spin 0.6s linear infinite;
}

@keyframes ok111-spin {
    to {
        transform: rotate(360deg);
    }
}