/*
Theme Name: Shadcn
Theme URI: https://github.com/YayCommerce/WPShadcn
Author: YayCommerce
Author URI: https://yaycommerce.com
Description: A modern WordPress FSE theme inspired by Shadcn UI design system with light/dark mode support. Features clean, accessible design with customizable components and blocks.
Requires at least: 6.4
Tested up to: 6.8
Requires PHP: 5.3
Version: 1.0.3
License: GPLv3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Text Domain: shadcn
Tags: full-site-editing, custom-colors, custom-logo, custom-menu, editor-style, featured-images, rtl-language-support, sticky-post, threaded-comments, translation-ready, wide-blocks, block-patterns, block-styles, style-variations, blog, portfolio, news, one-column, two-columns, three-columns, four-columns, left-sidebar, right-sidebar, grid-layout, flexible-header, footer-widgets, full-width-template
*/

/* ==========================================================================
   CSS Custom Properties (Shadcn Design System)
   ========================================================================== */

:root {
  --radius: 0.625rem;
  --wp--preset--color--border: #e5e5e5;
  --wp--preset--color--input: #e5e5e5;
  --wp--preset--color--ring: #a1a1a1;
  --wp--preset--color--sidebar: #fafafa;
  --wp--preset--color--sidebar-foreground: #0a0a0a;
  --wp--preset--color--sidebar-primary: #171717;
  --wp--preset--color--sidebar-primary-foreground: #fafafa;
  --wp--preset--color--sidebar-accent: #f5f5f5;
  --wp--preset--color--sidebar-accent-foreground: #171717;
  --wp--preset--color--sidebar-border: #e5e5e5;
  --wp--preset--color--sidebar-ring: #a1a1a1;

  --default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  --default-transition-duration: 0.15s;

  --text-xs--line-height: calc(1 / 0.75);
  --text-sm--line-height: calc(1.25 / 0.875);
  --text-base--line-height: calc(1.5 / 1);
  --text-lg--line-height: calc(1.75 / 1.125);
  --text-xl--line-height: calc(1.75 / 1.25);
  --text-2xl--line-height: calc(2 / 1.5);
  --text-3xl--line-height: calc(2.25 / 1.875);
  --text-4xl--line-height: calc(2.5 / 2.25);
  --text-5xl--line-height: 1;
  --text-7xl--line-height: 1;
}

.dark {
  --wp--preset--color--background: #0a0a0a;
  --wp--preset--color--foreground: #fafafa;
  --wp--preset--color--card: #171717;
  --wp--preset--color--card-foreground: #fafafa;
  --wp--preset--color--popover: #262626;
  --wp--preset--color--popover-foreground: #fafafa;
  --wp--preset--color--primary: #e5e5e5;
  --wp--preset--color--primary-foreground: #171717;
  --wp--preset--color--secondary: #262626;
  --wp--preset--color--secondary-foreground: #fafafa;
  --wp--preset--color--muted: #262626;
  --wp--preset--color--muted-foreground: #a1a1a1;
  --wp--preset--color--accent: #404040;
  --wp--preset--color--accent-foreground: #fafafa;
  --wp--preset--color--destructive: #ff6467;
  --wp--preset--color--border: rgba(255, 255, 255, 0.1);
  --wp--preset--color--input: rgba(255, 255, 255, 0.15);
  --wp--preset--color--ring: rgb(115, 115, 115);
  --wp--preset--color--sidebar: #171717;
  --wp--preset--color--sidebar-foreground: #fafafa;
  --wp--preset--color--sidebar-primary: #1447e6;
  --wp--preset--color--sidebar-primary-foreground: #fafafa;
  --wp--preset--color--sidebar-accent: #262626;
  --wp--preset--color--sidebar-accent-foreground: #fafafa;
  --wp--preset--color--sidebar-border: rgba(255, 255, 255, 0.1);
  --wp--preset--color--sidebar-ring: #525252;
  --wp--preset--color--code: #161616;
  --wp--preset--color--code-foreground: #a1a1a2;
}

/* ==========================================================================
   Base Styles
   ========================================================================== */

* {
  border-color: var(--wp--preset--color--border);
}

body {
  font-feature-settings: "rlig" 1, "calt" 1;
}

/* ==========================================================================
   Button Styles (Shadcn inspired)
   ========================================================================== */

