/* ========================================================================
   Web Technology Detector - New Design System
   Version: 2.0.0
   ======================================================================== */

/* ========================================================================
   CSS VARIABLES
   ======================================================================== */

:root {
  /* Colors - New Design Palette */
  --color-primary: #2370FF;
  --color-primary-gradient-start: #2370FF;
  --color-primary-gradient-end: #5DA0FF;
  
  --color-text-primary: #1A1A2E;
  --color-text-secondary: #211F54;
  --color-text-muted: #73738C;
  --color-text-light: #6E7191;
  --color-text-disabled: #C4C5D0;
  
  --color-background: #EFF5FF;
  --color-surface: #FFFFFF;
  --color-surface-secondary: #FAFBFC;
  --color-border: #EFF0F6;
  --color-border-strong: #DCDDEB;
  --color-border-secondary: #E7ECF0;
  
  --color-icon-default: #6E7C91;
  --color-icon-muted: #DCDDEB;
  
  --color-badge-bg: #F7F9FC;
  --color-badge-text: #6E7C91;
  
  --color-button-secondary-bg: #EFF2F6;
  --color-button-secondary-shadow: rgba(178, 202, 238, 0.31);
  
  /* Shadows */
  --shadow-sm: 0px 2px 7px rgba(20, 20, 43, 0.08);
  --shadow-md: 0px 2px 6px rgba(33, 31, 84, 0.06);
  --shadow-button-primary: 0px 3px 12px rgba(51, 136, 255, 0.18);
  --shadow-button-secondary: 0px 3px 12px rgba(51, 109, 255, 0.18);
  --shadow-button-icon: 0px -1px 2px rgba(178, 202, 238, 0.31) inset;
  --shadow-badge: 0px 1px 2px rgba(33, 31, 84, 0.14);
  --shadow-platform-icon: 0px 1px 3px rgba(41, 123, 247, 0.31);
  
  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 12px;
  --spacing-lg: 16px;
  --spacing-xl: 24px;
  --spacing-2xl: 32px;
  --spacing-3xl: 40px;
  --spacing-4xl: 48px;
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 159984px;
  --radius-input: 80px;
  
  /* Layout */
  --max-width: 728px;
  
  /* Typography */
  --font-family: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ========================================================================
   RESET & BASE STYLES
   ======================================================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0); /* Remove tap highlight */
  -webkit-tap-highlight-color: transparent; /* Alternative for some browsers */
}

body {
  font-family: var(--font-family);
  font-size: 14px;
  line-height: 1.625;
  color: var(--color-text-primary);
  background: var(--color-background);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Ensure Inter Tight loads everywhere except icons */
*, *::before, *::after {
  font-family: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Preserve icon fonts */
.bi, [class^="bi-"], [class*=" bi-"] {
  font-family: 'bootstrap-icons' !important;
}

/* Remove tap highlight from all interactive elements */
a, button, input, textarea, select, [onclick], [role="button"] {
  -webkit-tap-highlight-color: transparent;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  -webkit-touch-callout: none;
}

/* ========================================================================
   LAYOUT
   ======================================================================== */

.app-background {
  background: var(--color-background);
  min-height: 100vh;
  padding: 40px 20px;
}

.app-container {
  max-width: var(--max-width);
  margin: 0 auto;
}

.app-header {
  text-align: left;
  margin-bottom: var(--spacing-xl); /* 24px */
}

.logo {
  width: 120px;
  height: auto;
  margin-bottom: var(--spacing-2xl); /* 32px */
  display: block;
}

.app-title {
  font-size: 36px;
  font-weight: 700;
  line-height: 45px;
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-md);
}

.app-subtitle {
  font-size: 18px;
  font-weight: 400;
  line-height: 29.25px;
  color: var(--color-text-muted);
}

.app-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Ensure proper spacing when error message is shown */
#error + .card,
#error + .results-section {
  margin-top: 0; /* Reset margin as gap is handled by error margin-bottom */
}

/* ========================================================================
   CARD COMPONENT
   ======================================================================== */

.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--spacing-3xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xl);
}

.card-header {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.card-header-with-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  line-height: 24.75px;
  color: var(--color-text-primary);
}

