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

:root {
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  
  /* Color Palette - Light Mode */
  --background: 210 20% 98%;
  --foreground: 224 71.4% 4.1%;
  
  --card: 0 0% 100%;
  --card-foreground: 224 71.4% 4.1%;
  
  --primary: 348 100% 41.8%; /* Brand red: #d40028 */
  --primary-hover: 348 100% 35%;
  --primary-foreground: 0 0% 100%;
  
  --muted: 215.4 16.3% 46.9%;
  --muted-foreground: 215.4 16.3% 56.9%;
  
  --accent: 210 40% 96.1%;
  --accent-foreground: 222.2 47.4% 11.2%;
  
  --border: 214.3 31.8% 91.4%;
  --input: 214.3 31.8% 91.4%;
  --ring: 348 100% 41.8%;
  
  --success: 142.1 76.2% 36.3%; /* Green */
  --success-bg: 143 85% 96%;
  --success-border: 145 80% 90%;
  
  --radius: 16px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark {
  /* Color Palette - Dark Mode */
  --background: 222.2 47.4% 6.5%; /* Slate 950 */
  --foreground: 210 40% 98%;
  
  --card: 222.2 47.4% 10%; /* Slate 900 */
  --card-foreground: 210 40% 98%;
  
  --primary: 348 100% 45%;
  --primary-hover: 348 100% 50%;
  --primary-foreground: 0 0% 100%;
  
  --muted: 215.4 16.3% 56.9%;
  --muted-foreground: 215.4 16.3% 66.9%;
  
  --accent: 217.2 32.6% 14.5%;
  --accent-foreground: 210 40% 98%;
  
  --border: 217.2 32.6% 14.5%;
  --input: 217.2 32.6% 14.5%;
  --ring: 348 100% 45%;
  
  --success: 142.1 70% 45%;
  --success-bg: 143 50% 10%;
  --success-border: 145 40% 18%;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-sans);
}

body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: hsl(var(--foreground) / 0.15);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: hsl(var(--foreground) / 0.3);
}

/* Page Layout */
.page-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  padding: 28px 16px;
  background-image: 
    radial-gradient(at 0% 0%, hsl(var(--primary) / 0.04) 0px, transparent 50%),
    radial-gradient(at 100% 100%, hsl(var(--primary) / 0.02) 0px, transparent 50%);
}

.portal-card {
  width: 100%;
  max-width: 500px;
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--foreground) / 0.08);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px -12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: var(--transition);
  position: relative;
}

.portal-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, hsl(var(--primary)), #f43f5e);
  z-index: 10;
}

/* Header Section */
.hero-banner {
  background: linear-gradient(135deg, hsl(348, 100%, 36%) 0%, hsl(348, 90%, 22%) 100%);
  color: white;
  padding: 36px 24px 44px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.06;
  background-image: repeating-linear-gradient(
    -45deg,
    #ffffff 0px,
    #ffffff 2px,
    transparent 2px,
    transparent 12px
  );
  pointer-events: none;
}

.glow-effect {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, transparent 60%);
  pointer-events: none;
}

/* Brand styling mimicking İnova & Koç */
.brand-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
  user-select: none;
}

.brand-logo-avis {
  font-style: italic;
  font-weight: 900;
  font-size: 16px;
  letter-spacing: -0.02em;
  background-color: #d40028;
  color: #ffffff;
  padding: 3px 12px;
  border-radius: 4px;
  box-shadow: 0 4px 10px rgba(212, 0, 40, 0.2);
}

.brand-divider {
  width: 1px;
  height: 22px;
  background-color: rgba(255, 255, 255, 0.3);
  display: inline-block;
}

.brand-logo-koc {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  padding-top: 3px;
}

.badge-container {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.pulse-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: rgba(34, 197, 94, 0.16);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #22c55e;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #22c55e;
  animation: pulse-green 2s infinite ease-in-out;
}

@keyframes pulse-green {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.7; }
}

