/**
 * AI Engine Forms - フロントエンドスタイル
 */

.ai-contact-form-container {
  max-width: 600px;
  margin: 20px auto;
  padding: 20px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.ai-contact-form-container h3 {
  margin-top: 0;
  margin-bottom: 20px;
  color: #333;
  font-size: 24px;
}

.ai-form-group {
  margin-bottom: 15px;
}

.ai-form-label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
  color: #333;
}

.ai-form-input,
.ai-form-textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  box-sizing: border-box;
  transition: border-color 0.3s;
}

.ai-form-input:focus,
.ai-form-textarea:focus {
  outline: none;
  border-color: #0073aa;
  box-shadow: 0 0 5px rgba(0,115,170,0.3);
}

.ai-form-textarea {
  min-height: 100px;
  resize: vertical;
  font-family: inherit;
}

.ai-form-submit {
  background: #0073aa;
  color: white;
  padding: 12px 24px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  width: 100%;
  transition: background 0.3s;
}

.ai-form-submit:hover {
  background: #005177;
}

.ai-form-submit:active {
  transform: translateY(1px);
}

.ai-response {
  margin-top: 20px;
  padding: 15px;
  border-radius: 4px;
  display: none;
  animation: fadeIn 0.3s;
}

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

.ai-response.loading {
  display: block;
  background: #f0f0f0;
  color: #666;
  text-align: center;
}

.ai-response.loading::before {
  content: "⏳ ";
}

.ai-response.success {
  display: block;
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.ai-response.success::before {
  content: "✅ ";
}

.ai-response.error {
  display: block;
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.ai-response.error::before {
  content: "❌ ";
}

.ai-response.streaming {
  display: block;
  background: #e7f3ff;
  color: #004085;
  border: 1px solid #b8daff;
  animation: pulse 1.5s ease-in-out infinite;
}

.ai-response.streaming::before {
  content: "✨ ";
}

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

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .ai-contact-form-container {
    padding: 15px;
    margin: 10px;
  }

  .ai-form-submit {
    padding: 10px 20px;
    font-size: 14px;
  }
}

/* ダークモード対応 */
@media (prefers-color-scheme: dark) {
  .ai-contact-form-container {
    background: #2d2d2d;
    border-color: #444;
  }

  .ai-contact-form-container h3 {
    color: #fff;
  }

  .ai-form-label {
    color: #ddd;
  }

  .ai-form-input,
  .ai-form-textarea {
    background: #1a1a1a;
    border-color: #444;
    color: #fff;
  }

  .ai-form-input:focus,
  .ai-form-textarea:focus {
    border-color: #0073aa;
  }
}

/* AI補完ボタン */
.ai-textarea-wrapper {
    position: relative;
}

.ai-enhance-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
    position: absolute;
    right: 10px;
    bottom: 10px;
}

.ai-enhance-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
}

.ai-enhance-button:active:not(:disabled) {
    transform: translateY(0);
}

.ai-enhance-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ai-enhance-icon {
    font-size: 18px;
    animation: sparkle 1.5s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.2) rotate(10deg); }
}

/* ローディング表示 */
.ai-enhance-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-top: 10px;
}

.ai-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* 途中結果の表示領域 */
.ai-partial-result {
    display: none;
    background: #fff3cd;
    border: 1px solid #ffa500;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 20px;
    animation: slideDown 0.3s ease-out;
}

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

.ai-partial-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #fed7aa;
}

.ai-partial-content {
    background: #fef9f3;
    padding: 15px;
    border-radius: 4px;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 300px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.6;
}

.ai-continue-button {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(245, 87, 108, 0.3);
}

.ai-continue-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(245, 87, 108, 0.4);
}

.ai-continue-button:active:not(:disabled) {
    transform: translateY(0);
}

.ai-continue-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