.card-subtitle {
  font-size: 14px;
  font-weight: 400;
  line-height: 22.75px;
  color: var(--color-text-muted);
}

/* ========================================================================
   FORM COMPONENTS
   ======================================================================== */

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.form-label {
  font-size: 14px;
  font-weight: 500;
  line-height: 22.75px;
  color: #40405A;
  padding-left: var(--spacing-xs);
}

.input-wrapper {
  position: relative;
  width: 100%;
}

.input-icon {
  position: absolute;
  left: 20px;
  top: 47%;
  transform: translateY(-50%);
  font-size: 19px;
  color: #6E7191;
  pointer-events: none;
}

.form-input {
  width: 100%;
  height: 49px;
  padding: 0 85px 0 44px; /* Increased right padding for paste button */
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  box-shadow: var(--shadow-sm);
  font-family: var(--font-family);
  font-size: 14px;
  color: var(--color-text-primary);
  transition: all 0.2s ease;
}

/* Paste button - exact style from design */
.btn-paste {
  position: absolute;
  right: 12px; /* Adjusted to 14px from right */
  top: 50%;
  transform: translateY(-50%);
  height: 32px;
  padding: 0 12px;
  background: #EFF2F6;
  box-shadow: 0px -1px 2px rgba(178, 202, 238, 0.31) inset;
  border-radius: 20px; /* Fully rounded to match input field style */
  border: none;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  color: #211F54;
  font-size: 14px;
  font-family: 'Inter Tight', sans-serif;
  font-weight: 400;
  line-height: 15px;
  transition: all 0.2s ease;
}

.btn-paste i {
  font-size: 13px;
  position: relative;
  bottom: 1px;
}

.btn-paste span {
  font-size: 14px;
}

.btn-paste:hover {
  background: #E5E8ED;
}

.btn-paste:active {
  transform: translateY(-50%) scale(0.98);
}

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

.form-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(35, 112, 255, 0.1);
}

/* Error state for invalid input */
.form-input.error {
  border-color: #DC2626;
  background: #FEF2F2;
}

.form-input.error:focus {
  border-color: #DC2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.input-error-message {
  font-size: 12px;
  color: #DC2626;
  margin-top: 4px;
  padding-left: 4px;
  display: none;
}

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

.input-helper {
  font-size: 12px;
  line-height: 19.5px;
  color: var(--color-text-muted);
  padding-left: var(--spacing-xs);
}

/* ========================================================================
   BUTTON COMPONENTS
   ======================================================================== */

.button-group {
  display: flex;
  gap: var(--spacing-lg);
}

.btn {
  flex: 1;
  height: 48px;
  padding: 0 24px;
  border: none;
  border-radius: var(--radius-full);
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 500;
  line-height: 15px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.btn-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  height: 20px;
}

/* Inner sliding container */
.btn-content {
  display: flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
  background: linear-gradient(0deg, var(--color-primary-gradient-start) 0%, var(--color-primary-gradient-end) 100%);
  color: white;
  box-shadow: var(--shadow-button-primary);
  border: 1px solid var(--color-primary);
}

/* Dot indicator */
.btn-dot {
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0;
  transform: scale(0);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-right: -14px; /* Negative margin to hide when not hovered */
}

.btn-secondary .btn-dot {
  background: var(--color-primary);
}

/* Button text */
.btn span {
  white-space: nowrap;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Icon */
.btn-icon-arrow {
  font-size: 24px;
  flex-shrink: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-icon-clear {
  font-size: 14px;
  flex-shrink: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover states */
.btn-primary:hover,
.btn-secondary:hover {
  box-shadow: 0px 5px 16px rgba(51, 136, 255, 0.25);
}

/* On hover: show dot and hide icon */
.btn:hover .btn-dot {
  opacity: 1;
  transform: scale(1);
  margin-right: 0;
}

.btn:hover .btn-icon-arrow,
.btn:hover .btn-icon-clear {
  margin-left: -20px;
  opacity: 0;
  transform: scale(0);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text-secondary);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border-strong);
}

.btn-secondary:hover {
  color: var(--color-primary);
  box-shadow: var(--shadow-md);
}

.btn-icon-small {
  width: 32px;
  height: 32px;
  background: #EFF2F6;
  box-shadow: 0px -1px 2px rgba(178, 202, 238, 0.31) inset;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: #6E7C91;
}

.btn-icon-small:hover {
  background: #E5E8ED;
}

.btn-icon-small i {
  font-size: 14px;
}

/* Clear history button - restored original */
.btn-clear-history {
  width: 42px;
  height: 32px;
  background: #EFF2F6;
  box-shadow: 0px -1px 2px rgba(178, 202, 238, 0.31) inset;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: #6E7C91;
}

.btn-clear-history:hover {
  background: #E5E8ED;
}

.btn-clear-history i {
  font-size: 16px;
}


/* ========================================================================
   PLATFORM RESULTS
   ======================================================================== */

.platform-results {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-lg);
}