.hero-title {
  font-size: 24px;
  font-weight: 900;
  color: white;
  margin-bottom: 8px;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  max-width: 320px;
  margin: 0 auto;
  line-height: 1.45;
}

/* Main Content Area */
.card-main {
  padding: 28px 24px 36px;
}

.step-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-section {
  display: flex;
  flex-direction: column;
}

.section-title {
  font-size: 13px;
  font-weight: 800;
  color: hsl(var(--primary));
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-left: 3px solid hsl(var(--primary));
  padding-left: 8px;
  line-height: 1;
}

.section-divider {
  border: 0;
  border-top: 1px dashed hsl(var(--foreground) / 0.08);
  margin: 12px 0;
}

/* Info Box Banner */
.info-box {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid;
  line-height: 1.5;
}

.info-box-neutral {
  background-color: hsl(var(--foreground) / 0.025);
  border-color: hsl(var(--foreground) / 0.06);
  color: hsl(var(--foreground) / 0.85);
}

.info-box-success {
  background-color: hsl(var(--success) / 0.08);
  border-color: hsl(var(--success) / 0.15);
  color: hsl(var(--foreground) / 0.85);
}

.info-icon {
  flex-shrink: 0;
  margin-top: 2px;
}

.info-text {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
}

.info-box-title {
  font-size: 14px;
  font-weight: 800;
  color: hsl(var(--foreground));
}

/* Utility layouts */
.flex-col {
  flex-direction: column;
}

.flex-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-3 { margin-bottom: 12px; }
.m-0 { margin: 0 !important; }
.text-xs { font-size: 12px; }
.text-sm { font-size: 14px; }
.text-red { color: hsl(var(--primary)); }
.text-green { color: hsl(var(--success)); }

/* Form inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.form-label {
  font-size: 13px;
  font-weight: 700;
  color: hsl(var(--foreground));
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-icon-label {
  color: hsl(var(--foreground) / 0.4);
}

.input-field {
  width: 100%;
  padding: 13px 16px;
  border-radius: 12px;
  border: 2px solid hsl(var(--foreground) / 0.1);
  background-color: hsl(var(--card));
  color: hsl(var(--foreground));
  font-size: 15px;
  font-weight: 500;
  transition: var(--transition);
  outline: none;
}

.input-field:focus {
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 4px hsl(var(--primary) / 0.12);
}

.input-field[readonly] {
  background-color: hsl(var(--foreground) / 0.025);
  color: hsl(var(--foreground) / 0.6);
  border-color: hsl(var(--foreground) / 0.08);
  cursor: not-allowed;
}

.input-field[readonly]:focus {
  box-shadow: none;
  border-color: hsl(var(--foreground) / 0.08);
}

.input-error {
  border-color: hsl(var(--primary)) !important;
  box-shadow: 0 0 0 4px hsl(var(--primary) / 0.1);
}

.error-message {
  font-size: 12px;
  font-weight: 600;
  color: hsl(var(--primary));
  margin-top: 2px;
}

/* Database lookup status badge next to inputs */
.db-badge {
  position: absolute;
  right: 14px;
  bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  font-size: 11px;
  font-weight: 700;
  gap: 4px;
  border-radius: 6px;
  padding: 2px 6px;
  transition: var(--transition);
}

.db-badge-loading {
  color: hsl(var(--primary));
  animation: spin 1s linear infinite;
}

.db-badge-success {
  color: hsl(var(--success));
  background-color: hsl(var(--success) / 0.12);
}

.db-badge-error {
  color: hsl(var(--primary));
  background-color: hsl(var(--primary) / 0.08);
}

/* Checkbox approval block */
.checkbox-container {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border: 1px solid hsl(var(--foreground) / 0.08);
  border-radius: 12px;
  background-color: hsl(var(--foreground) / 0.01);
  transition: var(--transition);
}

.checkbox-input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: hsl(var(--primary));
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-label {
  font-size: 13px;
  line-height: 1.5;
  color: hsl(var(--foreground) / 0.85);
  cursor: pointer;
  font-weight: 500;
  user-select: none;
}