.wp-block-button__link {
  transition-property: all;
  transition-timing-function: var(--default-transition-timing-function);
  transition-duration: var(--default-transition-duration);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

/* Button variants */
.wp-block-button.is-style-outline .wp-block-button__link {
  background-color: transparent;
  color: var(--wp--preset--color--primary);
  border: 1px solid var(--wp--preset--color--border);
}

.wp-block-button.is-style-outline .wp-block-button__link:hover {
  background-color: var(--wp--preset--color--accent);
  color: var(--wp--preset--color--accent-foreground);
}

.wp-block-button.is-style-secondary .wp-block-button__link {
  background-color: var(--wp--preset--color--secondary);
  color: var(--wp--preset--color--secondary-foreground);
}

.wp-block-button.is-style-secondary .wp-block-button__link:hover {
  background-color: color-mix(
    in oklab,
    var(--wp--preset--color--secondary) 80%,
    transparent
  );
}

.wp-block-button.is-style-destructive .wp-block-button__link {
  background-color: var(--wp--preset--color--destructive);
  color: var(--wp--preset--color--destructive-foreground);
}

.wp-block-button.is-style-destructive .wp-block-button__link:hover {
  background-color: color-mix(
    in oklab,
    var(--wp--preset--color--destructive) 90%,
    transparent
  );
}

.wp-block-button.is-style-ghost .wp-block-button__link {
  background-color: transparent;
  color: var(--wp--preset--color--primary);
}

.wp-block-button.is-style-ghost .wp-block-button__link:hover {
  background-color: var(--wp--preset--color--accent);
  color: var(--wp--preset--color--accent-foreground);
}

/* ==========================================================================
   Input Styles
   ========================================================================== */

.wp-block-search__input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="tel"],
input[type="number"],
textarea {
  background-color: transparent;
  color: var(--wp--preset--color--foreground);
  border: 1px solid var(--wp--preset--color--border);
  border-radius: calc(var(--radius) - 2px);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  transition-property: border-color;
  transition-timing-function: var(--default-transition-timing-function);
  transition-duration: var(--default-transition-duration);
}

/* ==========================================================================
   Select Styles
   ========================================================================== */
select {
  /* Layout & Sizing */
  height: 2.25rem; /* 36px */
  width: 100%;
  min-width: 0;
  padding: 0.5rem 2.25rem 0.5rem 0.75rem; /* py-2 px-3 pr-9 */

  /* Appearance */
  appearance: none;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--wp--preset--color--input);
  background-color: transparent;

  /* Typography */
  font-size: 0.875rem; /* text-sm */
  font-family: inherit;
  line-height: 1.5;

  /* Colors */
  color: var(--wp--preset--color--foreground);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='oklch(80.6% 0 0)' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-position: right 0.75rem center;
  background-repeat: no-repeat;
  background-size: 0.75rem auto;

  /* Effects */
  box-shadow: 0 0.0625rem 0.125rem 0 rgb(0 0 0 / 0.05);
  transition-property: color, box-shadow, border-color;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;

  /* Reset */
  outline: none;
}

/**
 * Select Placeholder State
 */
select::placeholder {
  color: var(--wp--preset--color--muted-foreground);
}

/**
 * Select Selection/Highlight
 */
select::selection {
  background-color: var(--wp--preset--color--primary);
  color: var(--wp--preset--color--primary-foreground);
}

/**
 * Select Disabled State
 */
select:disabled {
  pointer-events: none;
  cursor: not-allowed;
  opacity: 0.5;
}

.dark select {
  background-color: color-mix(
    in oklab,
    var(--wp--preset--color--input) 30%,
    transparent
  );
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='oklch(100% 0 0/.15)' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
}

.dark select:hover:not(:disabled) {
  background-color: color-mix(
    in oklab,
    var(--wp--preset--color--input) 50%,
    transparent
  );
}

/**
 * Select Options Styling (for browsers that support it)
 * Note: Limited styling support across browsers
 */
select option {
  background-color: var(--wp--preset--color--background);
  color: var(--wp--preset--color--foreground);
  padding: 0.5rem;
}

select option:checked {
  background: linear-gradient(
    var(--wp--preset--color--primary),
    var(--wp--preset--color--primary)
  );
  background-color: var(--wp--preset--color--primary);
  color: var(--wp--preset--color--primary-foreground);
}

.wp-block-search__input:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--wp--preset--color--ring);
  box-shadow: 0 0 0 3px color-mix(in oklab, oklch(70.8% 0 0) 50%, transparent);
}

input[type="checkbox"],
input[type="radio"] {
  display: inline-flex;
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  cursor: inherit;
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  background-color: transparent;
  border-width: 1px;
  border-style: solid;
  border-color: var(--wp--preset--color--border);
  border-radius: 4px;
  color: var(--wp--preset--color--primary-foreground);
  box-shadow: none;
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
  background-color: var(--wp--preset--color--primary);
}

input[type="checkbox"]:checked::after,
input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1.5px;
  width: 3.5px;
  height: 8px;
  border: solid currentColor;
  border-width: 0 1px 1px 0;
  -webkit-transform: rotate(45deg) translate(-50%, -50%);
  -ms-transform: rotate(45deg) translate(-50%, -50%);
  transform: rotate(45deg);
}

input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
  outline: none;
}

.dark .wp-block-search__input,
.dark input[type="text"],
.dark input[type="email"],
.dark input[type="password"],
.dark input[type="search"],
.dark input[type="url"],
.dark input[type="tel"],
.dark input[type="number"],
.dark textarea,
.dark select,
.dark input[type="checkbox"],
.dark input[type="radio"] {
  background-color: color-mix(
    in oklab,
    var(--wp--preset--color--input) 30%,
    transparent
  );
}

.dark input[type="checkbox"]:checked,
.dark input[type="radio"]:checked {
  background-color: var(--wp--preset--color--primary);
}

