/* @TASK P2-S0-T1 - Blog AI Styles */
/* @SPEC Blog AI Dashboard - Complete UI styling */

/* ===== AI Theme Colors ===== */
:root {
  --blog-ai: #8B5CF6;
  --blog-ai-light: #A78BFA;
  --blog-ai-dark: #7C3AED;
  --blog-streaming: #06B6D4;
  --blog-streaming-light: #22D3EE;
}

/* ===== Page Header ===== */
.blog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  padding: 24px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.blog-header h1 {
  font-size: 24px;
  font-weight: 600;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 12px;
}

.blog-header-actions {
  display: flex;
  gap: 12px;
}

/* ===== Blog Cards ===== */
.blog-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.blog-card {
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: 12px;
  padding: 24px;
  transition: all 0.2s;
  cursor: pointer;
  position: relative;
}

.blog-card:hover {
  border-color: var(--blog-ai);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.1);
  transform: translateY(-2px);
}

.blog-card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 16px;
}

.blog-card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 8px;
  line-height: 1.4;
}

.blog-card-prompt {
  font-size: 14px;
  color: var(--gray-500);
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--gray-500);
}

/* ===== Status Badges ===== */
.blog-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
}

.blog-status-badge.draft {
  background: #F3F4F6;
  color: #6B7280;
}

.blog-status-badge.generating {
  background: #FEF3C7;
  color: #92400E;
  animation: pulse 2s infinite;
}

.blog-status-badge.completed {
  background: #D1FAE5;
  color: #065F46;
}

.blog-status-badge.published {
  background: #DBEAFE;
  color: #1E40AF;
}

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

/* ===== Blog Editor ===== */
.blog-editor {
  background: white;
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 24px;
}

.blog-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--gray-200);
}

.blog-editor-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--gray-900);
  border: none;
  outline: none;
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  transition: background 0.2s;
}

.blog-editor-title:focus,
.blog-editor-title[contenteditable]:focus {
  background: var(--gray-100);
}

.blog-editor-content {
  min-height: 400px;
  font-size: 16px;
  line-height: 1.8;
  color: var(--gray-700);
  border: none;
  outline: none;
  padding: 16px;
  border-radius: 8px;
  transition: background 0.2s;
}

.blog-editor-content:focus,
.blog-editor-content[contenteditable]:focus {
  background: var(--gray-100);
}

.blog-editor-status {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 1000;
}

.blog-editor-status.info {
  background: #DBEAFE;
  color: #1E40AF;
}

.blog-editor-status.success {
  background: #D1FAE5;
  color: #065F46;
}

.blog-editor-status.error {
  background: #FEE2E2;
  color: #991B1B;
}

/* ===== AI Chat Panel ===== */
.ai-chat-panel {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  height: 100vh;
  background: white;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
  z-index: 1000;
}

.ai-chat-panel.open {
  right: 0;
}

.ai-chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--gray-200);
  background: linear-gradient(135deg, var(--blog-ai) 0%, var(--blog-ai-light) 100%);
}

.ai-chat-title {
  font-size: 18px;
  font-weight: 600;
  color: white;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-chat-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.ai-chat-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ===== Chat Messages ===== */
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-chat-message {
  display: flex;
  gap: 12px;
  align-items: start;
}

.ai-chat-message.user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.ai-chat-message.assistant .message-avatar {
  background: linear-gradient(135deg, var(--blog-ai) 0%, var(--blog-ai-light) 100%);
}

.message-content {
  flex: 1;
  max-width: 280px;
}

.message-text {
  background: var(--gray-100);
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--gray-900);
}

.ai-chat-message.user .message-text {
  background: var(--blog-ai);
  color: white;
}

.ai-chat-message.assistant .message-text {
  background: var(--gray-100);
}

.message-time {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 4px;
  padding: 0 16px;
}

.ai-chat-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-500);
}

.empty-hint {
  font-size: 12px;
  margin-top: 8px;
}

/* ===== Chat Input ===== */
.ai-chat-input-wrapper {
  border-top: 1px solid var(--gray-200);
  padding: 16px;
  background: white;
}

.ai-chat-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-chat-input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 14px;
  resize: none;
  font-family: inherit;
}