.disabled-label {
  color: hsl(var(--foreground) / 0.4);
  cursor: not-allowed;
}

/* Buttons */
.button-group {
  display: flex;
  gap: 12px;
}

.flex-1 { flex: 1; }
.w-full { width: 100%; }

/* Canvas Area */
.canvas-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.canvas-header-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-canvas-action {
  background-color: hsl(var(--foreground) / 0.03);
  border: 1px solid hsl(var(--foreground) / 0.08);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  color: hsl(var(--foreground) / 0.75);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition);
  outline: none;
}

.btn-canvas-action:hover:not(:disabled) {
  background-color: hsl(var(--foreground) / 0.06);
  color: hsl(var(--foreground));
  border-color: hsl(var(--foreground) / 0.15);
}

.btn-canvas-action-danger {
  color: hsl(var(--primary));
  border-color: hsl(var(--primary) / 0.15);
  background-color: hsl(var(--primary) / 0.03);
}

.btn-canvas-action-danger:hover:not(:disabled) {
  background-color: hsl(var(--primary) / 0.08);
  color: hsl(var(--primary-hover));
  border-color: hsl(var(--primary) / 0.25);
}

.btn-canvas-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.canvas-wrapper {
  position: relative;
  background-color: hsl(var(--card));
  border: 2px dashed hsl(var(--foreground) / 0.15);
  border-radius: 14px;
  overflow: hidden;
  transition: var(--transition);
  height: 200px;
}

.canvas-wrapper:hover {
  border-color: hsl(var(--primary) / 0.35);
}

.canvas-wrapper.has-sig {
  border-color: hsl(var(--success));
  box-shadow: 0 0 0 4px hsl(var(--success) / 0.08);
}

/* Watermark & Guidelines inside canvas */
.canvas-grid-overlay {
  position: absolute;
  inset: 0;
  background-size: 16px 16px;
  background-image: radial-gradient(circle, hsl(var(--foreground) / 0.04) 1px, transparent 1px);
  pointer-events: none;
  z-index: 1;
}

.canvas-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: hsl(var(--foreground) / 0.045);
  pointer-events: none;
  z-index: 1;
  transition: var(--transition);
}

.canvas-wrapper.has-sig .canvas-watermark {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.85);
}

.canvas-guide-line {
  position: absolute;
  bottom: 44px;
  left: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  z-index: 1;
  transition: var(--transition);
}

.canvas-guide-x {
  font-size: 14px;
  font-weight: 800;
  color: hsl(var(--foreground) / 0.15);
  margin-bottom: 2px;
}

.canvas-dashed-line {
  flex-grow: 1;
  height: 0;
  border-bottom: 1.5px dashed hsl(var(--foreground) / 0.12);
}

.canvas-wrapper.has-sig .canvas-guide-line {
  opacity: 0;
  transform: translateY(12px);
}

#sig-canvas {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 200px;
  display: block;
  cursor: crosshair;
  background-color: transparent;
}

.canvas-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  color: hsl(var(--foreground) / 0.4);
  font-size: 13.5px;
  font-style: italic;
  font-weight: 500;
  user-select: none;
  z-index: 1;
  transition: var(--transition);
}

.canvas-wrapper.has-sig .canvas-placeholder {
  opacity: 0;
}

/* Loading Panel */
.loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 0;
  gap: 14px;
}

.loader-spinner {
  animation: spin 1s linear infinite;
  color: hsl(var(--primary));
}

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

.loader-text {
  font-size: 13px;
  font-weight: 700;
  color: hsl(var(--foreground) / 0.8);
}

/* Success view */
.success-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 12px 0;
  gap: 24px;
}

.success-icon-wrapper {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background-color: hsl(var(--success) / 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--success));
  box-shadow: 0 4px 12px hsl(var(--success) / 0.1);
}

