/* Tistory Poster Styles (Extends CineAHO Sandbox Theme) */

:root {
  /* HSL Colors */
  --hue-purple: 270;
  --hue-blue: 210;
  --hue-green: 145;
  --hue-gold: 45;
  --hue-red: 350;
  --hue-cyan: 190;

  /* Theme Core (Default: Dark Mode) */
  --bg-color: #060913;
  --bg-grid: rgba(255, 255, 255, 0.015);
  
  --panel-bg: rgba(14, 20, 38, 0.65);
  --panel-border: rgba(255, 255, 255, 0.06);
  --panel-hover-border: rgba(168, 85, 247, 0.35);
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dark: #475569;
  
  /* Gradation Accents */
  --grad-purple: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
  --grad-blue: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  --grad-cyan: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  --grad-green: linear-gradient(135deg, #10b981 0%, #047857 100%);
  --grad-gold: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  --grad-red: linear-gradient(135deg, #f43f5e 0%, #be123c 100%);
  
  --neon-glow: 0 0 30px rgba(168, 85, 247, 0.25);
  --neon-border-glow: 0 0 15px rgba(168, 85, 247, 0.35);

  --font-main: 'Noto Sans KR', 'Inter', sans-serif;
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'Courier New', Courier, monospace;
  --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-card: 0 12px 40px 0 rgba(0, 0, 0, 0.6);
  
  --accent-color: #a855f7;
  --accent-color-hover: #c084fc;
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-color: #f8fafc;
  --bg-grid: rgba(15, 23, 42, 0.02);
  
  --panel-bg: rgba(255, 255, 255, 0.8);
  --panel-border: rgba(15, 23, 42, 0.08);
  --panel-hover-border: rgba(168, 85, 247, 0.4);
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dark: #cbd5e1;
  
  --neon-glow: 0 0 30px rgba(168, 85, 247, 0.12);
  --shadow-card: 0 12px 40px 0 rgba(15, 23, 42, 0.06);
}

/* Global Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.6;
  transition: background-color 0.5s ease, color 0.3s ease;
}

/* Grid Background */
body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: -2;
  pointer-events: none;
}

/* Ambient Glow Orbs */
.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(160px);
  z-index: -3;
  pointer-events: none;
  opacity: 0.25;
  transition: opacity 0.5s ease;
}

.bg-glow-purple {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #7e22ce 0%, transparent 70%);
  top: -200px;
  left: 10%;
}

.bg-glow-blue {
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, #2563eb 0%, transparent 70%);
  top: 20%;
  right: 5%;
}

[data-theme="light"] .bg-glow {
  opacity: 0.1;
}

/* Header Styles */
.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  margin: 1rem 1.5rem 0 1.5rem;
  border-radius: 50px;
  transition: var(--transition-smooth);
}

.glass-header {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card);
}

.logo-circle {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 10px rgba(168, 85, 247, 0.3);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-text {
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.logo-text span {
  color: var(--accent-color);
  font-weight: 400;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Common Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  transition: var(--transition-smooth);
  text-decoration: none;
}

.btn-back-home {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.btn-back-home:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-color);
}

.btn-theme {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 30px;
  padding: 0.5rem 1rem;
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-theme:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-color);
}

[data-theme="light"] .btn-back-home,
[data-theme="light"] .btn-theme {
  background: rgba(15, 23, 42, 0.05);
  border-color: rgba(15, 23, 42, 0.08);
}

/* Glass Panel common styles */
.glass-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px;
  box-shadow: var(--shadow-card);
  transition: var(--transition-smooth);
}

/* Layout App Container */
.app-container {
  max-width: 1400px;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Settings Card Styling */
.settings-card {
  padding: 1.5rem;
}

.settings-card.collapsed .settings-content {
  max-height: 0;
  overflow: hidden;
  margin-top: 0;
  opacity: 0;
}

.settings-card.collapsed .btn-icon-toggle i {
  transform: rotate(180deg);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-title h2 {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--font-main);
}

.icon-accent {
  color: var(--accent-color);
  font-size: 1.3rem;
}

.btn-icon-toggle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  font-size: 1rem;
  transition: var(--transition-smooth);
}

.btn-icon-toggle:hover {
  color: var(--text-main);
}

.settings-content {
  margin-top: 1.5rem;
  max-height: 500px;
  opacity: 1;
  transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, margin 0.4s;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.settings-col h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.col-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.divider-left {
  border-left: 1px solid var(--panel-border);
  padding-left: 2rem;
}

@media (max-width: 900px) {
  .settings-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .divider-left {
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--panel-border);
    padding-top: 1.5rem;
  }
}

/* Input Styles */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.input-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.input-group input,
.form-group input,
.form-group select {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--text-main);
  outline: none;
  font-size: 0.9rem;
  font-family: var(--font-main);
  transition: var(--transition-smooth);
}

[data-theme="light"] .input-group input,
[data-theme="light"] .form-group input,
[data-theme="light"] .form-group select {
  background: rgba(255, 255, 255, 0.6);
}

.input-group input:focus,
.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.2);
}

.input-with-action {
  display: flex;
  gap: 0.5rem;
}

.input-with-action input {
  flex-grow: 1;
}

.btn-primary {
  background: var(--grad-purple);
  color: #fff;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(168, 85, 247, 0.4);
}