.ai-chat-input:focus {
  outline: none;
  border-color: var(--blog-ai);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.ai-chat-actions {
  display: flex;
  justify-content: flex-end;
}

/* ===== Streaming Cursor ===== */
.streaming-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--blog-streaming);
  margin-left: 2px;
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.streaming-text {
  position: relative;
  display: inline;
}

/* ===== Status Indicator ===== */
.ai-chat-status {
  padding: 12px 16px;
  background: var(--gray-100);
  border-top: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--gray-600);
}

.typing-indicator {
  display: flex;
  gap: 4px;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background: var(--blog-ai);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-10px); }
}

/* ===== File Upload ===== */
.file-dropzone {
  border: 2px dashed var(--gray-300);
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
  background: var(--gray-100);
}

.file-dropzone:hover {
  border-color: var(--blog-ai);
  background: #F5F3FF;
}

.file-dropzone.dragover {
  border-color: var(--blog-ai);
  background: #F5F3FF;
  border-width: 3px;
}

.file-dropzone-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.file-dropzone-text {
  font-size: 16px;
  color: var(--gray-700);
  margin-bottom: 8px;
}

.file-dropzone-hint {
  font-size: 12px;
  color: var(--gray-500);
}

/* ===== File Preview ===== */
.file-preview {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.file-preview-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
}

.file-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.file-info {
  flex: 1;
}

.file-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-900);
  margin-bottom: 4px;
}

.file-size {
  font-size: 12px;
  color: var(--gray-500);
}

.file-remove {
  background: transparent;
  border: none;
  color: var(--gray-500);
  font-size: 24px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.file-remove:hover {
  background: var(--gray-100);
  color: var(--danger);
}

/* ===== Blog Search ===== */
.blog-search {
  position: relative;
  margin-bottom: 24px;
}

.blog-search-input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 16px;
}

.blog-search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--gray-500);
}

/* ===== Pagination ===== */
.blog-pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 32px;
}

.blog-pagination a,
.blog-pagination span {
  padding: 8px 16px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  text-decoration: none;
  color: var(--gray-700);
  transition: all 0.2s;
}

.blog-pagination a:hover {
  border-color: var(--blog-ai);
  background: #F5F3FF;
}

.blog-pagination .current {
  background: var(--blog-ai);
  color: white;
  border-color: var(--blog-ai);
}

/* ===== Empty State ===== */
.blog-empty-state {
  text-align: center;
  padding: 64px 24px;
  background: white;
  border-radius: 12px;
}

.blog-empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.blog-empty-text {
  font-size: 18px;
  color: var(--gray-700);
  margin-bottom: 8px;
}

.blog-empty-hint {
  font-size: 14px;
  color: var(--gray-500);
  margin-bottom: 24px;
}

/* ===== Prompt Form ===== */
.blog-prompt-form {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.blog-prompt-textarea {
  width: 100%;
  min-height: 120px;
  padding: 16px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 16px;
  resize: vertical;
  font-family: inherit;
}

.blog-prompt-textarea:focus {
  outline: none;
  border-color: var(--blog-ai);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* ===== Tone & Length Selectors ===== */
.blog-tone-selector,
.blog-length-selector {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.blog-tone-option,
.blog-length-option {
  flex: 1;
}

.blog-tone-option input[type="radio"],
.blog-length-option input[type="radio"] {
  display: none;
}

.blog-tone-label,
.blog-length-label {
  display: block;
  padding: 12px 16px;
  border: 2px solid var(--gray-300);
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.blog-tone-option input[type="radio"]:checked + .blog-tone-label,
.blog-length-option input[type="radio"]:checked + .blog-length-label {
  border-color: var(--blog-ai);
  background: #F5F3FF;
  color: var(--blog-ai);
}

.blog-tone-label:hover,
.blog-length-label:hover {
  border-color: var(--blog-ai-light);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .ai-chat-panel {
    width: 100%;
    right: -100%;
  }

  .blog-cards {
    grid-template-columns: 1fr;
  }

  .blog-editor {
    padding: 16px;
  }

  .blog-editor-title {
    font-size: 24px;
  }

  .blog-header {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .blog-header-actions {
    justify-content: stretch;
    flex-direction: column;
  }

  .blog-tone-selector,
  .blog-length-selector {
    flex-direction: column;
  }
}
