/* ========================================
   Emotion Trash - CSS
   Neobrutalism design with dark mode support
   ======================================== */

/* Global box-sizing */
.emotion-trash-container,
.emotion-trash-container *,
.emotion-trash-container *::before,
.emotion-trash-container *::after {
  box-sizing: border-box;
}

/* CSS Variables - Light mode (default) */
.emotion-trash-container {
  /* Background colors */
  --bg-primary: #f5f5f0;
  --bg-secondary: #fff;
  --bg-section: #fff;
  
  /* Borders */
  --border-color: #333;
  
  /* Text colors */
  --text-primary: #222;
  --text-secondary: #555;
  --text-light: #666;
  
  /* Brand colors */
  --color-accent: #3498db;
  --color-success: #27ae60;
  --color-warning: #f39c12;
  --color-danger: #e74c3c;
  --color-purple: #9b59b6;
  --color-teal: #1abc9c;
  
  /* Shadows (neobrutalism) */
  --shadow-sm: 2px 2px 0 rgba(0,0,0,0.1);
  --shadow-md: 4px 4px 0 rgba(0,0,0,0.15);
  --shadow-lg: 8px 8px 0 rgba(0,0,0,0.15);
  
  /* Border radius */
  --radius-container: 8px;
  --radius-section: 6px;
  --radius-button: 4px;
  --radius-input: 4px;
  
  /* Input focus */
  --input-focus-bg: #fffacd;
  
  /* Header title */
  --title-color: #2c3e50;
  --title-shadow: 2px 2px 0 rgba(255,255,255,0.5);
  
  /* Button hover */
  --btn-hover-overlay: rgba(0,0,0,0.1);
}

/* Dark mode - manual toggle */
.emotion-trash-container.dark {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --bg-section: #2d2d2d;
  --border-color: #e0e0e0;
  --text-primary: #e8e8e8;
  --text-secondary: #b0b0b0;
  --text-light: #909090;
  --color-accent: #5dade2;
  --color-success: #52c77a;
  --color-warning: #f5b041;
  --color-danger: #ec7063;
  --color-purple: #af7ac5;
  --color-teal: #48d1cc;
  --shadow-sm: 2px 2px 0 rgba(255,255,255,0.08);
  --shadow-md: 4px 4px 0 rgba(255,255,255,0.12);
  --shadow-lg: 8px 8px 0 rgba(255,255,255,0.12);
  --input-focus-bg: #3a3a3a;
  --title-color: #7fb3d5;
  --title-shadow: 2px 2px 0 rgba(0,0,0,0.5);
  --btn-hover-overlay: rgba(255,255,255,0.1);
}

/* Dark mode - system preference auto detection */
@media (prefers-color-scheme: dark) {
  .emotion-trash-container:not(.dark):not(.light) {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-section: #2d2d2d;
    --border-color: #e0e0e0;
    --text-primary: #e8e8e8;
    --text-secondary: #b0b0b0;
    --text-light: #909090;
    --color-accent: #5dade2;
    --color-success: #52c77a;
    --color-warning: #f5b041;
    --color-danger: #ec7063;
    --color-purple: #af7ac5;
    --color-teal: #48d1cc;
    --shadow-sm: 2px 2px 0 rgba(255,255,255,0.08);
    --shadow-md: 4px 4px 0 rgba(255,255,255,0.12);
    --shadow-lg: 8px 8px 0 rgba(255,255,255,0.12);
    --input-focus-bg: #3a3a3a;
    --title-color: #7fb3d5;
    --title-shadow: 2px 2px 0 rgba(0,0,0,0.5);
    --btn-hover-overlay: rgba(255,255,255,0.1);
  }
}

/* Main container - 2px border, neobrutalism style */
.emotion-trash-container {
  position: relative;
  max-width: 900px;
  width: 100%;
  margin: 8px auto;
  padding: 8px;
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-container);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Malgun Gothic', sans-serif;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  line-height: 1.5;
}

/* Dark mode toggle button */
.dark-mode-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-button);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.15);
  font-size: 17.5px;
  font-weight: 600;
  color: var(--text-primary);
  z-index: 10;
}

.dark-mode-toggle:hover {
  transform: translate(0.5px, 0.5px);
  box-shadow: 1.5px 1.5px 0 rgba(0,0,0,0.15);
}

.dark-mode-toggle:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

/* Header section */
.header-section {
  text-align: center;
  padding: 8px;
  margin-bottom: 8px;
}

.emotion-trash-container h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--title-color);
  text-shadow: var(--title-shadow);
  margin: 0 0 8px 0;
}

.header-desc {
  font-size: 16px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.6;
}

.header-desc strong {
  color: var(--color-danger);
  font-weight: 700;
}

/* Main grid - 2 column layout */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

