/* ===========================================
   RETURNFY - Professional Styles (Shopify-inspired)
   =========================================== */

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

:root {
  /* Shopify-inspired colors */
  --primary: #008060;
  --primary-dark: #006847;
  --primary-light: #e3f5f0;
  --accent: #5c6ac4;
  --accent-hover: #4a5aa8;
  --success: #008060;
  --warning: #ffc453;
  --error: #d72c0d;
  --text: #202223;
  --text-secondary: #6d7175;
  --text-disabled: #8c9196;
  --bg: #f6f6f7;
  --bg-white: #ffffff;
  --bg-surface: #f6f6f7;
  --border: #e1e3e5;
  --border-hover: #c9cccf;
  --shadow-sm: 0 1px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.08);
  --radius: 8px;
  --radius-lg: 12px;
  --transition: all 0.2s ease;
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===========================================
   Layout
   =========================================== */

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

.container-wide {
  max-width: 1200px;
}

/* ===========================================
   Form Card
   =========================================== */

.form-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 48px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
}

.form-card.loading {
  opacity: 0.6;
  pointer-events: none;
}

@media (max-width: 768px) {
  .form-card {
    padding: 32px 24px;
  }
}

/* ===========================================
   Header
   =========================================== */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 48px;
  padding: 32px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 300px;
  height: 300px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  pointer-events: none;
}

.header-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  backdrop-filter: blur(10px);
  flex-shrink: 0;
}

.header-icon svg {
  color: white;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.header-content {
  flex: 1;
  margin-left: 24px;
  text-align: left;
}

.header-logo {
  font-size: 28px;
  font-weight: 700;
  color: white;
  margin-bottom: 4px;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-subtitle {
  color: rgba(255, 255, 255, 0.9);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  color: white;
  font-size: 13px;
  font-weight: 600;
  backdrop-filter: blur(10px);
  flex-shrink: 0;
}

.header-badge svg {
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .header {
    flex-direction: column;
    text-align: center;
    padding: 24px 20px;
  }

  .header::before {
    top: -30%;
    right: -30%;
    width: 200px;
    height: 200px;
  }

  .header-icon {
    width: 56px;
    height: 56px;
    margin-bottom: 16px;
  }

  .header-content {
    margin-left: 0;
    text-align: center;
    margin-bottom: 16px;
  }

  .header-logo {
    font-size: 24px;
  }

  .header-subtitle {
    font-size: 14px;
  }

  .header-badge {
    font-size: 12px;
    padding: 6px 12px;
  }
}

/* ===========================================
   Progress Bar
   =========================================== */

.progress-container {
  margin-bottom: 40px;
  padding: 20px;
  background: var(--primary-light);
  border-radius: var(--radius);
}

.progress-bar {
  height: 8px;
  background: #c4e8dc;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  border-radius: 999px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-text {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-dark);
}

/* ===========================================
   Step Content
   =========================================== */

.step-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}

.step-description {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.5;
}

/* ===========================================
   Form Elements
   =========================================== */

.form-group {
  margin-bottom: 24px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.required {
  color: var(--error);
  margin-left: 4px;
}

.form-hint {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.4;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
  outline: none;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: var(--border-hover);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-input::placeholder {
  color: var(--text-disabled);
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236d7175' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}

/* ===========================================
   Buttons
   =========================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  min-width: 120px;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

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

.btn-secondary {
  background: white;
  color: var(--text);
  border: 1.5px solid var(--border);
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-group {
  display: flex;
  gap: 12px;
  margin-top: 32px;
  justify-content: center;
}

/* ===========================================
   File Upload
   =========================================== */

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-surface);
}

.upload-zone:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: scale(1.02);
}

.upload-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.upload-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.upload-preview {
  margin-top: 16px;
}

.upload-preview-item {
  position: relative;
  display: inline-block;
  margin: 8px;
}

.upload-preview-item img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 2px solid var(--border);
}

.remove-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--error);
  color: white;
  border: 2px solid white;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.remove-btn:hover {
  transform: scale(1.1);
  background: #c0210f;
}

/* ===========================================
   Checkbox & Radio
   =========================================== */

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  transition: var(--transition);
}

.checkbox-item:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.checkbox-item input[type="checkbox"] {
  margin-top: 2px;
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--primary);
}

.checkbox-label {
  flex: 1;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  cursor: pointer;
}

/* ===========================================
   Info Tooltip
   =========================================== */

.info-tooltip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  margin-left: 8px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.info-tooltip:hover {
  background: var(--accent-hover);
  transform: scale(1.1);
}

/* ===========================================
   Terms Box
   =========================================== */

.terms-box {
  max-height: 400px;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 24px;
}

.terms-box h4 {
  font-size: 18px;
  color: var(--text);
  margin-bottom: 16px;
  font-weight: 700;
}

.terms-box p {
  margin-bottom: 16px;
  color: var(--text);
}

.terms-box strong {
  color: var(--primary-dark);
  font-weight: 700;
}

.terms-box::-webkit-scrollbar {
  width: 8px;
}

.terms-box::-webkit-scrollbar-track {
  background: var(--border);
  border-radius: 4px;
}