.platform-card {
  padding: var(--spacing-lg);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
  transition: all 0.2s ease;
}

.platform-card.active {
  box-shadow: var(--shadow-md);
}

.platform-card.active[data-platform="Webflow"] {
  border: 3px solid #146EF5;
}

.platform-card.active[data-platform="Framer"] {
  border: 3px solid #00AFFF;
}

.platform-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.platform-icon svg {
  width: 100%;
  height: 100%;
}

.platform-info {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.platform-name {
  font-size: 16px;
  font-weight: 700;
  line-height: 26px;
}

.platform-name.active {
  color: var(--color-text-secondary);
}

.platform-name.inactive {
  color: var(--color-text-disabled);
}


.platform-subtitle {
  font-size: 14px;
  font-weight: 400;
  line-height: 22.75px;
  color: var(--color-text-muted);
}

/* Other Technology Card */
.other-tech-card {
  grid-column: 1 / -1; /* Span both columns */
  border: 3px solid #DC2626;
  background: var(--color-surface);
}

.other-tech-icon {
  width: 48px;
  height: 48px;
  background: #DC2626;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
}

.other-tech-icon i {
  position: relative;
  bottom: 4px;
  font-size: 36px;
}

/* ========================================================================
   SEARCH HISTORY
   ======================================================================== */

.search-history {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}


.history-item {
  padding: var(--spacing-lg) var(--spacing-xl);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-info {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  flex: 1;
  min-width: 0; /* Allow text truncation */
}

.history-url-wrapper {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg); /* Increased gap between URL and badge */
  min-width: 0; /* Allow content to shrink */
  flex: 1; /* Take available space */
}

.history-url {
  font-size: 16px;
  font-weight: 600;
  line-height: 26px;
  color: var(--color-text-secondary);
  /* Text truncation for long URLs */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.history-platform-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 6px 10px 6px 6px;
  background: var(--color-surface);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border-strong);
  box-shadow: var(--shadow-badge);
  flex-shrink: 0; /* Prevent badge from shrinking */
  white-space: nowrap; /* Prevent text wrapping in badge */
}

.history-platform-badge svg {
  width: 18px;
  height: 18px;
  vertical-align: middle;
  display: inline-block;
  margin-right: 4px;
}

.badge-text {
  font-size: 15px;
  font-weight: 500;
  line-height: 15px;
  color: var(--color-text-secondary);
}

.history-time {
  font-size: 14.4px;
  font-weight: 500;
  line-height: 23.4px;
  color: var(--color-text-light);
  opacity: 0.9;
}

.history-actions {
  display: flex;
  gap: 8px;
}

/* ========================================================================
   ACCORDION
   ======================================================================== */

.accordion-card {
  padding: 0 !important; /* Force no padding on accordion cards */
  overflow: hidden;
}

.accordion-header {
  width: 100%;
  padding: var(--spacing-3xl); /* Use consistent padding */
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.accordion-card.expanded .accordion-header {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--color-border);
}

.accordion-header:hover {
  background: var(--color-surface-secondary);
}