/* Section title */
.section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}

.section-title svg {
  color: var(--color-accent);
  flex-shrink: 0;
}

/* Input section */
.input-section {
  background: var(--bg-section);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-section);
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.textarea-wrapper {
  flex: 1;
  display: flex;
  margin-bottom: 10px;
}

.emotion-trash-container textarea {
  width: 100%;
  min-height: 220px;
  height: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-input);
  font-size: 16px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-secondary);
  resize: none;
  line-height: 1.6;
  transition: background 0.2s, box-shadow 0.2s;
}

.emotion-trash-container textarea:focus {
  outline: none;
  background: var(--input-focus-bg);
  box-shadow: inset 0 0 0 2px var(--color-accent);
}

.emotion-trash-container textarea::placeholder {
  color: var(--text-light);
}

/* Button group */
.button-group {
  display: flex;
  gap: 8px;
}

/* Buttons */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  border-radius: var(--radius-button);
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn svg {
  flex-shrink: 0;
}

.btn-primary {
  flex: 2;
  background: var(--color-accent);
  color: #fff;
  border: 1.5px solid var(--border-color);
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  transform: translate(1px, 1px);
  box-shadow: 3px 3px 0 rgba(0,0,0,0.15);
}

.btn-primary:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 rgba(0,0,0,0.15);
}

.btn-secondary {
  flex: 1;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--btn-hover-overlay);
  transform: translate(0.5px, 0.5px);
  box-shadow: 1.5px 1.5px 0 rgba(0,0,0,0.1);
}

.btn-secondary:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

/* Result section */
.result-section {
  background: var(--bg-section);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-section);
  padding: 12px;
  display: flex;
  flex-direction: column;
}

/* Message box */
.message-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 160px;
  padding: 16px;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-section);
  margin-bottom: 10px;
}

.comfort-message {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-accent);
  line-height: 1.6;
  margin: 0;
}

.loading-message {
  display: none;
  font-size: 18px;
  font-weight: 600;
  color: var(--color-purple);
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-section);
}

.loading-dots::after {
  content: "";
  animation: loadingDots 1.5s infinite;
}

@keyframes loadingDots {
  0% { content: "."; }
  33% { content: ".."; }
  66% { content: "..."; }
}

/* Privacy notice */
.privacy-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 10px;
}

.privacy-notice svg {
  color: var(--color-success);
  flex-shrink: 0;
}

/* Counter box */
.counter-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-section);
}

.counter-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-accent);
}

.counter-label {
  font-size: 16px;
  color: var(--text-secondary);
}

/* Info section */
.info-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.info-block {
  background: var(--bg-section);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-section);
  padding: 12px;
}

.info-block p {
  font-size: 15px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.6;
}

.tips-list {
  margin: 0;
  padding-left: 18px;
}

.tips-list li {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.5;
}

.tips-list li:last-child {
  margin-bottom: 0;
}

.tips-list li strong {
  color: var(--color-accent);
  font-weight: 600;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 12px 24px;
  background: var(--text-primary);
  color: var(--bg-primary);
  border-radius: var(--radius-button);
  font-size: 16px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
}

/* Text dissolve animation */
.text-dissolve {
  animation: dissolve 1.5s forwards;
}

@keyframes dissolve {
  to {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* Fade in animation */
.fade-in {
  animation: fadeIn 0.8s ease-out forwards;
}

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

/* ========================================
   Responsive Design
   ======================================== */

/* Tablet breakpoint */
@media screen and (max-width: 768px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
  
  .info-section {
    grid-template-columns: 1fr;
  }
  
  .emotion-trash-container h2 {
    font-size: 22px;
  }
  
  .header-desc {
    font-size: 15px;
  }
  
  .emotion-trash-container textarea {
    min-height: 180px;
  }
  
  .message-box {
    min-height: 140px;
  }
}

/* Mobile breakpoint */
@media screen and (max-width: 480px) {
  .emotion-trash-container {
    padding: 6px;
    margin: 4px auto;
  }
  
  .header-section {
    padding: 6px;
  }
  
  .emotion-trash-container h2 {
    font-size: 20px;
  }
  
  .header-desc {
    font-size: 14px;
  }
  
  .button-group {
    flex-direction: column;
  }
  
  .btn-primary,
  .btn-secondary {
    flex: none;
    width: 100%;
  }
  
  .btn {
    padding: 10px 14px;
    font-size: 16px;
  }
  
  .emotion-trash-container textarea {
    min-height: 150px;
    font-size: 15px;
  }
  
  .comfort-message {
    font-size: 16px;
  }
  
  .counter-value {
    font-size: 24px;
  }
  
  .dark-mode-toggle {
    top: 6px;
    right: 6px;
    padding: 4px 8px;
    font-size: 16px;
  }
}