/* Thoughts CSS - Auth, Compose Box, Feed, Post Cards */

/* Auth buttons */
.auth-buttons { display: flex; gap: 0.75rem; margin-bottom: 1.5rem; }
.github-login-btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.6rem 1.25rem; background: #24292e; color: white; border: none; border-radius: 8px; font-size: 0.9rem; font-weight: 500; cursor: pointer; transition: background 0.2s, transform 0.2s; }
.github-login-btn:hover { background: #2f363d; }
.github-login-btn:active { transform: scale(0.98); }
.github-login-btn svg { width: 18px; height: 18px; }
.logout-btn { padding: 0.6rem 1.25rem; background: transparent; color: var(--text-secondary); border: 1px solid var(--border); border-radius: 8px; font-size: 0.9rem; font-weight: 500; cursor: pointer; transition: background 0.2s, color 0.2s; }
.logout-btn:hover { background: var(--code-bg); color: var(--text); }
.github-login-btn.hidden, .logout-btn.hidden { display: none; }
.logout-container { display: flex; justify-content: center; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.logout-container.hidden { display: none; }

/* Compose box */
.compose-box { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; margin-bottom: 1.5rem; box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px var(--shadow); }
.compose-box.hidden { display: none; }
.compose-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.compose-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-gradient); display: flex; align-items: center; justify-content: center; color: white; font-weight: 600; font-size: 1rem; flex-shrink: 0; overflow: hidden; }
.compose-avatar img { width: 100%; height: 100%; object-fit: cover; }
.compose-input { flex: 1; }
.compose-input textarea { width: 100%; min-height: 80px; max-height: 400px; padding: 0.75rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-family: inherit; font-size: 1rem; line-height: 1.5; resize: none; overflow-y: auto; transition: border-color 0.2s; }
.compose-input textarea:focus { outline: none; border-color: var(--accent); }
.compose-input textarea::placeholder { color: var(--text-secondary); }
.compose-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.compose-options { display: flex; gap: 0.5rem; }
.compose-option { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: none; border-radius: 50%; background: transparent; color: var(--accent); cursor: pointer; transition: background 0.2s; }
.compose-option:hover { background: var(--code-bg); }
.compose-option svg { width: 20px; height: 20px; }
.compose-submit { padding: 0.5rem 1.25rem; background: transparent; color: var(--text); border: 2px solid var(--accent); border-radius: 20px; font-weight: 500; font-size: 0.9rem; cursor: pointer; transition: background 0.2s, transform 0.2s, color 0.2s; }
.compose-submit:hover { background: var(--code-bg); }
.compose-submit:active { transform: scale(0.98); }
.compose-submit:disabled { opacity: 0.5; cursor: not-allowed; }
.compose-hint { font-size: 0.75rem; color: var(--text-secondary); margin-top: 0.25rem; }
.compose-hint kbd { background: var(--code-bg); padding: 0.1rem 0.35rem; border-radius: 3px; font-family: inherit; font-size: 0.7rem; border: 1px solid var(--border); }
@media (max-width: 600px), (hover: none) { .compose-hint { display: none; } }

/* Inline edit */
.inline-edit-textarea { width: 100%; min-height: 60px; max-height: 400px; padding: 0.75rem; border: 1px solid var(--accent); border-radius: 8px; background: var(--bg); color: var(--text); font-family: inherit; font-size: 1rem; line-height: 1.6; resize: none; overflow-y: auto; white-space: pre-wrap; word-wrap: break-word; }
.inline-edit-textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(var(--accent-rgb, 99, 102, 241), 0.1); }
.inline-edit-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.75rem; }
.inline-edit-cancel { padding: 0.4rem 1rem; background: transparent; color: var(--text-secondary); border: 1px solid var(--border); border-radius: 6px; font-size: 0.85rem; font-weight: 500; cursor: pointer; transition: background 0.2s, color 0.2s; }
.inline-edit-cancel:hover { background: var(--code-bg); color: var(--text); }
.inline-edit-save { padding: 0.4rem 1rem; background: var(--accent); color: white; border: none; border-radius: 6px; font-size: 0.85rem; font-weight: 500; cursor: pointer; transition: background 0.2s, opacity 0.2s; }
.inline-edit-save:hover { opacity: 0.9; }
.inline-edit-save:disabled { opacity: 0.6; cursor: not-allowed; }

