/* MotorPoster Builder Styles */
/* Shared across car.html, boat.html, motorhome.html, motorbike.html */

:root {
  --brand: #005ea5;
  --brand-light: #0284c7;
  --accent: #f59e0b;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --red: #e11d48;
  --success: #10b981;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  font-family: Georgia, 'Times New Roman', serif;
  color: var(--ink);
  line-height: 1.6;
}

/* Modern Gradient Navigation */
.top {
  background: linear-gradient(135deg, #005ea5 0%, #0284c7 100%);
  box-shadow: 0 4px 20px rgba(0, 94, 165, 0.3);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
}

.nav img {
  height: 46px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s;
}

.nav img:hover {
  transform: scale(1.05);
}

.nav .links {
  display: flex;
  gap: 20px;
  align-items: center;
}

.nav a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-family: 'Trebuchet MS', Calibri, sans-serif;
  transition: all 0.3s;
  font-size: 15px;
}

.nav a:hover {
  text-decoration: underline;
  color: #fde68a;
}

/* Main Container */
.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

/* Page Header */
h1 {
  font-family: 'Trebuchet MS', Calibri, sans-serif;
  font-size: 2.2rem;
  font-weight: 800;
  margin: 0 0 10px 0;
  background: linear-gradient(135deg, #005ea5, #0284c7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.intro {
  color: var(--muted);
  font-size: 1.05rem;
  margin-bottom: 30px;
  line-height: 1.6;
}

/* Grid Layout */
.grid {
  display: grid;
  gap: 30px;
  grid-template-columns: minmax(320px, 520px) 1fr;
  align-items: start;
}

/* Enhanced Cards */
.card {
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 18px;
  padding: 32px;
  box-shadow: 0 8px 24px rgba(0, 94, 165, 0.08);
  transition: all 0.3s;
}

.card:hover {
  box-shadow: 0 12px 32px rgba(0, 94, 165, 0.12);
  transform: translateY(-2px);
}

/* Form Elements */
label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  display: block;
  margin: 18px 0 8px 0;
  font-family: 'Trebuchet MS', Calibri, sans-serif;
}

label:first-of-type {
  margin-top: 0;
}

input, select, textarea {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 13px 15px;
  font: inherit;
  font-size: 15px;
  min-height: 48px;
  line-height: 1.4;
  background: #fff;
  transition: all 0.3s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(0, 94, 165, 0.1);
}

input::placeholder, textarea::placeholder {
  color: #94a3b8;
}

textarea {
  min-height: 110px;
  resize: vertical;
  font-family: inherit;
}

/* Grid Layouts */
.row {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 12px;
}

.row3 {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr 1fr;
  margin-bottom: 12px;
}

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

.other-hidden {
  display: none;
}

.muted {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
  font-style: italic;
}

