/**
 * Base Styles & CSS Reset - Resales Modern Plugin
 * 
 * Modern CSS reset and foundational styles
 * Mobile-first, accessible, and performance optimized
 * 
 * @package ResalesModern
 * @version 1.0.0
 */

/* =========================================================================
   CSS RESET - Modern Normalization
   ========================================================================= */

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

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  min-height: 100vh;
  font-family: var(--font-secondary);
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Remove default margins on common elements */
h1, h2, h3, h4, h5, h6,
p, blockquote, pre,
ul, ol, dl, dd,
figure, fieldset, legend {
  margin: 0;
  padding: 0;
}

/* Remove list styles on ul, ol elements */
ul, ol {
  list-style: none;
}

/* Images and media */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

img {
  border-style: none;
}

/* Remove default button styles */
button,
input,
optgroup,
select,
textarea {
  font-family: inherit;
  font-size: 100%;
  line-height: inherit;
  margin: 0;
  padding: 0;
  color: inherit;
}

button,
[type="button"],
[type="reset"],
[type="submit"] {
  -webkit-appearance: button;
  cursor: pointer;
}

button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
  border-style: none;
  padding: 0;
}

button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
  outline: 1px dotted ButtonText;
}

/* Links */
a {
  color: inherit;
  text-decoration: inherit;
}

/* Tables */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* Forms */
fieldset {
  border: 0;
}

legend {
  padding: 0;
}

/* =========================================================================
   TYPOGRAPHY SYSTEM
   ========================================================================= */

/* Headings - Poppins Font */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--font-primary);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  color: var(--color-text);
  margin-bottom: var(--space-4);
}

h1, .h1 {
  font-size: var(--text-4xl);
  font-weight: var(--font-extrabold);
  letter-spacing: var(--tracking-tight);
}

h2, .h2 {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  letter-spacing: var(--tracking-tight);
}

h3, .h3 {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
}

h4, .h4 {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
}

h5, .h5 {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
}

h6, .h6 {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

/* Body Text - Inter Font */
p {
  margin-bottom: var(--space-4);
  line-height: var(--leading-relaxed);
}

p:last-child {
  margin-bottom: 0;
}

/* Text Variations */
.text-lead {
  font-size: var(--text-xl);
  font-weight: var(--font-light);
  line-height: var(--leading-relaxed);
  color: var(--color-text-light);
}

.text-small {
  font-size: var(--text-sm);
}

.text-tiny {
  font-size: var(--text-xs);
}

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

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

.text-bold {
  font-weight: var(--font-bold);
}

.text-semibold {
  font-weight: var(--font-semibold);
}

.text-uppercase {
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

/* Links */
a {
  color: var(--color-primary);
  text-decoration: none;
  transition: var(--transition-colors);
}

a:hover {
  color: var(--color-primary-hover);
  text-decoration: underline;
}

a:focus-visible {
  outline: var(--border-width-2) solid var(--color-primary);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-sm);
}

/* Lists */
ul, ol {
  padding-left: var(--space-6);
  margin-bottom: var(--space-4);
}

ul {
  list-style-type: disc;
}

ol {
  list-style-type: decimal;
}

li {
  margin-bottom: var(--space-2);
  line-height: var(--leading-relaxed);
}

li:last-child {
  margin-bottom: 0;
}

/* Blockquotes */
blockquote {
  padding: var(--space-4) var(--space-6);
  margin: var(--space-6) 0;
  border-left: var(--border-width-4) solid var(--color-primary);
  background-color: var(--color-bg-light);
  font-style: italic;
  color: var(--color-text-light);
}

blockquote p {
  margin-bottom: 0;
}

/* Code */
code,
kbd,
samp,
pre {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

code {
  padding: 0.125rem 0.375rem;
  background-color: var(--color-bg-light);
  border-radius: var(--radius-sm);
  color: var(--color-primary);
}

pre {
  padding: var(--space-4);
  margin: var(--space-4) 0;
  background-color: var(--color-bg-light);
  border-radius: var(--radius-md);
  overflow-x: auto;
  line-height: var(--leading-relaxed);
}

pre code {
  padding: 0;
  background-color: transparent;
  color: inherit;
}

/* Horizontal Rule */
hr {
  margin: var(--space-8) 0;
  border: 0;
  border-top: var(--border-width) solid var(--color-border);
}

/* =========================================================================
   FORM ELEMENTS BASE
   ========================================================================= */

input,
textarea,
select {
  display: block;
  width: 100%;
  padding: var(--input-padding-y) var(--input-padding-x);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--input-radius);
  transition: var(--transition-colors);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: var(--focus-ring);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-text-muted);
  opacity: 1;
}

input:disabled,
textarea:disabled,
select:disabled {
  background-color: var(--color-bg-light);
  cursor: not-allowed;
  opacity: 0.6;
}

/* Remove number input spinners */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

/* Search input */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  -webkit-appearance: none;
}

/* Textarea */
textarea {
  min-height: 120px;
  resize: vertical;
}

/* Select */
select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right var(--space-2) center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: var(--space-10);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

select::-ms-expand {
  display: none;
}

/* Checkbox & Radio */
input[type="checkbox"],
input[type="radio"] {
  width: auto;
  height: 1.25rem;
  width: 1.25rem;
  cursor: pointer;
}

/* Labels */
label {
  display: inline-block;
  margin-bottom: var(--space-2);
  font-weight: var(--font-medium);
  color: var(--color-text);
  cursor: pointer;
}

/* =========================================================================
   UTILITY CLASSES
   ========================================================================= */

/* Display */
.block { display: block; }
.inline-block { display: inline-block; }
.inline { display: inline; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.hidden { display: none; }

/* Flex utilities */
.flex-row { flex-direction: row; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* Text alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Spacing utilities */
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
.ml-4 { margin-left: var(--space-4); }
.mr-4 { margin-right: var(--space-4); }
.mx-auto { margin-left: auto; margin-right: auto; }
.pt-4 { padding-top: var(--space-4); }
.pb-4 { padding-bottom: var(--space-4); }
.pl-4 { padding-left: var(--space-4); }
.pr-4 { padding-right: var(--space-4); }

/* Width */
.w-full { width: 100%; }
.w-auto { width: auto; }

/* Container */
.container {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

@media (min-width: 640px) {
  .container {
    max-width: var(--container-sm);
    padding-left: var(--container-padding-sm);
    padding-right: var(--container-padding-sm);
  }
}

@media (min-width: 768px) {
  .container {
    max-width: var(--container-md);
  }
}

@media (min-width: 1024px) {
  .container {
    max-width: var(--container-lg);
    padding-left: var(--container-padding-lg);
    padding-right: var(--container-padding-lg);
  }
}

@media (min-width: 1280px) {
  .container {
    max-width: var(--container-xl);
  }
}

@media (min-width: 1536px) {
  .container {
    max-width: var(--container-2xl);
  }
}

/* =========================================================================
   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;
}

/* Focus visible */
:focus-visible {
  outline: var(--border-width-2) solid var(--color-primary);
  outline-offset: var(--focus-ring-offset);
}

/* Skip to content link */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  padding: var(--space-2) var(--space-4);
  text-decoration: none;
  z-index: var(--z-tooltip);
}

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

/* =========================================================================
   PRINT STYLES
   ========================================================================= */

@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: var(--print-text) !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
  }

  abbr[title]::after {
    content: " (" attr(title) ")";
  }

  img {
    page-break-inside: avoid;
  }

  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }

  h2,
  h3 {
    page-break-after: avoid;
  }

  thead {
    display: table-header-group;
  }

  tr,
  img {
    page-break-inside: avoid;
  }
}
