/* TechOut Base */

@import url('./variables.css');
@import url('./typography.css');
@import url('./buttons.css');
@import url('./product-card.css');
@import url('./chips.css');
@import url('./header.css');
@import url('./search.css');
@import url('./footer.css');
@import url('./responsive.css');
@import url('./legal.css');

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  color: var(--black);
  background: var(--bg);
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
  touch-action: manipulation;
}

button {
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

ul, ol {
  list-style: none;
}

/* ============================================
   SHARED FORM BASE CLASSES
   ============================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-4);
  font-size: var(--text-base);
  font-family: var(--font-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  -webkit-appearance: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--black);
  box-shadow: 0 0 0 1px var(--black);
}

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

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239e9e9e'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  padding-right: 40px;
}

.form-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--black);
  cursor: pointer;
}

.form-checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
}

.form-error {
  font-size: var(--text-xs);
  color: #c62828;
  margin-top: var(--space-1);
}

/* ============================================
   SKELETON LOADING COMPONENTS
   ============================================ */
@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  border-radius: var(--radius-sm);
}

.skeleton-text--short { width: 60%; }
.skeleton-text--medium { width: 80%; }
.skeleton-text--long { width: 95%; }

.skeleton-title {
  height: 24px;
  width: 70%;
  border-radius: var(--radius-sm);
}

.skeleton-image {
  aspect-ratio: 1;
  border-radius: var(--radius-card);
}

.skeleton-image--portrait {
  aspect-ratio: 3/4;
}

.skeleton-image--landscape {
  aspect-ratio: 4/3;
}

.skeleton-btn {
  height: 48px;
  width: 160px;
  border-radius: var(--radius-pill);
}

.skeleton-circle {
  border-radius: 50%;
}

.skeleton-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.skeleton-chip {
  height: 32px;
  width: 80px;
  border-radius: var(--radius-chip);
}

.page-main {
  padding-top: var(--header-h);
}

@media (max-width: 767px) {
  .page-main {
    padding-bottom: 100px;
  }
}

::selection {
  background: var(--black);
  color: var(--white);
}

::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 50%;
}

/* ============================================
   ACCESSIBILITY — Skip to Content
   ============================================ */
.skip-to-content {
  position: fixed;
  top: -100%;
  left: var(--space-4);
  z-index: 9999;
  padding: var(--space-3) var(--space-6);
  background: var(--black);
  color: var(--white);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  text-decoration: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  transition: top var(--transition-fast);
}

.skip-to-content:focus {
  top: 0;
}

/* ============================================
   ACCESSIBILITY — Focus Visible
   ============================================ */
:focus-visible {
  outline: 2px solid var(--black);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* Ensure buttons and links get visible focus */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--black);
  outline-offset: 2px;
}

/* Form inputs use border focus instead */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
}

/* ============================================
   ACCESSIBILITY — Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .mobile-nav {
    transition: none;
  }

  .drawer {
    transition: none;
  }

  .drawer-overlay {
    transition: none;
  }

  .mobile-nav-overlay {
    transition: none;
  }

  .search-overlay {
    transition: none;
  }

  .mobile-bottom-nav {
    transition: none;
  }
}

/* ============================================
   ACCESSIBILITY — Screen Reader Only
   ============================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ============================================
   TOAST NOTIFICATION
   ============================================ */
.toast {
  position: fixed;
  bottom: var(--space-8);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: var(--space-4) var(--space-6);
  background-color: var(--black);
  color: var(--white);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  border-radius: var(--radius-pill);
  z-index: var(--z-toast);
  opacity: 0;
  transition: all 0.4s var(--ease);
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast--success {
  background-color: var(--green-600, #16a34a);
}

.toast--error {
  background-color: var(--red-600, #dc2626);
}

.toast--info {
  background-color: var(--blue-600, #2563eb);
}