.terms-box::-webkit-scrollbar-thumb {
  background: var(--text-disabled);
  border-radius: 4px;
}

.terms-box::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ===========================================
   Signature Pad
   =========================================== */

.signature-container {
  margin-top: 24px;
}

.signature-pad {
  width: 100%;
  height: 200px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: white;
  cursor: crosshair;
  touch-action: none;
  display: block;
}

.signature-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.signature-clear {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  background: white;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}

.signature-clear:hover {
  border-color: var(--error);
  color: var(--error);
}

/* ===========================================
   Success/Error Screens
   =========================================== */

.success-screen {
  text-align: center;
  padding: 48px 32px;
}

.success-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--success);
  color: white;
  font-size: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  box-shadow: 0 8px 24px rgba(0, 128, 96, 0.3);
}

.success-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  letter-spacing: -0.3px;
}

.success-message {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 480px;
  margin: 0 auto;
}

/* ===========================================
   Loading Screen
   =========================================== */

.loading-screen {
  text-align: center;
  padding: 64px 32px;
}

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

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

.loading-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.loading-message {
  font-size: 15px;
  color: var(--text-secondary);
}

/* ===========================================
   Order Cards
   =========================================== */

.order-card {
  padding: 20px;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  cursor: pointer;
  transition: var(--transition);
}

.order-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.order-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: var(--shadow);
}

.order-number {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.order-details {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* ===========================================
   Status Badges
   =========================================== */

.status-badge {
  display: inline-block;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 6px;
}

.badge-pending {
  background: #fef3cd;
  color: #856404;
}

.badge-reviewing {
  background: #cfe2ff;
  color: #084298;
}

.badge-approved {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.badge-denied {
  background: #f8d7da;
  color: #842029;
}

/* ===========================================
   Character Counter
   =========================================== */

.char-counter {
  font-size: 12px;
  color: var(--text-disabled);
  text-align: right;
  margin-top: 6px;
}

.char-counter.warning {
  color: var(--warning);
}

.char-counter.error {
  color: var(--error);
}

/* ===========================================
   Responsive
   =========================================== */

@media (max-width: 768px) {
  .container {
    padding: 20px 16px;
  }

  .form-card {
    padding: 24px 20px;
  }

  .header {
    margin-bottom: 32px;
    padding-bottom: 24px;
  }

  .header-logo {
    font-size: 26px;
  }

  .step-title {
    font-size: 22px;
  }

  .btn-group {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .progress-container {
    padding: 16px;
  }

  .upload-zone {
    padding: 24px 16px;
  }

  .upload-icon {
    font-size: 40px;
  }

  .success-screen {
    padding: 32px 20px;
  }

  .success-icon {
    width: 64px;
    height: 64px;
    font-size: 36px;
  }

  .success-title {
    font-size: 24px;
  }
}

/* ===========================================
   Animations
   =========================================== */

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

.step {
  animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===========================================
   Utility Classes
   =========================================== */

.text-center {
  text-align: center;
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

/* ===========================================
   Admin Panel Specific Styles
   =========================================== */

.admin-header {
  background: var(--primary);
  color: white;
  padding: 20px 0;
  margin-bottom: 32px;
  box-shadow: var(--shadow);
}

.admin-header h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
}

.admin-nav {
  display: flex;
  gap: 24px;
  margin-top: 16px;
}

.admin-nav a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-weight: 500;
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
}

.admin-nav a:hover {
  color: white;
  border-bottom-color: rgba(255, 255, 255, 0.5);
}

.admin-nav a.active {
  color: white;
  border-bottom-color: white;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: white;
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.stat-label {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Data Table */
.data-table {
  width: 100%;
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border-collapse: collapse;
}

.data-table thead {
  background: var(--bg-surface);
}

.data-table th {
  text-align: left;
  padding: 16px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
}

.data-table td {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.data-table tbody tr:hover {
  background: var(--bg-surface);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Action Buttons */
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  margin-right: 8px;
}

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

.action-btn.view:hover {
  background: var(--accent-hover);
}

.action-btn.approve {
  background: var(--success);
  color: white;
}

.action-btn.approve:hover {
  background: var(--primary-dark);
}

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

.action-btn.resend:hover {
  background: var(--accent-hover);
}

.action-btn.deny {
  background: var(--error);
  color: white;
}

.action-btn.deny:hover {
  background: #c0210f;
}

/* Modals */
.modal-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: 1000;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-surface);
  border-radius: 50%;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--border);
  color: var(--text);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}

/* Order status badges in table */
.order-status-badge {
  display: inline-block;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 4px;
}

/* Disabled order card */
.order-card.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.order-card.disabled:hover {
  transform: none;
  box-shadow: var(--shadow);
}

/* Admin login specific styles */
#loginScreen .header {
  /* Override customer header for login */
  padding: 20px;
  margin-bottom: 0;
}

#loginScreen .header-logo {
  font-size: 24px;
  text-align: center;
}

#loginScreen .header-subtitle {
  font-size: 14px;
  text-align: center;
}

.btn-block {
  width: 100%;
  margin-top: 16px;
}
