/* ========================================
   ROASTMASTER 3000 - Modern Styles
   ======================================== */

:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-card: #252542;
  --accent-primary: #ff6b35;
  --accent-secondary: #f7c59f;
  --accent-glow: rgba(255, 107, 53, 0.4);
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --error: #ff4757;
  --success: #2ed573;
  --border-radius: 16px;
  --transition: all 0.3s ease;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  background: linear-gradient(135deg, var(--bg-primary) 0%, #1a0f1a 100%);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* ========================================
   HEADER
   ======================================== */
.header {
  text-align: center;
  margin-bottom: 40px;
}

.title {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: -1px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.fire {
  font-size: 2rem;
  animation: flicker 2s infinite alternate;
}

@keyframes flicker {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(0.95); }
}

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

/* ========================================
   UPLOAD SECTION
   ======================================== */
.drop-zone {
  background: var(--bg-secondary);
  border: 3px dashed var(--accent-primary);
  border-radius: var(--border-radius);
  padding: 60px 40px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.drop-zone::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);
  transition: left 0.5s;
}

.drop-zone:hover::before {
  left: 100%;
}

.drop-zone:hover {
  border-color: var(--accent-secondary);
  background: var(--bg-card);
  transform: translateY(-2px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.drop-zone.drag-over {
  background: var(--accent-glow);
  border-style: solid;
  transform: scale(1.02);
}

.upload-icon {
  font-size: 4rem;
  margin-bottom: 16px;
}

.drop-text {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.browse {
  color: var(--accent-primary);
  text-decoration: underline;
  cursor: pointer;
}

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

/* ========================================
   RESULT SECTION
   ======================================== */
.result-section {
  animation: fadeIn 0.5s ease;
}

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

.image-container {
  position: relative;
  margin-bottom: 30px;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.preview-image {
  width: 100%;
  height: auto;
  display: block;
  max-height: 500px;
  object-fit: cover;
}

.image-frame {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.frame-corner {
  position: absolute;
  font-size: 1.5rem;
  opacity: 0.8;
}

.frame-corner.tl { top: 10px; left: 10px; }
.frame-corner.tr { top: 10px; right: 10px; }
.frame-corner.bl { bottom: 10px; left: 10px; }
.frame-corner.br { bottom: 10px; right: 10px; }

/* ========================================
   LOADING STATE
   ======================================== */
.loading {
  text-align: center;
  padding: 40px;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid var(--bg-card);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: spin 1s linear infinite;
}

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

.loading-text {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.loading-subtext {
  color: var(--text-secondary);
}

/* ========================================
   ROAST RESULT
   ======================================== */
.roast-card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 30px;
  margin-bottom: 24px;
  position: relative;
  border: 1px solid rgba(255, 107, 53, 0.2);
}

.roast-header {
  margin-bottom: 16px;
}

.roast-badge {
  background: var(--accent-primary);
  color: var(--bg-primary);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 1px;
}

.roast-text {
  font-size: 1.4rem;
  line-height: 1.7;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  quotes: '"' '"';
}

.roast-text::before {
  content: open-quote;
  color: var(--accent-primary);
  font-size: 2rem;
  margin-right: 4px;
}

.roast-text::after {
  content: close-quote;
  color: var(--accent-primary);
  font-size: 2rem;
  margin-left: 4px;
}

.roast-footer {
  margin-top: 20px;
  text-align: right;
}

.signature {
  color: var(--accent-primary);
  font-style: italic;
  font-weight: 600;
}

/* ========================================
   BUTTONS
   ======================================== */
.actions {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.btn {
  flex: 1;
  padding: 16px 24px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent-primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #ff8555;
  transform: translateY(-2px);
  box-shadow: 0 10px 30px var(--accent-glow);
}

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

.btn-secondary:hover {
  background: var(--bg-secondary);
  border-color: var(--accent-primary);
}

.btn-tertiary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.2);
  margin-top: 12px;
  padding: 12px 24px;
  font-size: 0.9rem;
}

.btn-tertiary:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.share-card-loading {
  text-align: center;
  padding: 20px;
  color: var(--accent-primary);
  animation: fadeIn 0.3s ease;
}

.mini-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid var(--bg-card);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin 1s linear infinite;
}

.share-hint {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  background: var(--bg-card);
  padding: 20px;
  border-radius: 12px;
  margin-top: 20px;
}

.share-hint p {
  margin-bottom: 12px;
  color: var(--text-primary);
}

.share-hint-small {
  font-size: 0.85rem;
  opacity: 0.8;
  margin-top: 8px;
}

/* ========================================
   ERROR STATE
   ======================================== */
.error {
  text-align: center;
  padding: 40px;
  background: rgba(255, 71, 87, 0.1);
  border-radius: var(--border-radius);
  border: 1px solid var(--error);
}

.error-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.error-text {
  color: var(--error);
  margin-bottom: 20px;
  font-weight: 500;
}

/* ========================================
   FOOTER
   ======================================== */
.footer {
  text-align: center;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.footer a {
  color: var(--accent-primary);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* ========================================
   UTILITIES
   ======================================== */
.hidden {
  display: none !important;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 600px) {
  .title {
    font-size: 1.8rem;
  }
  
  .drop-zone {
    padding: 40px 20px;
  }
  
  .roast-text {
    font-size: 1.15rem;
  }
  
  .actions {
    flex-direction: column;
  }
  
  .btn {
    width: 100%;
  }
}

/* ========================================
   IFRAME EMBED ADJUSTMENTS
   ======================================== */
/* When embedded in WordPress via iframe */
body.embedded {
  min-height: auto;
}

body.embedded .container {
  padding: 20px;
}

body.embedded .header {
  margin-bottom: 20px;
}

body.embedded .title {
  font-size: 1.8rem;
}

body.embedded .subtitle {
  font-size: 1rem;
}

body.embedded .drop-zone {
  padding: 40px 20px;
}

/* Print styles for screenshot sharing */
@media print {
  .upload-section,
  .actions,
  .share-hint,
  .footer {
    display: none !important;
  }
  
  body {
    background: white;
  }
  
  .roast-card {
    border: 2px solid #333;
    page-break-inside: avoid;
  }
}