/* Image preview */
.image-preview-container { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.image-preview-container:empty { display: none; }
.image-preview { position: relative; width: 80px; height: 80px; border-radius: 8px; overflow: hidden; }
.image-preview img { width: 100%; height: 100%; object-fit: cover; }
.image-preview-remove { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0, 0, 0, 0.6); color: white; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 14px; line-height: 1; }
.image-preview-remove:hover { background: rgba(0, 0, 0, 0.8); }

/* Feed */
.thoughts-feed { display: flex; flex-direction: column; gap: 1rem; }

/* Post card */
.post-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px var(--shadow); transition: border-color 0.2s, box-shadow 0.2s; }
.post-card:hover { border-color: var(--accent); box-shadow: 0 2px 4px rgba(0,0,0,0.04), 0 8px 24px var(--shadow); }
.post-body { padding-bottom: 0.5rem; }
.post-body:empty { display: none; }
.post-images-container { padding-bottom: 0.75rem; }
.post-header { display: flex; align-items: center; gap: 0.75rem; padding-bottom: 0.75rem; margin-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.post-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--accent-gradient); display: flex; align-items: center; justify-content: center; color: white; font-weight: 600; font-size: 1.1rem; flex-shrink: 0; overflow: hidden; }
.post-avatar img { width: 100%; height: 100%; object-fit: cover; }
.post-meta { flex: 1; }
.post-author { font-weight: 600; color: var(--text); font-size: 0.95rem; }
.post-time { font-size: 0.8rem; color: var(--text-secondary); position: relative; cursor: help; }
.post-time[data-tooltip]:hover::after { content: attr(data-tooltip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); padding: 0.4rem 0.6rem; background: var(--text); color: var(--bg); font-size: 0.75rem; border-radius: 4px; white-space: nowrap; z-index: 10; margin-bottom: 4px; }
.post-time[data-tooltip]:hover::before { content: ''; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); border: 4px solid transparent; border-top-color: var(--text); margin-bottom: -4px; z-index: 10; }