.success-icon {
  animation: bounce-slow 2.4s infinite ease-in-out;
}

@keyframes bounce-slow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

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

.success-title {
  font-size: 22px;
  font-weight: 900;
  color: hsl(var(--foreground));
  letter-spacing: -0.01em;
}

.success-subtitle {
  font-size: 13px;
  color: hsl(var(--foreground) / 0.6);
  max-width: 340px;
  line-height: 1.55;
  margin: 0 auto;
}

.receipt-card {
  width: 100%;
  background-color: hsl(var(--foreground) / 0.02);
  border: 1px solid hsl(var(--foreground) / 0.06);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
}

.receipt-label {
  color: hsl(var(--foreground) / 0.5);
  font-weight: 600;
}

.receipt-value {
  color: hsl(var(--foreground));
  font-weight: 700;
}

.receipt-ref {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.max-w-sm { max-width: 380px; }

/* Modal layout details */
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid hsl(var(--foreground) / 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: hsl(var(--card));
}

.modal-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.modal-title {
  font-size: 16px;
  font-weight: 800;
  color: hsl(var(--foreground));
  margin: 0;
  line-height: 1.3;
}

.modal-subtitle {
  font-size: 11px;
  color: hsl(var(--foreground) / 0.45);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.modal-close-btn {
  font-size: 28px;
  background: none;
  border: none;
  color: hsl(var(--foreground) / 0.4);
  cursor: pointer;
  line-height: 1;
  padding: 0 8px;
  border-radius: 8px;
  transition: var(--transition);
}

.modal-close-btn:hover {
  background-color: hsl(var(--foreground) / 0.06);
  color: hsl(var(--foreground));
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  max-height: 52vh;
  font-size: 13px;
  line-height: 1.65;
  color: hsl(var(--foreground) / 0.8);
  font-weight: 450;
  text-align: left;
  border-bottom: 1px solid hsl(var(--foreground) / 0.06);
}

.modal-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid hsl(var(--foreground) / 0.06);
  background-color: hsl(var(--foreground) / 0.01);
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: stretch;
}

.modal-scroll-hint {
  font-size: 11.5px;
  font-weight: 700;
  text-align: left;
}

.hint-error {
  color: hsl(var(--primary));
  display: flex;
  align-items: center;
  gap: 6px;
}

.hint-success {
  color: #16a34a; /* success emerald green */
  display: flex;
  align-items: center;
  gap: 6px;
}

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

@media (min-width: 640px) {
  .modal-footer {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  
  .modal-buttons {
    width: auto;
  }
}

/* Theme switch button styling */
.theme-switch {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  z-index: 20;
  backdrop-filter: blur(4px);
  outline: none;
}

.theme-switch:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: rotate(15deg);
}

/* Modal backdrop and transition styling */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(9, 15, 29, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background-color: hsl(var(--card));
  color: hsl(var(--foreground));
  width: 100%;
  max-width: 660px;
  border-radius: 20px;
  border: 1px solid hsl(var(--foreground) / 0.08);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 85vh;
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-backdrop.open .modal-content {
  transform: scale(1);
}

/* Premium Buttons styling */
.btn-primary {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-weight: 700;
  padding: 13px 24px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px hsl(var(--primary) / 0.18);
  outline: none;
}

.btn-primary:hover:not(:disabled) {
  background-color: hsl(var(--primary-hover));
  transform: translateY(-1.5px);
  box-shadow: 0 6px 18px hsl(var(--primary) / 0.28);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0.5px);
}

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

.btn-secondary {
  background-color: hsl(var(--foreground) / 0.04);
  color: hsl(var(--foreground));
  font-weight: 700;
  padding: 13px 24px;
  border-radius: 12px;
  border: 1px solid hsl(var(--foreground) / 0.08);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  outline: none;
}

.btn-secondary:hover:not(:disabled) {
  background-color: hsl(var(--foreground) / 0.08);
  border-color: hsl(var(--foreground) / 0.14);
}

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