.accordion-header-content {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.accordion-toggle {
  width: 32px;
  height: 32px;
  background: #EFF2F6;
  box-shadow: 0px -1px 2px rgba(178, 202, 238, 0.31) inset;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.accordion-toggle i {
  font-size: 14px;
  color: #6E7C91;
}

.accordion-toggle.active {
  transform: rotate(180deg);
}

.accordion-content {
  overflow: hidden;
  transition: all 0.3s ease;
}

.accordion-body {
  padding: 20px var(--spacing-3xl) var(--spacing-3xl);
}

/* Mobile adjustments for accordion to match card padding */
@media (max-width: 640px) {
  .accordion-header {
    padding: var(--spacing-xl); /* 24px on mobile */
  }
  
  .accordion-body {
    padding: 20px var(--spacing-xl) var(--spacing-xl);
  }
}

.confidence-intro {
  font-size: 16px;
  line-height: 26px;
  color: #54546D;
  margin-bottom: var(--spacing-lg);
}

.confidence-levels {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.confidence-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.confidence-badge {
  padding: 4px 8px;
  background: var(--color-badge-bg);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  line-height: 19.5px;
  color: var(--color-badge-text);
  white-space: nowrap;
}

.confidence-desc {
  font-size: 14px;
  line-height: 22.75px;
  color: #54546D;
}

/* ========================================================================
   DETECTION METHOD
   ======================================================================== */

.method-section {
  margin-bottom: var(--spacing-xl);
}

.method-section:last-child {
  margin-bottom: 0;
}

.method-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 26px;
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-lg);
}

.method-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.method-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.method-bullet {
  width: 6px;
  height: 6px;
  background: #54546D;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.method-text {
  font-size: 14.4px;
  line-height: 23.4px;
  color: #54546D;
}

.method-reliability {
  color: #A3A3B3;
}

/* ========================================================================
   LOADING STATE
   ======================================================================== */


.loading-content {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-3xl);
}

.loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-lg);
}

.loading-text {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-sm);
}

.loading-bar-container {
  width: 240px;
  height: 6px;
  background: var(--color-border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: var(--spacing-sm);
}

.loading-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-primary-gradient-end) 100%);
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s ease;
}

.loading-percentage {
  font-size: 12px;
  color: var(--color-text-light);
  font-weight: 500;
}

/* ========================================================================
   ERROR MESSAGE
   ======================================================================== */

.error-message {
  padding: var(--spacing-lg);
  background: #FEF2F2;
  border: 1px solid #FCA5A5;
  border-radius: var(--radius-md);
  color: #DC2626;
  font-size: 14px;
  line-height: 22.75px;
  margin-bottom: 16px; /* Changed to margin-bottom for proper spacing */
}


/* ========================================================================
   RESPONSIVE DESIGN
   ======================================================================== */

@media (max-width: 640px) {
  .app-background {
    padding: 20px 16px;
  }
  
  .app-title {
    font-size: 28px;
    line-height: 36px;
  }
  
  .app-subtitle {
    font-size: 16px;
    line-height: 26px;
  }
  
  .card {
    padding: var(--spacing-xl); /* 24px */
  }
  
  .button-group {
    flex-direction: column;
    gap: var(--spacing-md);
  }
  
  .btn {
    width: 100%;
    min-height: 48px;
    padding: 12px 24px;
  }
  
  .platform-results {
    grid-template-columns: 1fr;
  }
  
  /* Mobile platform card with badge on top */
  .platform-card {
    flex-direction: column;
    text-align: center;
    padding: var(--spacing-xl);
  }
  
  .platform-info {
    align-items: center;
  }
  
  /* Badge positioning for mobile */
  .platform-badge {
    position: absolute;
    top: -12px;
    right: 50%;
    transform: translateX(50%);
  }
  
  .history-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-md);
    padding: var(--spacing-xl); /* 24px for mobile */
  }
  
  /* Reorganize layout for mobile */
  .history-url-wrapper {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-sm);
    width: 100%;
  }
  
  /* Badge above URL on mobile */
  .history-platform-badge {
    order: -1; /* Move badge to top */
    margin-bottom: var(--spacing-xs);
  }
  
  .history-url {
    width: 100%;
    /* Allow text to wrap on mobile */
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }
  
  .history-item-content {
    width: 100%;
  }
  
  .history-item-thumbnail {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: var(--radius-md);
  }
  
  .history-actions {
    width: 100%;
    justify-content: flex-end;
  }
  
  /* Better mobile input styling */
  .form-input {
    font-size: 16px; /* Prevents zoom on iOS */
  }
}