/* Modern CSS Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Color Palette derived from the image vibe */
  --primary-color: #5c321e; /* Dark brown text color */
  --primary-light: #7a452c;
  --secondary-color: #d4af37; /* Gold accent */
  --accent-color: #a06440;

  --bg-color: #f8f5f0; /* Off-white/cream background */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.5);

  --text-main: #333333;
  --text-muted: #666666;

  --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 20px rgba(92, 50, 30, 0.08);
  --shadow-lg: 0 15px 35px rgba(92, 50, 30, 0.12);

  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;

  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

body {
  font-family: "Philosopher", sans-serif;
  background-color: var(--bg-color);
  background-image:
    radial-gradient(
      circle at top right,
      rgba(212, 175, 55, 0.05) 0%,
      transparent 40%
    ),
    radial-gradient(
      circle at bottom left,
      rgba(92, 50, 30, 0.05) 0%,
      transparent 40%
    );
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

/* Typography styles inside canvas will be handled by JS */

.app-container {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

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

.logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 5px;
}

@media (max-width: 600px) {
  .logo-container {
    flex-direction: column;
    gap: 5px;
  }
}

.logo-img {
  height: 60px; /* Adjust height based on your logo aspect ratio */
  width: auto;
  object-fit: contain;
}

.app-header h1 {
  font-size: 2.5rem;
  color: var(--primary-color);
  font-weight: 700;
}

.app-header p {
  font-size: 1.1rem;
  color: var(--primary-light);
  letter-spacing: 0.5px;
}

/* Main Content Area */
.app-main {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 30px;
  align-items: start;
}

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

/* Glassmorphism Panels */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-md);
  animation: fadeInUp 0.8s ease-out backwards;
}

.controls-section {
  animation-delay: 0.1s;
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.preview-section {
  animation-delay: 0.2s;
}

/* Form Controls */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.input-group label {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-color);
}

.input-group input {
  width: 100%;
  padding: 15px 20px;
  font-family: inherit;
  font-size: 1.1rem;
  color: var(--primary-color);
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
  transition: var(--transition);
  outline: none;
}

.input-group input:focus {
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.1);
}

.input-group input::placeholder {
  color: #a0a0a0;
}

/* Buttons */
.button-group {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.btn {
  width: 100%;
  padding: 16px 24px;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn-primary {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-light)
  );
  color: white;
  box-shadow: 0 4px 15px rgba(92, 50, 30, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(92, 50, 30, 0.4);
  background: linear-gradient(
    135deg,
    var(--primary-light),
    var(--primary-color)
  );
}

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

.btn-secondary {
  background: white;
  color: var(--primary-color);
  border: 2px solid var(--primary-light);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--primary-light);
  color: white;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
  background: #e0e0e0;
  color: #999;
  border-color: #d0d0d0;
}

/* Preview Area */
.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.preview-header h2 {
  font-size: 1.4rem;
  color: var(--primary-color);
}

.status-badge {
  font-family: sans-serif;
  font-size: 0.8rem;
  padding: 4px 12px;
  background: #eee;
  color: #666;
  border-radius: 20px;
  font-weight: 600;
}

.status-badge.active {
  background: #e6f4ea;
  color: #1e8e3e;
}

.canvas-container {
  width: 100%;
  position: relative;
  background: #fff;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  aspect-ratio: 3/4; /* Approximate aspect ratio of standard greeting card */
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px dashed #ccc;
}

canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: none; /* hidden until generated */
  transform-origin: top center;
}

.loader {
  position: absolute;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--primary-color);
  font-weight: 700;
}

/* Footer */
.app-footer {
  text-align: center;
  margin-top: 10px;
  font-size: 0.95rem;
  color: var(--text-muted);
}

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

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