.dark .wp-block-search__input:focus-visible,
.dark input:focus-visible,
.dark textarea:focus-visible,
.dark select:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in oklab, oklch(55.6% 0 0) 50%, transparent);
}

/* ==========================================================================
   Dark Mode Toggle
   ========================================================================== */

.dark-mode-toggle {
  background: none;
  border: none;
  color: var(--wp--preset--color--foreground);
  cursor: pointer;
  padding: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: calc(var(--radius) - 2px);
  transition-property: background-color;
  transition-timing-function: var(--default-transition-timing-function);
  transition-duration: var(--default-transition-duration);
}

.dark-mode-toggle:hover {
  background-color: var(--wp--preset--color--accent);
}

.dark-mode-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.has-xs-font-size {
  line-height: var(--text-xs--line-height);
}
.has-sm-font-size {
  line-height: var(--text-sm--line-height);
}
.has-base-font-size {
  line-height: var(--text-base--line-height);
}
.has-lg-font-size {
  line-height: var(--text-lg--line-height);
}
.has-xl-font-size {
  line-height: var(--text-xl--line-height);
}
.has-2-xl-font-size {
  line-height: var(--text-2xl--line-height);
}
.has-3-xl-font-size {
  line-height: var(--text-3xl--line-height);
}
.has-4-xl-font-size {
  line-height: var(--text-4xl--line-height);
}
.has-5-xl-font-size {
  line-height: var(--text-5xl--line-height);
}
.has-7-xl-font-size {
  line-height: var(--text-7xl--line-height);
}
/* .required {
  color: var(--wp--preset--color--destructive);
} */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  .dark-mode-toggle {
    display: none;
  }

  * {
    background: white !important;
    color: black !important;
  }
}

@media screen and (min-width: 600px) {
  .wp-block-navigation.is-style-pill .wp-block-navigation-item__content {
    text-decoration: none;
  }

  .wp-block-navigation.is-style-pill .wp-block-navigation-item.has-child,
  .wp-block-navigation.is-style-pill .wp-block-navigation-submenu__toggle {
    cursor: default;
  }

  .wp-block-navigation.is-style-pill .wp-block-navigation-item__content {
    padding: var(--wp--preset--spacing--2) var(--wp--preset--spacing--4);
  }

  .wp-block-navigation.is-style-pill
    .wp-block-navigation__container
    > .wp-block-navigation-item {
    background-color: var(--wp--preset--color--background);
    border-radius: calc(var(--radius) - 2px);
  }

  .wp-block-navigation.is-style-pill
    .wp-block-navigation__container
    > .wp-block-navigation-item
    > .wp-block-navigation-item__content {
    color: var(--wp--preset--color--foreground);
    border-radius: calc(var(--radius) - 2px);
  }

  .wp-block-navigation.is-style-pill
    .wp-block-navigation__container
    > .wp-block-navigation-item:hover {
    background-color: var(--wp--preset--color--accent);
  }
  .wp-block-navigation.is-style-pill
    .wp-block-navigation__container
    > .wp-block-navigation-item:hover
    > .wp-block-navigation-item__content {
    color: var(--wp--preset--color--accent-foreground);
  }

  .wp-block-navigation.is-style-pill
    .wp-block-navigation__container
    > .wp-block-navigation-item:has(.wp-block-navigation-submenu__toggle)
    > .wp-block-navigation-item__content {
    padding-right: 0;
  }

  .wp-block-navigation.is-style-pill .wp-block-navigation-submenu__toggle {
    width: unset;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--wp--preset--spacing--2) var(--wp--preset--spacing--4);
    margin: 0;
  }

  .wp-block-navigation.is-style-pill
    .wp-block-navigation__container
    > .wp-block-navigation-item
    > .wp-block-navigation-submenu__toggle
    svg {
    transition-property: transform;
    transition-timing-function: var(--default-transition-timing-function);
    transition-duration: var(--default-transition-duration);
  }

  .wp-block-navigation.is-style-pill
    .wp-block-navigation__container
    > .wp-block-navigation-item:hover
    > .wp-block-navigation-submenu__toggle
    svg {
    transform: rotate(180deg);
  }

  .wp-block-navigation.is-style-pill .wp-block-navigation__submenu-container {
    padding: var(--wp--preset--spacing--2);
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid var(--wp--preset--color--border);
    margin-top: var(--wp--preset--spacing--2);
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  }

  .wp-block-navigation.is-style-pill
    .wp-block-navigation__submenu-container::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    top: calc(var(--wp--preset--spacing--3) * -1);
    z-index: -1;
  }

  .wp-block-navigation.is-style-pill
    .wp-block-navigation__submenu-container
    > .wp-block-navigation-item {
    border-radius: calc(var(--radius) - 4px);
  }

  .wp-block-navigation.is-style-pill
    .wp-block-navigation__submenu-container
    > .wp-block-navigation-item:hover {
    background-color: var(--wp--preset--color--accent);
    color: var(--wp--preset--color--accent-foreground);
  }

  .dark
    .wp-block-navigation.is-style-pill
    .wp-block-navigation__submenu-container {
    background-color: var(--wp--preset--color--popover) !important;
  }
}