/* Post buttons */
.post-delete-btn, .post-edit-btn { margin-left: auto; padding: 0.4rem; background: transparent; border: none; border-radius: 50%; color: var(--text-secondary); cursor: pointer; transition: background 0.2s, color 0.2s; display: flex; align-items: center; justify-content: center; }
.post-delete-btn:hover { background: rgba(231, 76, 60, 0.1); color: #e74c3c; }
.post-edit-btn:hover { background: var(--code-bg); color: var(--accent); }
.post-delete-btn svg { width: 18px; height: 18px; }
.post-edit-btn svg { width: 16px; height: 16px; }
.post-content { line-height: 1.6; color: var(--text); white-space: pre-wrap; word-wrap: break-word; }

/* Post images */
.post-images { display: grid; gap: 0.5rem; border-radius: 8px; overflow: hidden; }
.post-images.single { grid-template-columns: 1fr; }
.post-images.double { grid-template-columns: 1fr 1fr; }
.post-images.triple { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.post-images.triple .post-image:first-child { grid-row: span 2; }
.post-images.quad { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.post-image { width: 100%; aspect-ratio: 16/9; object-fit: cover; cursor: pointer; transition: opacity 0.2s; }
.post-images.single .post-image { aspect-ratio: auto; max-height: none; }
.post-image:hover { opacity: 0.9; }

/* Post actions */
.post-actions { display: flex; gap: 1.5rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }
.post-action { display: flex; align-items: center; gap: 0.4rem; padding: 0.5rem; border: none; border-radius: 20px; background: transparent; color: var(--text-secondary); font-size: 0.85rem; cursor: pointer; transition: background 0.2s, color 0.2s; }
.post-action:hover { background: var(--code-bg); color: var(--accent); }
.post-action.liked { color: #e74c3c; }
.post-action.liked:hover { background: rgba(231, 76, 60, 0.1); }
.post-action svg { width: 18px; height: 18px; }
.post-action-count { font-weight: 500; }
.share-btn { display: flex; align-items: center; gap: 0.4rem; padding: 0.4rem 0.75rem; border: none; border-radius: 20px; background: transparent; color: var(--text-secondary); font-size: 0.85rem; cursor: pointer; transition: background 0.2s, color 0.2s; }
.share-btn:hover { background: var(--code-bg); color: var(--accent); }
.share-btn svg { width: 18px; height: 18px; }

/* Loading */
.loading-spinner { display: flex; justify-content: center; padding: 2rem; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Skeleton loading */
.skeleton-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px var(--shadow); }
.skeleton { background: linear-gradient(90deg, var(--border) 25%, var(--code-bg) 50%, var(--border) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 4px; }
.skeleton-avatar { width: 44px; height: 44px; border-radius: 50%; }
.skeleton-line { height: 14px; margin-bottom: 0.5rem; }
.skeleton-line.short { width: 40%; }
.skeleton-line.medium { width: 70%; }
.skeleton-line.long { width: 100%; }
.skeleton-image { width: 100%; height: 200px; border-radius: 12px; margin-top: 0.75rem; }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* Empty state */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-secondary); }
.empty-state svg { width: 64px; height: 64px; margin-bottom: 1rem; opacity: 0.5; }
.empty-state h3 { font-size: 1.2rem; margin-bottom: 0.5rem; color: var(--text); }

/* Login preview */
.login-preview { margin-top: 2rem; padding: 1.5rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; opacity: 0.6; }
.login-preview-title { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 1rem; text-align: center; }
.preview-post { display: flex; gap: 0.75rem; align-items: flex-start; }
.preview-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-gradient); flex-shrink: 0; }
.preview-content { flex: 1; }
.preview-line { height: 12px; background: var(--border); border-radius: 4px; margin-bottom: 0.5rem; }
.preview-line:nth-child(1) { width: 30%; }
.preview-line:nth-child(2) { width: 80%; }
.preview-line:nth-child(3) { width: 60%; }

/* Post success animation */
@keyframes postSuccess { 0% { transform: scale(1); } 50% { transform: scale(0.95); } 100% { transform: scale(1); } }
.compose-submit.success { animation: postSuccess 0.3s ease; background: #27ae60; }

/* Mobile */
@media (max-width: 600px) {
  .compose-box, .post-card { padding: 1rem; border-radius: 0; border-left: none; border-right: none; margin-left: -1.5rem; margin-right: -1.5rem; width: calc(100% + 3rem); }
  .thoughts-feed { gap: 0.5rem; }
  .post-actions { gap: 0; justify-content: space-around; padding-top: 0.5rem; padding-bottom: 0.25rem; }
  .post-action { padding: 0.75rem 1rem; font-size: 0.9rem; min-height: 44px; min-width: 44px; }
  .post-action svg, .share-btn svg { width: 22px; height: 22px; }
  .post-avatar { width: 40px; height: 40px; font-size: 1rem; }
  .post-author { font-size: 0.9rem; }
  .post-images.triple .post-image:first-child { grid-row: span 1; }
  .post-images.triple { grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr; }
  .compose-submit { padding: 0.65rem 1.5rem; font-size: 1rem; }
  .post-card .post-header { display: flex; flex-direction: row !important; align-items: center; text-align: left; }
  .post-card .post-meta { text-align: left; }
  .compose-option { width: 44px; height: 44px; }
  .compose-option svg { width: 24px; height: 24px; }
}
