/* CSS Reset & Variables */
:root {
  --primary-color: #f04e6c; /* 楽天ROOMらしいコーラルピンク */
  --primary-hover: #d43b57;
  --secondary-color: #4a5568;
  --secondary-hover: #3182ce;
  --bg-gradient: linear-gradient(135deg, #111827 0%, #1f2937 100%);
  --card-bg: rgba(255, 255, 255, 0.03);
  --card-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-success: #34d399;
  --accent-blue: #60a5fa;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  --glass-glow: 0 0 15px rgba(240, 78, 108, 0.15);
}

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

body {
  font-family: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  padding: 2rem 1rem;
  line-height: 1.6;
}

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

/* Header */
.app-header {
  text-align: center;
  margin-bottom: 1rem;
  animation: fadeInDown 0.8s ease-out;
}

.app-header .logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.app-header .icon-logo {
  font-size: 2.2rem;
  color: var(--primary-color);
  filter: drop-shadow(0 0 8px rgba(240, 78, 108, 0.5));
  animation: float 4s ease-in-out infinite;
}

.app-header h1 {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.app-header h1 span {
  color: var(--primary-color);
  font-weight: 300;
}

.app-header .subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
}

/* Main Layout */
.main-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

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

/* Glassmorphism Card style */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.card:hover {
  border-color: rgba(240, 78, 108, 0.2);
  box-shadow: var(--shadow), var(--glass-glow);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 0.75rem;
}

.card-header i {
  color: var(--primary-color);
  font-size: 1.3rem;
}

.card-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

input[type="text"],
input[type="url"],
input[type="number"],
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: var(--transition);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(240, 78, 108, 0.15);
  background: rgba(255, 255, 255, 0.08);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 500px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* Custom layout for Scrape group */
.scrape-group .input-with-button {
  display: flex;
  gap: 0.75rem;
}

.scrape-group input {
  flex-grow: 1;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, #db2777 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(240, 78, 108, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(240, 78, 108, 0.4);
  background: linear-gradient(135deg, var(--primary-hover) 0%, #be185d 100%);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border: 1px solid var(--card-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--text-secondary);
}

.btn-block {
  width: 100%;
  margin-top: 1rem;
  padding: 1rem;
}

/* Divider */
.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.75rem;
  margin: 1.5rem 0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px dashed var(--card-border);
}

.divider:not(:empty)::before {
  margin-right: 1rem;
}

.divider:not(:empty)::after {
  margin-left: 1rem;
}

/* Results Formatting */
.placeholder-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 1rem;
  text-align: center;
  color: var(--text-secondary);
  animation: fadeIn 0.5s ease-out;
}

.placeholder-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: rgba(255, 255, 255, 0.1);
}

.placeholder-icon i {
  color: var(--card-border);
}

.placeholder-content p {
  max-width: 250px;
  font-size: 0.9rem;
}

/* Loading */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 1rem;
  text-align: center;
  animation: fadeIn 0.3s ease-out;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-left-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1.5rem;
  box-shadow: 0 0 15px rgba(240, 78, 108, 0.2);
}

.loading-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 300px;
}

/* Output Display Area */
.result-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.result-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.result-item h4 {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Copyable box */
.copyable-box {
  position: relative;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 0.85rem 3rem 0.85rem 1rem;
  font-size: 0.95rem;
  transition: var(--transition);
}

.copyable-box:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

.copy-text {
  word-break: break-all;
  white-space: pre-wrap;
}

.text-bold {
  font-weight: 600;
  color: white;
}

.btn-copy {
  position: absolute;
  top: 50%;
  right: 0.85rem;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 4px;
  transition: var(--transition);
}

.btn-copy:hover {
  color: var(--primary-color);
  background: rgba(240, 78, 108, 0.1);
}

/* Collection Box */
.collection-box {
  background: rgba(240, 78, 108, 0.05);
  border: 1px dashed rgba(240, 78, 108, 0.3);
  border-radius: 12px;
  padding: 1.25rem;
}

.collection-box .item-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.collection-box .item-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.badge {
  background: var(--primary-color);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

/* Tags styling */
.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  background: rgba(96, 165, 250, 0.1);
  color: var(--accent-blue);
  border: 1px solid rgba(96, 165, 250, 0.2);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

/* Full Text area */
.full-text-box {
  border-top: 1px solid var(--card-border);
  padding-top: 1.5rem;
  margin-top: 0.5rem;
}

.full-text-box .item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.full-text-box .item-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.full-text-box .text-limit {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.large-box {
  padding-right: 1.25rem;
  padding-bottom: 4rem; /* button space */
  background: rgba(255, 255, 255, 0.06);
}

.large-box pre {
  font-family: inherit;
  font-size: 0.95rem;
  white-space: pre-wrap;
  color: #f3f4f6;
  max-height: 250px;
  overflow-y: auto;
  line-height: 1.7;
}

/* Large copy button at bottom */
.btn-copy-large {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  top: auto;
  transform: none;
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 10px rgba(240, 78, 108, 0.2);
}

.btn-copy-large:hover {
  background: var(--primary-hover);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(240, 78, 108, 0.3);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(16, 185, 129, 0.95); /* green */
  color: white;
  padding: 0.75rem 2rem;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  z-index: 1000;
  transition: opacity 0.3s, transform 0.3s;
}

/* Utilities & Animations */
.hidden {
  display: none !important;
}

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

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

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
  100% { transform: translateY(0px); }
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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