/* Photo Upload Section */
.photo-upload {
  margin: 24px 0;
  padding: 24px;
  background: linear-gradient(135deg, #f0f9ff 0%, #fef3c7 100%);
  border: 2px dashed var(--brand);
  border-radius: 14px;
}

.photo-upload > label {
  color: var(--brand);
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 10px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.photo-upload-hint {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 12px 0;
  line-height: 1.5;
}

.photo-preview {
  margin-top: 16px;
  max-width: 100%;
  max-height: 300px;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  display: block;
}

.btn-remove-photo {
  background: #ef4444;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-remove-photo:hover {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Disclaimer Box */
.disclaimer {
  margin: 24px 0;
  padding: 18px;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
}

.disclaimer label {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
  line-height: 1.6;
  margin: 0;
}

.disclaimer input[type="checkbox"] {
  width: 24px;
  height: 24px;
  min-width: 24px;
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
}

.disclaimer span {
  flex: 1;
  font-size: 15px;
  color: #334155;
  cursor: pointer;
  font-weight: normal;
}

/* Restore Notice */
.restore-notice {
  background: linear-gradient(135deg, #dbeafe 0%, #fef3c7 100%);
  border: 2px solid #bfdbfe;
  border-radius: 14px;
  padding: 18px 24px;
  margin-bottom: 24px;
  display: none;
  animation: slideDown 0.3s ease-out;
}

.restore-notice.show {
  display: block;
}

.restore-notice p {
  margin: 0;
  color: var(--brand);
  font-weight: 600;
  font-size: 15px;
}

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

/* Buttons */
.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 15px 28px;
  font-weight: 700;
  font-size: 16px;
  font-family: 'Trebuchet MS', Calibri, sans-serif;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 94, 165, 0.3);
  transition: all 0.3s;
  line-height: 1;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 94, 165, 0.4);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

button .spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

button.loading .spinner {
  display: inline-block;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--brand);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s;
  font-family: 'Trebuchet MS', Calibri, sans-serif;
}

.btn:hover {
  background: var(--brand-light);
  transform: translateY(-1px);
}

.btn.ghost {
  background: #fff;
  border: 2px solid var(--line);
  color: var(--ink);
}

.btn.ghost:hover {
  background: #f8fafc;
  border-color: var(--brand);
}

/* Sidebar Poster Preview */
.poster-shell {
  padding: 24px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 18px;
  min-height: 240px;
  position: sticky;
  top: 80px;
  transition: all 0.3s;
}

.poster-shell.has-preview {
  min-height: 600px;
}

.poster-hint {
  color: var(--muted);
  line-height: 1.7;
  font-size: 14px;
}

.poster-hint b {
  color: var(--ink);
  font-weight: 700;
}

/* Preview Content */
#previewContent {
  display: none;
}

#previewContent.show {
  display: block;
}

.preview-frame-container {
  margin: 20px 0;
  border: 2px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #f8fafc;
}

#posterPreviewFrame {
  width: 100%;
  height: 500px;
  border: none;
  display: block;
  background: white;
}

.preview-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.preview-actions button {
  width: 100%;
  justify-content: center;
  padding: 12px 20px;
  font-size: 15px;
}

.preview-actions button.secondary {
  background: #fff;
  border: 2px solid var(--line);
  color: var(--ink);
  box-shadow: none;
}

.preview-actions button.secondary:hover:not(:disabled) {
  background: #f8fafc;
  border-color: var(--brand);
}

.preview-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Ad Placeholder */
.ad {
  background: linear-gradient(135deg, #f8fafc 0%, #f0f9ff 100%);
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  color: #64748b;
  margin-top: 24px;
  font-size: 14px;
}

/* Error States */
input.error, select.error, textarea.error {
  border-color: var(--red);
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.error-message {
  color: var(--red);
  font-size: 13px;
  margin-top: 4px;
  display: none;
}

.error-message.show {
  display: block;
}

/* Success States */
.success-message {
  background: #ecfdf5;
  border: 2px solid #86efac;
  color: #166534;
  padding: 14px 18px;
  border-radius: 10px;
  margin: 16px 0;
  font-weight: 600;
  display: none;
}

.success-message.show {
  display: block;
}

/* Responsive Design */
@media (max-width: 980px) {
  .grid {
    grid-template-columns: 1fr;
  }
  
  .row3 {
    grid-template-columns: 1fr;
  }
  
  .row {
    grid-template-columns: 1fr;
  }
  
  .nav {
    padding: 12px 16px;
  }
  
  .nav img {
    height: 40px;
  }
  
  .nav .links {
    gap: 14px;
    font-size: 14px;
  }
  
  h1 {
    font-size: 1.8rem;
  }
  
  .wrap {
    padding: 24px 16px 60px;
  }
  
  .card {
    padding: 24px 20px;
  }
  
  button {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .nav .links {
    display: none;
  }
  
  h1 {
    font-size: 1.6rem;
  }
  
  .inline {
    flex-direction: column;
    gap: 12px;
  }
  
  .inline select,
  .inline input {
    width: 100%;
  }
}

/* Print Styles */
@media print {
  .top, .ad, .actions, .poster-shell {
    display: none;
  }
}

/* Loading State */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-overlay.show {
  display: flex;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}