/**
 * Caption Preview Tool - Styling
 * Modern, clean, and distraction-free design
 */

/* ===== CSS RESET & BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: #2c3e50;
  background: linear-gradient(-45deg, #667eea, #764ba2, #f093fb, #4facfe);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  min-height: 100vh;
  padding: 20px;
  position: relative;
  overflow-x: hidden;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

/* Floating particles effect */
body::before,
body::after {
  content: '';
  position: fixed;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  opacity: 0.1;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
  top: -150px;
  left: -150px;
  animation: float 20s ease-in-out infinite;
}

body::after {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
  bottom: -150px;
  right: -150px;
  animation: float 25s ease-in-out infinite reverse;
}

@keyframes float {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  33% {
    transform: translate(100px, -100px) scale(1.1);
  }

  66% {
    transform: translate(-50px, 50px) scale(0.9);
  }
}

/* ===== CONTAINER ===== */
.container {
  max-width: 1400px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.2);
  overflow: hidden;
  position: relative;
  z-index: 1;
  animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== HEADER ===== */
.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  color: white;
  padding: 50px 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 30% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
  pointer-events: none;
}

.header>* {
  position: relative;
  z-index: 1;
}

.header h1 {
  font-size: 3rem;
  margin-bottom: 15px;
  font-weight: 800;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
  animation: fadeInDown 0.8s ease-out;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.header .subtitle {
  font-size: 1.3rem;
  opacity: 0.95;
  margin-bottom: 15px;
  font-weight: 500;
  animation: fadeInDown 0.8s ease-out 0.1s both;
}

.header .description {
  font-size: 1.05rem;
  opacity: 0.9;
  max-width: 800px;
  margin: 0 auto 20px;
  line-height: 1.8;
  animation: fadeInDown 0.8s ease-out 0.2s both;
}

.header .limitations {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 18px 30px;
  margin-top: 20px;
  backdrop-filter: blur(10px);
  display: inline-block;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  animation: fadeInDown 0.8s ease-out 0.3s both;
  transition: all 0.3s ease;
}

.header .limitations:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.header .limitations strong {
  display: block;
  margin-bottom: 5px;
  font-size: 0.95rem;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  padding: 40px;
}

/* ===== INPUT SECTION ===== */
.input-section {
  margin-bottom: 40px;
}

.section-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: #2c3e50;
  display: flex;
  align-items: center;
  gap: 10px;
}

.caption-input-wrapper {
  position: relative;
}

#caption-input {
  width: 100%;
  min-height: 180px;
  padding: 20px;
  border: 2px solid #e8ecf1;
  border-radius: 16px;
  font-size: 1.05rem;
  font-family: inherit;
  line-height: 1.7;
  resize: vertical;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: #fafbfc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

#caption-input:focus {
  outline: none;
  border-color: #667eea;
  background: white;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.12), 0 8px 24px rgba(102, 126, 234, 0.15);
  transform: translateY(-1px);
}

.character-counter {
  margin-top: 10px;
  font-size: 0.95rem;
  color: #666;
  display: flex;
  align-items: center;
  gap: 10px;
}

.character-counter .count {
  font-weight: 600;
  color: #667eea;
  font-size: 1.1rem;
}

.character-counter.error .count {
  color: #e74c3c;
}

.character-counter .warning {
  color: #e74c3c;
  font-weight: 500;
}

/* ===== PLATFORM SELECTION ===== */
.platform-selection {
  margin-bottom: 30px;
}

.platform-options {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 15px;
}

.platform-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: #f8f9fa;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.platform-option:hover {
  background: #e9ecef;
  transform: translateY(-2px);
}

.platform-option.selected {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

.platform-checkbox {
  cursor: pointer;
  width: 18px;
  height: 18px;
}

.platform-label {
  cursor: pointer;
  font-weight: 500;
  font-size: 1rem;
  user-select: none;
}

/* ===== CONTROLS ===== */
.controls {
  margin-bottom: 30px;
}

#clear-button {
  background: #e74c3c;
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

#clear-button:hover {
  background: #c0392b;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

/* ===== PREVIEW SECTION ===== */
.preview-section {
  margin-top: 40px;
}

#preview-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 25px;
  margin-top: 20px;
}

.no-selection {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: #95a5a6;
  font-size: 1.2rem;
}

/* ===== PREVIEW CARDS ===== */
.preview-card {
  background: white;
  border-radius: 18px;
  border: 2px solid #e8ecf1;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  animation: cardSlideIn 0.5s ease-out;
}

@keyframes cardSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.preview-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  border-color: #d0d7de;
}

.preview-card.over-limit {
  border-color: #e74c3c;
  background: #fff5f5;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
}

.platform-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.platform-icon {
  font-size: 1.5rem;
}

.platform-name {
  font-weight: 600;
  font-size: 1.1rem;
  color: #2c3e50;
}

.char-count {
  font-weight: 600;
  color: #27ae60;
  font-size: 0.95rem;
}

.char-count.over-limit {
  color: #e74c3c;
}

.preview-description {
  padding: 10px 20px;
  background: #fffbea;
  font-size: 0.85rem;
  color: #856404;
  border-bottom: 1px solid #e0e0e0;
}

.preview-content {
  padding: 20px;
  min-height: 120px;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #2c3e50;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.empty-preview {
  color: #bdc3c7;
  font-style: italic;
  text-align: center;
  padding: 30px 20px;
}

.expanded-preview {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px dashed #ddd;
}

.expand-label {
  font-weight: 600;
  color: #667eea;
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.limit-warning {
  background: #e74c3c;
  color: white;
  padding: 12px 20px;
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
}

/* ===== PLATFORM-SPECIFIC STYLING ===== */
.instagram-preview .preview-header {
  background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  color: white;
}

.instagram-preview .platform-name,
.instagram-preview .char-count {
  color: white;
}

.twitter-preview .preview-header {
  background: #1da1f2;
  color: white;
}

.twitter-preview .platform-name,
.twitter-preview .char-count {
  color: white;
}

.linkedin-preview .preview-header {
  background: #0077b5;
  color: white;
}

.linkedin-preview .platform-name,
.linkedin-preview .char-count {
  color: white;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .header h1 {
    font-size: 2rem;
  }

  .header .subtitle {
    font-size: 1rem;
  }

  .main-content {
    padding: 20px;
  }

  #preview-container {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .platform-options {
    flex-direction: column;
    gap: 12px;
  }

  .platform-option {
    width: 100%;
  }
}

@media (max-width: 480px) {
  body {
    padding: 5px;
  }

  .container {
    border-radius: 15px;
  }

  .header {
    padding: 25px 20px;
  }

  .header h1 {
    font-size: 1.6rem;
  }

  .main-content {
    padding: 15px;
  }

  #caption-input {
    min-height: 150px;
    padding: 15px;
  }

  #preview-container {
    grid-template-columns: 1fr;
  }

  .preview-card {
    margin-bottom: 15px;
  }

  .section-title {
    font-size: 1.3rem;
  }
}