/**
 * CoCLinks Platform — Add Base Layout Styles
 * Apple Clean & Airy Design Language (8pt Spatial System)
 */

.add-layout-container {
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

.add-layout-header {
  text-align: center;
  margin-bottom: 32px;
}

.add-layout-title {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.025em;
}

.add-layout-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 540px;
  margin: 0 auto;
}

/* Main Form Card */
.add-layout-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 16px);
  padding: 32px;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.02);
}

@media (max-width: 640px) {
  .add-layout-card {
    padding: 20px 16px;
    border-radius: 14px;
  }
  
  .add-layout-title {
    font-size: 1.45rem;
  }
}

/* Form Groups & Labels */
.add-layout-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.required-star {
  color: #ef4444;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-tertiary, #94a3b8);
  line-height: 1.4;
}

/* Input with Left Icon */
.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-secondary);
  pointer-events: none;
}

.form-control {
  width: 100%;
  padding: 12px 14px 12px 42px;
  font-size: 0.92rem;
  color: var(--text-primary);
  background: var(--bg-subtle, #f8fafc);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}

.form-control:focus {
  background: var(--bg-card);
  border-color: var(--brand-blue, #0071e3);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

/* Upload Dropzone */
.file-input-hidden {
  display: none;
}

.upload-dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--bg-subtle, #f8fafc);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.upload-dropzone:hover,
.upload-dropzone.drag-active {
  border-color: var(--brand-blue, #0071e3);
  background: rgba(0, 113, 227, 0.03);
}

html.dark .upload-dropzone:hover,
html.dark .upload-dropzone.drag-active {
  background: rgba(41, 151, 255, 0.06);
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.dropzone-icon-box {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-blue, #0071e3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.dropzone-texts {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dropzone-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
}

.dropzone-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Dropzone Preview */
.dropzone-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.preview-img-wrap {
  width: 100%;
  max-height: 280px;
  overflow: hidden;
  border-radius: 8px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}

.preview-img {
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
  display: block;
}

.preview-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.preview-name {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-dim-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-change-image {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-change-image:hover {
  border-color: var(--brand-blue, #0071e3);
  color: var(--brand-blue, #0071e3);
}

/* Live Link Detection Badge */
.link-detection-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  align-self: flex-start;
  margin-top: 4px;
}

html.dark .link-detection-badge {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.detect-check {
  font-weight: 700;
}

/* Admin Only Field Accent */
.admin-only-field {
  padding: 16px;
  background: rgba(0, 113, 227, 0.04);
  border: 1px solid rgba(0, 113, 227, 0.15);
  border-radius: 12px;
}

html.dark .admin-only-field {
  background: rgba(41, 151, 255, 0.06);
  border-color: rgba(41, 151, 255, 0.2);
}

/* Alert Message */
.form-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #dc2626;
  border-radius: 10px;
  font-size: 0.86rem;
  line-height: 1.4;
}

html.dark .form-alert {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #f87171;
}

/* Submit Button */
.btn-submit-layout {
  width: 100%;
  padding: 14px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #ffffff;
  background: var(--brand-blue, #0071e3);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(0, 113, 227, 0.25);
}

.btn-submit-layout:hover {
  background: #0077ed;
  box-shadow: 0 4px 14px rgba(0, 113, 227, 0.35);
}

.btn-submit-layout:active {
  transform: scale(0.99);
}

.btn-submit-layout:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

/* Spinner Animation */
.spin {
  animation: spinRotate 0.8s linear infinite;
}

@keyframes spinRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Success State */
.submit-success-state {
  text-align: center;
  padding: 40px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.success-icon-wrap {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
}

html.dark .success-icon-wrap {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.success-h2 {
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.success-p {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 460px;
  margin: 0;
}

.btn-submit-more {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-submit-more:hover {
  border-color: var(--brand-blue, #0071e3);
  color: var(--brand-blue, #0071e3);
}

/* Duplicate Detection Modal (#coc_popup) */
.coc-dup-modal-dialog .coc-popup-card {
  width: 460px;
}

.dup-modal-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.dup-thumb-box {
  width: 100%;
  max-height: 220px;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}

.dup-thumb-img {
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  display: block;
}

.dup-modal-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  text-align: center;
}

.dup-badge-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.dup-badge {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
}

.dup-badge-match {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

html.dark .dup-badge-match {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.35);
}

.dup-badge-level {
  background: rgba(0, 113, 227, 0.1);
  color: #0071e3;
  border: 1px solid rgba(0, 113, 227, 0.25);
}

html.dark .dup-badge-level {
  background: rgba(41, 151, 255, 0.15);
  color: #60a5fa;
  border-color: rgba(41, 151, 255, 0.3);
}

.dup-modal-desc {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.dup-modal-buttons {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 6px;
}

.dup-btn-action {
  flex: 1;
  padding: 10px 16px;
  background: var(--brand-blue, #0071e3);
  color: #ffffff !important;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(0, 113, 227, 0.25);
}

.dup-btn-action:hover {
  background: #0077ed;
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.35);
}

.dup-btn-close {
  padding: 10px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dup-btn-close:hover {
  border-color: var(--text-secondary);
}

.input-has-duplicate {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18) !important;
}