.btn-accent {
  background: var(--grad-cyan);
  color: #000;
  font-weight: 700;
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.4);
}

.oauth-inputs {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-row {
  display: flex;
  gap: 1rem;
}

.flex-1 {
  flex: 1;
}

.redirect-uri-info {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.redirect-uri-info code {
  color: #f472b6;
  font-family: var(--font-mono);
  overflow-x: auto;
  white-space: nowrap;
}

.btn-copy {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 0.85rem;
  transition: var(--transition-smooth);
}

.btn-copy:hover {
  color: var(--text-main);
  transform: scale(1.1);
}

.oauth-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
}

.btn-link {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition-smooth);
}

.btn-link:hover {
  color: var(--accent-color);
  text-decoration: underline;
}

/* Status Banner styling */
.status-banner {
  padding: 1rem 1.5rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.status-banner.negative {
  border-color: rgba(244, 63, 94, 0.2);
  background: rgba(244, 63, 94, 0.06);
  color: #f43f5e;
}

.status-banner.positive {
  border-color: rgba(16, 185, 129, 0.2);
  background: rgba(16, 185, 129, 0.06);
  color: #10b981;
}

.status-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* Workspace Split-Pane Layout */
.workspace-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 1024px) {
  .workspace-layout {
    grid-template-columns: 1fr;
  }
}

/* Pane Header & Body Styles */
.editor-pane, .preview-pane {
  display: flex;
  flex-direction: column;
  min-height: 650px;
  overflow: hidden;
}

.pane-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.08);
}

.pane-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.pane-title h2 {
  font-size: 1.05rem;
  font-weight: 700;
}

.pane-title i {
  color: var(--accent-color);
}

.pane-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex-grow: 1;
}

/* Editor Specifics */
.editor-actions {
  display: flex;
  align-items: center;
}

.btn-file-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-file-label:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-color);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.editor-meta-row {
  display: flex;
  gap: 1rem;
}

/* Template Toolbox */
.template-toolbox {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.12);
  padding: 0.6rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  overflow-x: auto;
}

.toolbox-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.template-buttons {
  display: flex;
  gap: 0.5rem;
}

.btn-template {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--text-main);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-smooth);
}

.btn-template:hover {
  background: rgba(168, 85, 247, 0.15);
  border-color: var(--accent-color);
  transform: translateY(-1px);
}

/* Raw Editor Container */
.editor-textarea-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.editor-textarea-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#char-counter {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.editor-editor-container {
  flex-grow: 1;
  display: flex;
  min-height: 250px;
}

.editor-editor-container textarea {
  width: 100%;
  flex-grow: 1;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 1rem;
  color: #a7f3d0; /* Soft developer green code */
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
  outline: none;
  resize: vertical;
  transition: var(--transition-smooth);
}

[data-theme="light"] .editor-editor-container textarea {
  background: rgba(255, 255, 255, 0.75);
  color: #065f46;
}

.editor-editor-container textarea:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.15);
}

/* Post Settings Footer */
.post-settings-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--panel-border);
  padding-top: 1.25rem;
  margin-top: 0.5rem;
  gap: 1rem;
}

@media (max-width: 600px) {
  .post-settings-footer {
    flex-direction: column;
    align-items: stretch;
  }
}

.visibility-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.settings-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.radio-toggle-group {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 0.25rem;
}

.radio-toggle-group input[type="radio"] {
  display: none;
}

.radio-toggle-group label {
  padding: 0.45rem 0.9rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition-smooth);
}

.radio-toggle-group input[type="radio"]:checked + label {
  background: var(--accent-color);
  color: #fff;
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.3);
}

.btn-publish {
  background: var(--grad-purple);
  color: #fff;
  padding: 0.75rem 1.75rem;
  font-size: 0.95rem;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(168, 85, 247, 0.2);
}

.btn-publish:disabled {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-dark);
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-publish:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.4);
}

/* Device preview sizes */
.preview-device-toggle {
  display: flex;
  gap: 0.25rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 0.25rem;
}

.btn-device-toggle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: var(--transition-smooth);
}

.btn-device-toggle.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent-color);
  border: 1px solid rgba(168, 85, 247, 0.2);
}

.preview-body {
  background: rgba(0, 0, 0, 0.15);
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.preview-container {
  width: 100%;
  height: 100%;
  min-height: 500px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: #ffffff;
  overflow: hidden;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-card);
}

.preview-container.desktop {
  width: 100%;
}

.preview-container.mobile {
  width: 375px;
  height: 600px;
}

.preview-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
}

/* Modals & Overlays */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(6, 9, 19, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.loader-card, .result-card {
  padding: 2.5rem;
  width: 90%;
  max-width: 450px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  animation: scaleIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(168, 85, 247, 0.1);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.result-icon-success {
  width: 64px;
  height: 64px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #10b981;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}

.result-title {
  font-size: 1.4rem;
  font-weight: 700;
}

.result-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.result-details {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  width: 100%;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
}

.detail-row span {
  color: var(--text-muted);
}

.result-actions {
  display: flex;
  gap: 1rem;
  width: 100%;
  margin-top: 0.5rem;
}

.result-actions .btn {
  flex: 1;
  padding: 0.75rem 1rem;
  border-radius: 8px;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Footer styling */
.main-footer {
  text-align: center;
  padding: 2rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--panel-border);
  margin-top: auto;
}
