/**
 * Apple UI Design System
 * iOS & macOS Design Language Fusion
 * Human-centered interface with Apple ecosystem aesthetic
 */

/* ============================================
   DESIGN TOKENS & CSS VARIABLES
   ============================================ */

:root {
  /* Warm Neutral Backgrounds */
  --bg-primary: #F5F5F7;
  --bg-secondary: #E8E8ED;
  --bg-tertiary: #D1D1D6;
  --bg-quaternary: #C7C7CC;
  
  /* System Colors */
  --system-blue: #007AFF;
  --system-green: #34C759;
  --system-indigo: #5856D6;
  --system-orange: #FF9500;
  --system-pink: #FF2D55;
  --system-purple: #AF52DE;
  --system-red: #FF3B30;
  --system-teal: #5AC8FA;
  --system-yellow: #FFCC00;
  --system-gray: #8E8E93;
  --system-gray2: #AEAEB2;
  --system-gray3: #C7C7CC;
  --system-gray4: #D1D1D6;
  --system-gray5: #E5E5EA;
  --system-gray6: #F2F2F7;
  
  /* Text Colors */
  --text-primary: #000000;
  --text-secondary: rgba(60, 60, 67, 0.6);
  --text-tertiary: rgba(60, 60, 67, 0.3);
  --text-quaternary: rgba(60, 60, 67, 0.18);
  --text-inverse: #FFFFFF;
  
  /* Materials (Blur/Vibrancy) */
  --material-ultra-thin: rgba(255, 255, 255, 0.7);
  --material-thin: rgba(255, 255, 255, 0.82);
  --material-regular: rgba(255, 255, 255, 0.92);
  --material-thick: rgba(255, 255, 255, 0.97);
  --material-dark-ultra-thin: rgba(30, 30, 30, 0.7);
  --material-dark-thin: rgba(30, 30, 30, 0.82);
  --material-dark-regular: rgba(30, 30, 30, 0.92);
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.16);
  
  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-2xl: 24px;
  --radius-full: 9999px;
  
  /* Spacing (8pt Grid) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  
  /* Typography - Apple System Font Priority (Mandatory) */
  --font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', 'Arial', sans-serif !important;
  --font-mono: 'SF Mono', SFMono-Regular, ui-monospace, 'Menlo', 'Monaco', 'Courier New', monospace !important;
  --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', 'Arial', sans-serif !important;
  --font-ui: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', 'Arial', sans-serif !important;
  
  /* Font Sizes */
  --text-xs: 11px;
  --text-sm: 12px;
  --text-base: 14px;
  --text-lg: 16px;
  --text-xl: 17px;
  --text-2xl: 20px;
  --text-3xl: 22px;
  --text-4xl: 28px;
  --text-5xl: 34px;
  
  /* Line Heights */
  --leading-tight: 1.2;
  --leading-snug: 1.3;
  --leading-normal: 1.4;
  --leading-relaxed: 1.5;
  
  /* Font Weights */
  --font-regular: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
  
  /* Z-Index Scale */
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-popover: 600;
  --z-tooltip: 700;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #000000;
    --bg-secondary: #1C1C1E;
    --bg-tertiary: #2C2C2E;
    --bg-quaternary: #3A3A3C;
    
    --text-primary: #FFFFFF;
    --text-secondary: rgba(235, 235, 245, 0.6);
    --text-tertiary: rgba(235, 235, 245, 0.3);
    --text-quaternary: rgba(235, 235, 245, 0.18);
    
    --material-ultra-thin: rgba(30, 30, 30, 0.7);
    --material-thin: rgba(30, 30, 30, 0.82);
    --material-regular: rgba(30, 30, 30, 0.92);
    --material-thick: rgba(30, 30, 30, 0.97);
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
  }
}

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

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

html {
  font-family: var(--font-sans) !important;
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga", "calt";
  -webkit-text-size-adjust: 100%;
}

/* Mandatory font override for all elements */
* {
  font-family: inherit !important;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display) !important;
  font-weight: var(--font-semibold);
}

button, input, select, textarea {
  font-family: var(--font-ui) !important;
}

code, pre, kbd, samp {
  font-family: var(--font-mono) !important;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
}

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

.ap-text-xs { font-size: var(--text-xs); line-height: var(--leading-tight); font-family: var(--font-sans) !important; }
.ap-text-sm { font-size: var(--text-sm); line-height: var(--leading-snug); font-family: var(--font-sans) !important; }
.ap-text-base { font-size: var(--text-base); line-height: var(--leading-normal); font-family: var(--font-sans) !important; }
.ap-text-lg { font-size: var(--text-lg); line-height: var(--leading-normal); font-family: var(--font-sans) !important; }
.ap-text-xl { font-size: var(--text-xl); line-height: var(--leading-relaxed); font-family: var(--font-sans) !important; }
.ap-text-2xl { font-size: var(--text-2xl); line-height: var(--leading-tight); font-family: var(--font-display) !important; }
.ap-text-3xl { font-size: var(--text-3xl); line-height: var(--leading-tight); font-family: var(--font-display) !important; }
.ap-text-4xl { font-size: var(--text-4xl); line-height: var(--leading-tight); font-family: var(--font-display) !important; }
.ap-text-5xl { font-size: var(--text-5xl); line-height: var(--leading-tight); font-family: var(--font-display) !important; }

/* Font utilities */
.ap-font-sans { font-family: var(--font-sans) !important; }
.ap-font-display { font-family: var(--font-display) !important; }
.ap-font-mono { font-family: var(--font-mono) !important; }
.ap-font-ui { font-family: var(--font-ui) !important; }

.ap-font-regular { font-weight: var(--font-regular); }
.ap-font-medium { font-weight: var(--font-medium); }
.ap-font-semibold { font-weight: var(--font-semibold); }
.ap-font-bold { font-weight: var(--font-bold); }

.ap-text-primary { color: var(--text-primary); }
.ap-text-secondary { color: var(--text-secondary); }
.ap-text-tertiary { color: var(--text-tertiary); }

/* ============================================
   BUTTONS
   ============================================ */

.ap-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-regular);
  line-height: var(--leading-normal);
  text-decoration: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.ap-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.3);
}

.ap-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Button Variants */
.ap-btn--filled {
  background: var(--system-blue);
  color: white;
}

.ap-btn--filled:hover:not(:disabled) {
  background: #0056CC;
}

.ap-btn--filled:active:not(:disabled) {
  background: #004499;
  transform: scale(0.98);
}

.ap-btn--tinted {
  background: rgba(0, 122, 255, 0.15);
  color: var(--system-blue);
}

.ap-btn--tinted:hover:not(:disabled) {
  background: rgba(0, 122, 255, 0.25);
}

.ap-btn--tinted:active:not(:disabled) {
  background: rgba(0, 122, 255, 0.35);
}

.ap-btn--plain {
  background: transparent;
  color: var(--system-blue);
}

.ap-btn--plain:hover:not(:disabled) {
  background: rgba(0, 122, 255, 0.1);
}

.ap-btn--plain:active:not(:disabled) {
  background: rgba(0, 122, 255, 0.2);
}

.ap-btn--secondary {
  background: var(--system-gray5);
  color: var(--system-blue);
}

.ap-btn--secondary:hover:not(:disabled) {
  background: var(--system-gray4);
}

.ap-btn--secondary:active:not(:disabled) {
  background: var(--system-gray3);
}

/* Button Sizes */
.ap-btn--small {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
}

.ap-btn--large {
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-lg);
  border-radius: var(--radius-lg);
}

/* macOS Style Button */
.ap-btn--mac {
  background: linear-gradient(to bottom, #FFFFFF 0%, #F0F0F0 100%);
  border: 1px solid #C7C7CC;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset, var(--shadow-sm);
  color: var(--text-primary);
}

.ap-btn--mac:hover:not(:disabled) {
  background: linear-gradient(to bottom, #F8F8F8 0%, #E8E8E8 100%);
}

.ap-btn--mac:active:not(:disabled) {
  background: linear-gradient(to bottom, #E8E8E8 0%, #D8D8D8 100%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) inset;
}

/* Additional Button Variants */
.ap-btn--destructive {
  background: var(--system-red);
  color: white;
}

.ap-btn--destructive:hover:not(:disabled) {
  background: #CC3025;
}

.ap-btn--destructive:active:not(:disabled) {
  background: #A6271F;
}

.ap-btn--success {
  background: var(--system-green);
  color: white;
}

.ap-btn--success:hover:not(:disabled) {
  background: #2AB347;
}

.ap-btn--success:active:not(:disabled) {
  background: #219338;
}

.ap-btn--warning {
  background: var(--system-orange);
  color: white;
}

.ap-btn--warning:hover:not(:disabled) {
  background: #E68600;
}

.ap-btn--warning:active:not(:disabled) {
  background: #CC7500;
}

.ap-btn--outline {
  background: transparent;
  color: var(--system-blue);
  border: 1px solid var(--system-blue);
}

.ap-btn--outline:hover:not(:disabled) {
  background: rgba(0, 122, 255, 0.1);
}

.ap-btn--outline:active:not(:disabled) {
  background: rgba(0, 122, 255, 0.2);
}

.ap-btn--icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
}

.ap-btn--icon-small {
  width: 32px;
  height: 32px;
}

.ap-btn--icon-large {
  width: 48px;
  height: 48px;
}

.ap-btn--block {
  display: flex;
  width: 100%;
}

.ap-btn--loading {
  position: relative;
  pointer-events: none;
}

.ap-btn--loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: ap-spin 1s linear infinite;
}

.ap-btn--loading.ap-btn--tinted::after,
.ap-btn--loading.ap-btn--plain::after {
  border-color: rgba(0, 122, 255, 0.3);
  border-top-color: var(--system-blue);
}

.ap-btn--loading.ap-btn--secondary::after {
  border-color: rgba(0, 0, 0, 0.3);
  border-top-color: var(--text-primary);
}

/* ============================================
   INPUTS & FORMS
   ============================================ */

.ap-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1px solid var(--system-gray4);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  -webkit-appearance: none;
}

.ap-input:focus {
  outline: none;
  border-color: var(--system-blue);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

.ap-input::placeholder {
  color: var(--text-tertiary);
}

.ap-input:disabled {
  background: var(--bg-secondary);
  color: var(--text-tertiary);
  cursor: not-allowed;
}

/* Input Variants */
.ap-input--search {
  padding-left: var(--space-10);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238E8E93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cpath d='m21 21-4.3-4.3'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: var(--space-3) center;
}

.ap-input--password {
  padding-right: var(--space-10);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238E8E93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7z'%3E%3C/path%3E%3Ccircle cx='12' cy='12' r='3'%3E%3C/circle%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
}

.ap-input--error {
  border-color: var(--system-red);
}

.ap-input--error:focus {
  border-color: var(--system-red);
  box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.15);
}

.ap-input--success {
  border-color: var(--system-green);
}

.ap-input--success:focus {
  border-color: var(--system-green);
  box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.15);
}

.ap-input--small {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
}

.ap-input--large {
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-lg);
  border-radius: var(--radius-lg);
}

/* Textarea */
.ap-textarea {
  min-height: 100px;
  resize: vertical;
}

.ap-textarea--small {
  min-height: 80px;
}

.ap-textarea--large {
  min-height: 160px;
}

/* Select */
.ap-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238E8E93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-10);
}

/* Form Group */
.ap-form-group {
  margin-bottom: var(--space-4);
}

.ap-form-label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
}

.ap-form-label--error {
  color: var(--system-red);
}

.ap-form-hint {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.ap-form-error {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  color: var(--system-red);
}

/* Checkbox */
.ap-checkbox {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ap-checkbox__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.ap-checkbox__box {
  width: 20px;
  height: 20px;
  border: 2px solid var(--system-gray4);
  border-radius: var(--radius-sm);
  margin-right: var(--space-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.ap-checkbox__input:checked + .ap-checkbox__box {
  background: var(--system-blue);
  border-color: var(--system-blue);
}

.ap-checkbox__input:checked + .ap-checkbox__box::after {
  content: '';
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.ap-checkbox__input:focus + .ap-checkbox__box {
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

.ap-checkbox__input:disabled + .ap-checkbox__box {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Radio Button */
.ap-radio {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ap-radio__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.ap-radio__circle {
  width: 20px;
  height: 20px;
  border: 2px solid var(--system-gray4);
  border-radius: 50%;
  margin-right: var(--space-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.ap-radio__input:checked + .ap-radio__circle {
  border-color: var(--system-blue);
}

.ap-radio__input:checked + .ap-radio__circle::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--system-blue);
}

.ap-radio__input:focus + .ap-radio__circle {
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

.ap-radio__input:disabled + .ap-radio__circle {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Form Row */
.ap-form-row {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.ap-form-row > * {
  flex: 1;
}

/* Inline Form */
.ap-form-inline {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.ap-form-inline .ap-form-group {
  margin-bottom: 0;
}

/* Form Grid */
.ap-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-4);
}

/* ============================================
   SWITCH (Toggle)
   ============================================ */

.ap-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ap-switch__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.ap-switch__track {
  width: 51px;
  height: 31px;
  background: var(--system-gray4);
  border-radius: var(--radius-full);
  position: relative;
  transition: background var(--transition-base);
}

.ap-switch__input:checked + .ap-switch__track {
  background: var(--system-green);
}

.ap-switch__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  transition: transform var(--transition-spring);
}

.ap-switch__input:checked + .ap-switch__track .ap-switch__thumb {
  transform: translateX(20px);
}

.ap-switch__input:disabled + .ap-switch__track {
  opacity: 0.4;
  cursor: not-allowed;
}

.ap-switch__label {
  margin-left: var(--space-3);
  font-size: var(--text-base);
  color: var(--text-primary);
}

/* ============================================
   SLIDER
   ============================================ */

.ap-slider {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--system-gray4);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
}

.ap-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  cursor: grab;
}

.ap-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.ap-slider::-webkit-slider-thumb:active {
  transform: scale(1.05);
  cursor: grabbing;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
}

.ap-slider::-moz-range-thumb {
  width: 28px;
  height: 28px;
  background: white;
  border-radius: 50%;
  border: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
  cursor: grab;
}

/* ============================================
   SEGMENTED CONTROL
   ============================================ */

.ap-segmented {
  display: inline-flex;
  background: var(--system-gray5);
  padding: 2px;
  border-radius: var(--radius-md);
  position: relative;
}

.ap-segmented__item {
  position: relative;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  z-index: 1;
}

.ap-segmented__item--active {
  background: white;
  box-shadow: var(--shadow-sm);
}

.ap-segmented__item:hover:not(.ap-segmented__item--active) {
  background: rgba(255, 255, 255, 0.5);
}

/* ============================================
   CARDS
   ============================================ */

.ap-card {
  background: var(--material-regular);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.ap-card:hover {
  box-shadow: var(--shadow-lg);
}

.ap-card__header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--system-gray5);
}

.ap-card__title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.ap-card__subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

.ap-card__content {
  padding: var(--space-5);
}

.ap-card__footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--system-gray5);
  background: var(--bg-primary);
}

/* ============================================
   LISTS (iOS Inset Grouped Style)
   ============================================ */

.ap-list {
  background: var(--material-regular);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin: var(--space-4) 0;
}

.ap-list__item {
  display: flex;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  min-height: 44px;
  border-bottom: 1px solid var(--system-gray5);
  transition: background var(--transition-fast);
  cursor: pointer;
}

.ap-list__item:last-child {
  border-bottom: none;
}

.ap-list__item:hover {
  background: rgba(0, 0, 0, 0.02);
}

.ap-list__item:active {
  background: rgba(0, 0, 0, 0.05);
}

.ap-list__icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: var(--space-3);
  flex-shrink: 0;
}

.ap-list__icon--blue { background: rgba(0, 122, 255, 0.15); color: var(--system-blue); }
.ap-list__icon--green { background: rgba(52, 199, 89, 0.15); color: var(--system-green); }
.ap-list__icon--red { background: rgba(255, 59, 48, 0.15); color: var(--system-red); }
.ap-list__icon--orange { background: rgba(255, 149, 0, 0.15); color: var(--system-orange); }
.ap-list__icon--purple { background: rgba(175, 82, 222, 0.15); color: var(--system-purple); }

.ap-list__content {
  flex: 1;
  min-width: 0;
}

.ap-list__title {
  font-size: var(--text-base);
  color: var(--text-primary);
}

.ap-list__subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: 2px;
}

.ap-list__detail {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-right: var(--space-1);
}

.ap-list__chevron {
  color: var(--system-gray3);
  flex-shrink: 0;
}

/* ============================================
   NAVIGATION BAR
   ============================================ */

.ap-navbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: var(--material-thin);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.ap-navbar__content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 var(--space-4);
  max-width: 1200px;
  margin: 0 auto;
}

.ap-navbar__title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.ap-navbar__left,
.ap-navbar__right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 80px;
}

.ap-navbar__right {
  justify-content: flex-end;
}

/* ============================================
   TAB BAR
   ============================================ */

.ap-tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-fixed);
  background: var(--material-thin);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  padding-bottom: env(safe-area-inset-bottom);
}

.ap-tabbar__content {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 56px;
  max-width: 600px;
  margin: 0 auto;
}

.ap-tabbar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  height: 100%;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.ap-tabbar__item--active {
  color: var(--system-blue);
}

.ap-tabbar__icon {
  width: 24px;
  height: 24px;
}

.ap-tabbar__label {
  font-size: 10px;
  font-weight: var(--font-medium);
}

/* ============================================
   TOOLBAR
   ============================================ */

.ap-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--material-thin);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.ap-toolbar__group {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0 var(--space-2);
  border-right: 1px solid var(--system-gray4);
}

.ap-toolbar__group:last-child {
  border-right: none;
}

.ap-toolbar__btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ap-toolbar__btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.ap-toolbar__btn:active {
  background: rgba(0, 0, 0, 0.1);
}

/* ============================================
   MACOS WINDOW CONTROLS
   ============================================ */

.ap-window-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ap-window-control {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
}

.ap-window-control--close {
  background: #FF5F57;
  border: 1px solid #E0443E;
}

.ap-window-control--minimize {
  background: #FFBD2E;
  border: 1px solid #DEA123;
}

.ap-window-control--maximize {
  background: #28CA41;
  border: 1px solid #1AAB29;
}

.ap-window-control::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.ap-window-control--close::before {
  width: 8px;
  height: 2px;
  background: #4D0000;
  transform: translate(-50%, -50%) rotate(45deg);
  box-shadow: 0 0 0 0 #4D0000;
}

.ap-window-control--close::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 2px;
  background: #4D0000;
  transform: translate(-50%, -50%) rotate(-45deg);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.ap-window-controls:hover .ap-window-control::before,
.ap-window-controls:hover .ap-window-control::after {
  opacity: 1;
}

.ap-window-control--minimize::before {
  width: 8px;
  height: 2px;
  background: #995700;
}

.ap-window-control--maximize::before {
  width: 6px;
  height: 6px;
  border: 1.5px solid #006500;
  background: transparent;
  border-radius: 1px;
}

/* ============================================
   SIDEBAR
   ============================================ */

.ap-sidebar {
  width: 260px;
  height: 100vh;
  background: var(--material-thin);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ap-sidebar__header {
  padding: var(--space-4);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.ap-sidebar__search {
  margin-bottom: var(--space-3);
}

.ap-sidebar__section {
  padding: var(--space-3) 0;
}

.ap-sidebar__section-title {
  padding: 0 var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.ap-sidebar__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  margin: 0 var(--space-2);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  text-decoration: none;
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.ap-sidebar__item:hover {
  background: rgba(0, 0, 0, 0.05);
}

.ap-sidebar__item--active {
  background: var(--system-blue);
  color: white;
}

.ap-sidebar__item--active:hover {
  background: #0056CC;
}

.ap-sidebar__icon {
  width: 20px;
  height: 20px;
  opacity: 0.8;
}

.ap-sidebar__content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2) 0;
}

/* ============================================
   MODAL / SHEET
   ============================================ */

.ap-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal-backdrop);
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.ap-modal-overlay--open {
  opacity: 1;
  visibility: visible;
}

.ap-modal {
  background: var(--material-thick);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  width: 90%;
  max-width: 400px;
  transform: scale(0.9) translateY(20px);
  opacity: 0;
  transition: all var(--transition-spring);
  overflow: hidden;
}

.ap-modal-overlay--open .ap-modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.ap-modal__header {
  padding: var(--space-5) var(--space-5) var(--space-3);
  text-align: center;
}

.ap-modal__title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
}

.ap-modal__message {
  padding: 0 var(--space-5) var(--space-5);
  text-align: center;
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

.ap-modal__actions {
  display: flex;
  border-top: 1px solid var(--system-gray4);
}

.ap-modal__btn {
  flex: 1;
  padding: var(--space-4);
  background: transparent;
  border: none;
  font-size: var(--text-lg);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.ap-modal__btn:first-child {
  border-right: 1px solid var(--system-gray4);
}

.ap-modal__btn--default {
  color: var(--system-blue);
  font-weight: var(--font-regular);
}

.ap-modal__btn--cancel {
  color: var(--system-blue);
  font-weight: var(--font-semibold);
}

.ap-modal__btn--destructive {
  color: var(--system-red);
  font-weight: var(--font-semibold);
}

.ap-modal__btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* Action Sheet (iOS Style) */

.ap-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-modal);
  transform: translateY(100%);
  transition: transform var(--transition-spring);
  padding: var(--space-2);
  padding-bottom: env(safe-area-inset-bottom);
}

.ap-sheet--open {
  transform: translateY(0);
}

.ap-sheet__group {
  background: var(--material-thick);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: var(--space-2);
}

.ap-sheet__item {
  width: 100%;
  padding: var(--space-4);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--system-gray4);
  font-size: var(--text-xl);
  color: var(--system-blue);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.ap-sheet__item:last-child {
  border-bottom: none;
}

.ap-sheet__item:hover {
  background: rgba(0, 0, 0, 0.05);
}

.ap-sheet__item--destructive {
  color: var(--system-red);
  font-weight: var(--font-semibold);
}

.ap-sheet__item--cancel {
  font-weight: var(--font-bold);
}

.ap-sheet__title {
  padding: var(--space-4);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--system-gray4);
}

/* ============================================
   BADGES
   ============================================ */

.ap-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--system-red);
  color: white;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  border-radius: var(--radius-full);
}

.ap-badge--small {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
}

.ap-badge--blue { background: var(--system-blue); }
.ap-badge--green { background: var(--system-green); }
.ap-badge--gray { background: var(--system-gray); }

/* ============================================
   PROGRESS & ACTIVITY
   ============================================ */

/* Progress Bar */
.ap-progress {
  width: 100%;
  height: 4px;
  background: var(--system-gray5);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.ap-progress__bar {
  height: 100%;
  background: var(--system-blue);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

/* Activity Indicator (Spinner) */
.ap-spinner {
  width: 24px;
  height: 24px;
  animation: ap-spin 1s linear infinite;
}

.ap-spinner__track {
  fill: none;
  stroke: var(--system-gray4);
  stroke-width: 2;
}

.ap-spinner__indicator {
  fill: none;
  stroke: var(--system-blue);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 60;
  stroke-dashoffset: 20;
}

@keyframes ap-spin {
  to { transform: rotate(360deg); }
}

.ap-spinner--large {
  width: 36px;
  height: 36px;
}

.ap-spinner--small {
  width: 16px;
  height: 16px;
}

/* ============================================
   TOAST / NOTIFICATION
   ============================================ */

.ap-toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  z-index: var(--z-tooltip);
  background: rgba(40, 40, 40, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: white;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-lg);
  font-size: var(--text-base);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: all var(--transition-spring);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

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

.ap-toast__icon {
  width: 20px;
  height: 20px;
}

/* ============================================
   CHIPS / TAGS
   ============================================ */

.ap-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  background: var(--system-gray5);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ap-chip:hover {
  background: var(--system-gray4);
}

.ap-chip--selected {
  background: var(--system-blue);
  color: white;
}

.ap-chip__remove {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 50%;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 10px;
}

/* ============================================
   AVATAR
   ============================================ */

.ap-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
  background: var(--system-gray5);
  color: var(--text-secondary);
  font-weight: var(--font-medium);
}

.ap-avatar--small { width: 32px; height: 32px; font-size: var(--text-sm); }
.ap-avatar--medium { width: 44px; height: 44px; font-size: var(--text-lg); }
.ap-avatar--large { width: 64px; height: 64px; font-size: var(--text-2xl); }

.ap-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ============================================
   DIVIDER
   ============================================ */

.ap-divider {
  height: 1px;
  background: var(--system-gray4);
  margin: var(--space-4) 0;
}

.ap-divider--vertical {
  width: 1px;
  height: auto;
  margin: 0 var(--space-4);
}

/* ============================================
   EMPTY STATE
   ============================================ */

.ap-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-5);
  text-align: center;
}

.ap-empty__icon {
  width: 64px;
  height: 64px;
  color: var(--system-gray3);
  margin-bottom: var(--space-4);
}

.ap-empty__title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.ap-empty__description {
  font-size: var(--text-base);
  color: var(--text-secondary);
  max-width: 300px;
}

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

.ap-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.ap-container--small {
  max-width: 960px;
}

.ap-container--large {
  max-width: 1440px;
}

.ap-container--fluid {
  max-width: 100%;
}

.ap-safe-area {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* Flexbox Utilities */
.ap-flex { display: flex; }
.ap-flex-col { flex-direction: column; }
.ap-flex-row { flex-direction: row; }
.ap-items-start { align-items: flex-start; }
.ap-items-center { align-items: center; }
.ap-items-end { align-items: flex-end; }
.ap-justify-start { justify-content: flex-start; }
.ap-justify-center { justify-content: center; }
.ap-justify-end { justify-content: flex-end; }
.ap-justify-between { justify-content: space-between; }
.ap-justify-around { justify-content: space-around; }
.ap-justify-evenly { justify-content: space-evenly; }
.ap-flex-wrap { flex-wrap: wrap; }
.ap-flex-nowrap { flex-wrap: nowrap; }
.ap-flex-1 { flex: 1; }
.ap-flex-2 { flex: 2; }
.ap-flex-3 { flex: 3; }

/* Grid Utilities */
.ap-grid { display: grid; }
.ap-grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.ap-grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ap-grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ap-grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ap-grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.ap-grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

/* Gap Utilities */
.ap-gap-1 { gap: var(--space-1); }
.ap-gap-2 { gap: var(--space-2); }
.ap-gap-3 { gap: var(--space-3); }
.ap-gap-4 { gap: var(--space-4); }
.ap-gap-5 { gap: var(--space-5); }
.ap-gap-6 { gap: var(--space-6); }
.ap-gap-8 { gap: var(--space-8); }

/* Spacing Utilities */
.ap-m-1 { margin: var(--space-1); }
.ap-m-2 { margin: var(--space-2); }
.ap-m-3 { margin: var(--space-3); }
.ap-m-4 { margin: var(--space-4); }
.ap-m-5 { margin: var(--space-5); }
.ap-m-6 { margin: var(--space-6); }
.ap-m-8 { margin: var(--space-8); }

.ap-mt-1 { margin-top: var(--space-1); }
.ap-mt-2 { margin-top: var(--space-2); }
.ap-mt-3 { margin-top: var(--space-3); }
.ap-mt-4 { margin-top: var(--space-4); }
.ap-mt-5 { margin-top: var(--space-5); }
.ap-mt-6 { margin-top: var(--space-6); }
.ap-mt-8 { margin-top: var(--space-8); }

.ap-mb-1 { margin-bottom: var(--space-1); }
.ap-mb-2 { margin-bottom: var(--space-2); }
.ap-mb-3 { margin-bottom: var(--space-3); }
.ap-mb-4 { margin-bottom: var(--space-4); }
.ap-mb-5 { margin-bottom: var(--space-5); }
.ap-mb-6 { margin-bottom: var(--space-6); }
.ap-mb-8 { margin-bottom: var(--space-8); }

.ap-ml-1 { margin-left: var(--space-1); }
.ap-ml-2 { margin-left: var(--space-2); }
.ap-ml-3 { margin-left: var(--space-3); }
.ap-ml-4 { margin-left: var(--space-4); }
.ap-ml-5 { margin-left: var(--space-5); }
.ap-ml-6 { margin-left: var(--space-6); }
.ap-ml-8 { margin-left: var(--space-8); }

.ap-mr-1 { margin-right: var(--space-1); }
.ap-mr-2 { margin-right: var(--space-2); }
.ap-mr-3 { margin-right: var(--space-3); }
.ap-mr-4 { margin-right: var(--space-4); }
.ap-mr-5 { margin-right: var(--space-5); }
.ap-mr-6 { margin-right: var(--space-6); }
.ap-mr-8 { margin-right: var(--space-8); }

.ap-p-1 { padding: var(--space-1); }
.ap-p-2 { padding: var(--space-2); }
.ap-p-3 { padding: var(--space-3); }
.ap-p-4 { padding: var(--space-4); }
.ap-p-5 { padding: var(--space-5); }
.ap-p-6 { padding: var(--space-6); }
.ap-p-8 { padding: var(--space-8); }

.ap-pt-1 { padding-top: var(--space-1); }
.ap-pt-2 { padding-top: var(--space-2); }
.ap-pt-3 { padding-top: var(--space-3); }
.ap-pt-4 { padding-top: var(--space-4); }
.ap-pt-5 { padding-top: var(--space-5); }
.ap-pt-6 { padding-top: var(--space-6); }
.ap-pt-8 { padding-top: var(--space-8); }

.ap-pb-1 { padding-bottom: var(--space-1); }
.ap-pb-2 { padding-bottom: var(--space-2); }
.ap-pb-3 { padding-bottom: var(--space-3); }
.ap-pb-4 { padding-bottom: var(--space-4); }
.ap-pb-5 { padding-bottom: var(--space-5); }
.ap-pb-6 { padding-bottom: var(--space-6); }
.ap-pb-8 { padding-bottom: var(--space-8); }

.ap-pl-1 { padding-left: var(--space-1); }
.ap-pl-2 { padding-left: var(--space-2); }
.ap-pl-3 { padding-left: var(--space-3); }
.ap-pl-4 { padding-left: var(--space-4); }
.ap-pl-5 { padding-left: var(--space-5); }
.ap-pl-6 { padding-left: var(--space-6); }
.ap-pl-8 { padding-left: var(--space-8); }

.ap-pr-1 { padding-right: var(--space-1); }
.ap-pr-2 { padding-right: var(--space-2); }
.ap-pr-3 { padding-right: var(--space-3); }
.ap-pr-4 { padding-right: var(--space-4); }
.ap-pr-5 { padding-right: var(--space-5); }
.ap-pr-6 { padding-right: var(--space-6); }
.ap-pr-8 { padding-right: var(--space-8); }

/* Display Utilities */
.ap-hidden { display: none; }
.ap-block { display: block; }
.ap-inline { display: inline; }
.ap-inline-block { display: inline-block; }
.ap-table { display: table; }
.ap-table-cell { display: table-cell; }

/* Position Utilities */
.ap-static { position: static; }
.ap-relative { position: relative; }
.ap-absolute { position: absolute; }
.ap-fixed { position: fixed; }
.ap-sticky { position: sticky; }

/* Z-Index Utilities */
.ap-z-0 { z-index: 0; }
.ap-z-10 { z-index: 10; }
.ap-z-20 { z-index: 20; }
.ap-z-30 { z-index: 30; }
.ap-z-40 { z-index: 40; }
.ap-z-50 { z-index: 50; }
.ap-z-dropdown { z-index: var(--z-dropdown); }
.ap-z-sticky { z-index: var(--z-sticky); }
.ap-z-fixed { z-index: var(--z-fixed); }
.ap-z-modal-backdrop { z-index: var(--z-modal-backdrop); }
.ap-z-modal { z-index: var(--z-modal); }
.ap-z-popover { z-index: var(--z-popover); }
.ap-z-tooltip { z-index: var(--z-tooltip); }

/* Sizing Utilities */
.ap-w-full { width: 100%; }
.ap-w-1\/2 { width: 50%; }
.ap-w-1\/3 { width: 33.333333%; }
.ap-w-2\/3 { width: 66.666667%; }
.ap-w-1\/4 { width: 25%; }
.ap-w-3\/4 { width: 75%; }
.ap-w-1\/5 { width: 20%; }
.ap-w-2\/5 { width: 40%; }
.ap-w-3\/5 { width: 60%; }
.ap-w-4\/5 { width: 80%; }

.ap-h-full { height: 100%; }
.ap-h-screen { height: 100vh; }

.ap-min-h-full { min-height: 100%; }
.ap-min-h-screen { min-height: 100vh; }

/* Text Alignment */
.ap-text-left { text-align: left; }
.ap-text-center { text-align: center; }
.ap-text-right { text-align: right; }
.ap-text-justify { text-align: justify; }

/* Vertical Alignment */
.ap-align-baseline { vertical-align: baseline; }
.ap-align-top { vertical-align: top; }
.ap-align-middle { vertical-align: middle; }
.ap-align-bottom { vertical-align: bottom; }

/* Visibility */
.ap-visible { visibility: visible; }
.ap-invisible { visibility: hidden; }

/* Overflow */
.ap-overflow-auto { overflow: auto; }
.ap-overflow-hidden { overflow: hidden; }
.ap-overflow-scroll { overflow: scroll; }
.ap-overflow-x-auto { overflow-x: auto; }
.ap-overflow-y-auto { overflow-y: auto; }

/* Whitespace */
.ap-whitespace-nowrap { white-space: nowrap; }
.ap-whitespace-pre { white-space: pre; }
.ap-whitespace-pre-line { white-space: pre-line; }
.ap-whitespace-pre-wrap { white-space: pre-wrap; }

/* Breakpoints */
@media (min-width: 576px) {
  .ap-sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ap-sm\:flex-row { flex-direction: row; }
  .ap-sm\:w-1\/2 { width: 50%; }
}

@media (min-width: 768px) {
  .ap-md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ap-md\:flex-row { flex-direction: row; }
  .ap-md\:w-1\/3 { width: 33.333333%; }
}

@media (min-width: 992px) {
  .ap-lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ap-lg\:flex-row { flex-direction: row; }
  .ap-lg\:w-1\/4 { width: 25%; }
}

@media (min-width: 1200px) {
  .ap-xl\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .ap-xl\:flex-row { flex-direction: row; }
  .ap-xl\:w-1\/5 { width: 20%; }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--system-gray3);
  border-radius: var(--radius-full);
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--system-gray2);
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* ============================================
   SELECTION
   ============================================ */

::selection {
  background: rgba(0, 122, 255, 0.2);
  color: var(--text-primary);
}

/* ============================================
   DROPDOWN MENU
   ============================================ */

.ap-dropdown {
  position: relative;
  display: inline-block;
}

.ap-dropdown__trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--bg-tertiary);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.ap-dropdown__trigger:hover {
  background-color: var(--bg-tertiary);
}

.ap-dropdown__trigger:focus {
  outline: 2px solid var(--system-blue);
  outline-offset: 2px;
}

.ap-dropdown__menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--bg-tertiary);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  min-width: 200px;
  z-index: 1000;
  overflow: hidden;
  animation: dropdownFadeIn 0.2s ease-out;
}

.ap-dropdown__menu--right {
  left: auto;
  right: 0;
}

.ap-dropdown__item {
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ap-dropdown__item:hover {
  background-color: var(--bg-tertiary);
}

.ap-dropdown__item--divider {
  height: 1px;
  background-color: var(--bg-tertiary);
  margin: 4px 0;
  cursor: default;
}

.ap-dropdown__item--divider:hover {
  background-color: var(--bg-tertiary);
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   DATE PICKER
   ============================================ */

.ap-date-picker {
  position: relative;
  display: inline-block;
}

.ap-date-picker__input {
  width: 160px;
  padding: 8px 12px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--bg-tertiary);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.ap-date-picker__input:hover {
  background-color: var(--bg-tertiary);
}

.ap-date-picker__input:focus {
  outline: 2px solid var(--system-blue);
  outline-offset: 2px;
}

.ap-date-picker__calendar {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--bg-tertiary);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  overflow: hidden;
  animation: dropdownFadeIn 0.2s ease-out;
}

.ap-date-picker__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--bg-tertiary);
}

.ap-date-picker__month-year {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.ap-date-picker__nav {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.ap-date-picker__nav:hover {
  background-color: var(--bg-tertiary);
}

.ap-date-picker__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  padding: 12px;
}

.ap-date-picker__day {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.ap-date-picker__day:hover {
  background-color: var(--bg-tertiary);
}

.ap-date-picker__day--selected {
  background-color: var(--system-blue);
  color: white;
}

.ap-date-picker__day--disabled {
  color: var(--text-tertiary);
  cursor: not-allowed;
}

.ap-date-picker__day--disabled:hover {
  background-color: transparent;
}

.ap-date-picker__day--today {
  font-weight: 600;
  position: relative;
}

.ap-date-picker__day--today::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  background-color: var(--system-blue);
  border-radius: 50%;
}

.ap-date-picker__day--selected.ap-date-picker__day--today::after {
  background-color: white;
}

/* ============================================
   TIME PICKER
   ============================================ */

.ap-time-picker {
  position: relative;
  display: inline-block;
}

.ap-time-picker__input {
  width: 120px;
  padding: 8px 12px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--bg-tertiary);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.ap-time-picker__input:hover {
  background-color: var(--bg-tertiary);
}

.ap-time-picker__input:focus {
  outline: 2px solid var(--system-blue);
  outline-offset: 2px;
}

.ap-time-picker__clock {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--bg-tertiary);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  width: 240px;
  height: 240px;
  z-index: 1000;
  overflow: hidden;
  animation: dropdownFadeIn 0.2s ease-out;
  display: flex;
  flex-direction: column;
}

.ap-time-picker__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--bg-tertiary);
}

.ap-time-picker__period {
  display: flex;
  gap: 8px;
}

.ap-time-picker__period-btn {
  padding: 4px 12px;
  border: 1px solid var(--bg-tertiary);
  background-color: var(--bg-secondary);
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.ap-time-picker__period-btn--active {
  background-color: var(--system-blue);
  color: white;
  border-color: var(--system-blue);
}

.ap-time-picker__clock-face {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ap-time-picker__clock-face::before {
  content: '';
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background-color: var(--bg-tertiary);
  opacity: 0.2;
}

.ap-time-picker__clock-hand {
  position: absolute;
  width: 2px;
  background-color: var(--system-blue);
  transform-origin: bottom center;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ap-time-picker__clock-hand--hour {
  height: 60px;
  top: 20px;
  z-index: 2;
}

.ap-time-picker__clock-hand--minute {
  height: 80px;
  top: 0;
  z-index: 1;
}

.ap-time-picker__clock-center {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--system-blue);
  z-index: 3;
}

.ap-time-picker__time {
  position: absolute;
  top: 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.ap-time-picker__footer {
  display: flex;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid var(--bg-tertiary);
  gap: 8px;
}

.ap-time-picker__btn {
  padding: 6px 12px;
  border: 1px solid var(--bg-tertiary);
  background-color: var(--bg-secondary);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.ap-time-picker__btn:hover {
  background-color: var(--bg-tertiary);
}

.ap-time-picker__btn--confirm {
  background-color: var(--system-blue);
  color: white;
  border-color: var(--system-blue);
}

.ap-time-picker__btn--confirm:hover {
  background-color: #0066cc;
}

/* ============================================
   DATA TABLE
   ============================================ */

.ap-table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.ap-table th,
.ap-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--bg-tertiary);
}

.ap-table th {
  background-color: var(--bg-tertiary);
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
}

.ap-table tr {
  transition: background-color 0.2s ease;
}

.ap-table tr:hover {
  background-color: var(--bg-tertiary);
}

.ap-table tr:last-child td {
  border-bottom: none;
}

/* Table Variants */
.ap-table--striped tr:nth-child(even) {
  background-color: rgba(0, 0, 0, 0.02);
}

.ap-table--bordered {
  border: 1px solid var(--bg-tertiary);
}

.ap-table--bordered th,
.ap-table--bordered td {
  border-right: 1px solid var(--bg-tertiary);
}

.ap-table--bordered th:last-child,
.ap-table--bordered td:last-child {
  border-right: none;
}

/* Table Container */
.ap-table-container {
  overflow-x: auto;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* ============================================
   DATA CARDS
   ============================================ */

.ap-data-card {
  background: var(--material-regular);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ap-data-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.ap-data-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}

.ap-data-card__title {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ap-data-card__icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 122, 255, 0.15);
  color: var(--system-blue);
}

.ap-data-card__value {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.ap-data-card__change {
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.ap-data-card__change--positive {
  color: var(--system-green);
}

.ap-data-card__change--negative {
  color: var(--system-red);
}

/* Data Card Variants */
.ap-data-card--blue .ap-data-card__icon {
  background: rgba(0, 122, 255, 0.15);
  color: var(--system-blue);
}

.ap-data-card--green .ap-data-card__icon {
  background: rgba(52, 199, 89, 0.15);
  color: var(--system-green);
}

.ap-data-card--red .ap-data-card__icon {
  background: rgba(255, 59, 48, 0.15);
  color: var(--system-red);
}

.ap-data-card--orange .ap-data-card__icon {
  background: rgba(255, 149, 0, 0.15);
  color: var(--system-orange);
}

.ap-data-card--purple .ap-data-card__icon {
  background: rgba(175, 82, 222, 0.15);
  color: var(--system-purple);
}

/* ============================================
   TIMELINE
   ============================================ */

.ap-timeline {
  position: relative;
  padding-left: var(--space-8);
}

.ap-timeline::before {
  content: '';
  position: absolute;
  left: var(--space-3);
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--system-gray4);
}

.ap-timeline__item {
  position: relative;
  margin-bottom: var(--space-6);
}

.ap-timeline__item:last-child {
  margin-bottom: 0;
}

.ap-timeline__dot {
  position: absolute;
  left: calc(-1 * var(--space-8) + var(--space-2));
  top: var(--space-1);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--system-blue);
  border: 2px solid white;
  box-shadow: 0 0 0 2px var(--system-blue);
}

.ap-timeline__content {
  background: var(--material-regular);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.ap-timeline__time {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
}

.ap-timeline__title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.ap-timeline__description {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* Timeline Variants */
.ap-timeline--alternate {
  padding-left: 0;
  padding-right: var(--space-8);
}

.ap-timeline--alternate::before {
  left: 50%;
  transform: translateX(-50%);
}

.ap-timeline--alternate .ap-timeline__item:nth-child(even) {
  padding-left: var(--space-8);
  padding-right: 0;
}

.ap-timeline--alternate .ap-timeline__dot {
  left: 50%;
  transform: translateX(-50%);
}

/* ============================================
   PROGRESS & ACTIVITY
   ============================================ */

/* Progress Bar */
.ap-progress {
  width: 100%;
  height: 4px;
  background: var(--system-gray5);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.ap-progress__bar {
  height: 100%;
  background: var(--system-blue);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

/* Progress Bar Variants */
.ap-progress--success .ap-progress__bar {
  background: var(--system-green);
}

.ap-progress--warning .ap-progress__bar {
  background: var(--system-orange);
}

.ap-progress--danger .ap-progress__bar {
  background: var(--system-red);
}

.ap-progress--large {
  height: 8px;
}

.ap-progress--small {
  height: 2px;
}

/* Activity Indicator (Spinner) */
.ap-spinner {
  width: 24px;
  height: 24px;
  animation: ap-spin 1s linear infinite;
}

.ap-spinner__track {
  fill: none;
  stroke: var(--system-gray4);
  stroke-width: 2;
}

.ap-spinner__indicator {
  fill: none;
  stroke: var(--system-blue);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 60;
  stroke-dashoffset: 20;
}

@keyframes ap-spin {
  to { transform: rotate(360deg); }
}

.ap-spinner--large {
  width: 36px;
  height: 36px;
}

.ap-spinner--small {
  width: 16px;
  height: 16px;
}

.ap-spinner--success .ap-spinner__indicator {
  stroke: var(--system-green);
}

.ap-spinner--warning .ap-spinner__indicator {
  stroke: var(--system-orange);
}

.ap-spinner--danger .ap-spinner__indicator {
  stroke: var(--system-red);
}

/* ============================================
   PAGINATION
   ============================================ */

.ap-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.ap-pagination__item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ap-pagination__item:hover {
  background: var(--bg-tertiary);
}

.ap-pagination__item--active {
  background: var(--system-blue);
  color: white;
}

.ap-pagination__item--disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ap-pagination__item--disabled:hover {
  background: transparent;
}

/* ============================================
   BADGES
   ============================================ */

.ap-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--system-red);
  color: white;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  border-radius: var(--radius-full);
}

.ap-badge--small {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
}

.ap-badge--large {
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  font-size: var(--text-sm);
}

.ap-badge--blue { background: var(--system-blue); }
.ap-badge--green { background: var(--system-green); }
.ap-badge--gray { background: var(--system-gray); }
.ap-badge--orange { background: var(--system-orange); }
.ap-badge--purple { background: var(--system-purple); }
.ap-badge--pink { background: var(--system-pink); }
.ap-badge--indigo { background: var(--system-indigo); }
.ap-badge--teal { background: var(--system-teal); }
.ap-badge--yellow { background: var(--system-yellow); }

.ap-badge--outline {
  background: transparent;
  color: var(--system-blue);
  border: 1px solid var(--system-blue);
}

.ap-badge--pulse {
  animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 122, 255, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(0, 122, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 122, 255, 0);
  }
}

/* ============================================
   CHIPS / TAGS
   ============================================ */

.ap-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  background: var(--system-gray5);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ap-chip:hover {
  background: var(--system-gray4);
}

.ap-chip--selected {
  background: var(--system-blue);
  color: white;
  animation: chipSelect 0.2s ease-out;
}

@keyframes chipSelect {
  0% {
    transform: scale(0.95);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.ap-chip__remove {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 50%;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 10px;
}

.ap-chip__remove:hover {
  background: rgba(0, 0, 0, 0.3);
}

.ap-chip--outline {
  background: transparent;
  border: 1px solid var(--system-gray4);
}

.ap-chip--outline:hover {
  background: var(--system-gray5);
}

.ap-chip--blue {
  background: rgba(0, 122, 255, 0.15);
  color: var(--system-blue);
}

.ap-chip--green {
  background: rgba(52, 199, 89, 0.15);
  color: var(--system-green);
}

.ap-chip--red {
  background: rgba(255, 59, 48, 0.15);
  color: var(--system-red);
}

/* ============================================
   AVATAR
   ============================================ */

.ap-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
  background: var(--system-gray5);
  color: var(--text-secondary);
  font-weight: var(--font-medium);
}

.ap-avatar--small { width: 32px; height: 32px; font-size: var(--text-sm); }
.ap-avatar--medium { width: 44px; height: 44px; font-size: var(--text-lg); }
.ap-avatar--large { width: 64px; height: 64px; font-size: var(--text-2xl); }
.ap-avatar--xlarge { width: 80px; height: 80px; font-size: var(--text-3xl); }

.ap-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ap-avatar--group {
  display: flex;
  margin-left: -8px;
}

.ap-avatar--group .ap-avatar {
  border: 2px solid var(--bg-primary);
  margin-left: -8px;
}

/* ============================================
   DIVIDER
   ============================================ */

.ap-divider {
  height: 1px;
  background: var(--system-gray4);
  margin: var(--space-4) 0;
}

.ap-divider--vertical {
  width: 1px;
  height: auto;
  margin: 0 var(--space-4);
}

.ap-divider--dashed {
  background: repeating-linear-gradient(
    to right,
    var(--system-gray4),
    var(--system-gray4) 4px,
    transparent 4px,
    transparent 8px
  );
}

/* ============================================
   EMPTY STATE
   ============================================ */

.ap-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-5);
  text-align: center;
}

.ap-empty__icon {
  width: 64px;
  height: 64px;
  color: var(--system-gray3);
  margin-bottom: var(--space-4);
}

.ap-empty__title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.ap-empty__description {
  font-size: var(--text-base);
  color: var(--text-secondary);
  max-width: 300px;
}

.ap-empty__action {
  margin-top: var(--space-6);
}

/* ============================================
   PROGRESS RING
   ============================================ */

.ap-progress-ring {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ap-progress-ring__svg {
  transform: rotate(-90deg);
}

.ap-progress-ring__circle {
  fill: none;
  stroke: var(--bg-tertiary);
  stroke-width: 4;
}

.ap-progress-ring__circle--progress {
  stroke: var(--system-blue);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s ease;
}

.ap-progress-ring__text {
  position: absolute;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ============================================
   IMAGE PREVIEW
   ============================================ */

.ap-image-preview {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background-color: var(--bg-tertiary);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ap-image-preview:hover {
  transform: scale(1.02);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.ap-image-preview__image {
  width: 100%;
  height: auto;
  display: block;
}

.ap-image-preview__overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
  display: flex;
  align-items: flex-end;
  padding: 16px;
}

.ap-image-preview:hover .ap-image-preview__overlay {
  opacity: 1;
}

.ap-image-preview__caption {
  color: white;
  font-size: 14px;
  font-weight: 500;
}

/* ============================================
   MEDIA PLAYER
   ============================================ */

.ap-media-player {
  background-color: var(--bg-secondary);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.ap-media-player__controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.ap-media-player__button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.ap-media-player__button:hover {
  background-color: var(--bg-quaternary);
}

.ap-media-player__button--play {
  background-color: var(--system-blue);
  color: white;
}

.ap-media-player__button--play:hover {
  background-color: #0066cc;
}

.ap-media-player__progress {
  width: 100%;
  height: 4px;
  background-color: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
  margin-bottom: 8px;
}

.ap-media-player__progress-bar {
  height: 100%;
  background-color: var(--system-blue);
  transition: width 0.1s ease;
}

.ap-media-player__time {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ============================================
   AUDIO PLAYER
   ============================================ */

.ap-audio-player {
  background: var(--material-regular);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 16px;
}

.ap-audio-player__cover {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  overflow: hidden;
  background-color: var(--bg-tertiary);
}

.ap-audio-player__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ap-audio-player__info {
  flex: 1;
  min-width: 0;
}

.ap-audio-player__title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ap-audio-player__artist {
  font-size: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ap-audio-player__controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ap-audio-player__button {
  background-color: var(--bg-tertiary);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.ap-audio-player__button:hover {
  background-color: var(--bg-quaternary);
  transform: scale(1.05);
}

.ap-audio-player__button--play {
  background-color: var(--system-blue);
  color: white;
  width: 48px;
  height: 48px;
}

.ap-audio-player__button--play:hover {
  background-color: #0066cc;
}

.ap-audio-player__progress {
  width: 100%;
  height: 4px;
  background-color: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
  margin: 12px 0;
  cursor: pointer;
}

.ap-audio-player__progress-bar {
  height: 100%;
  background-color: var(--system-blue);
  border-radius: 2px;
  transition: width 0.1s linear;
}

/* Audio Player Variants */
.ap-audio-player--mini {
  padding: 12px;
  border-radius: 12px;
}

.ap-audio-player--mini .ap-audio-player__cover {
  width: 48px;
  height: 48px;
}

.ap-audio-player--mini .ap-audio-player__button {
  width: 32px;
  height: 32px;
}

.ap-audio-player--mini .ap-audio-player__button--play {
  width: 40px;
  height: 40px;
}

/* ============================================
   VIDEO COMPONENTS
   ============================================ */

/* Video Container */
.ap-video {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background-color: var(--bg-tertiary);
}

.ap-video video {
  width: 100%;
  height: auto;
  display: block;
}

/* Video Thumbnail */
.ap-video-thumbnail {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background-color: var(--bg-tertiary);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ap-video-thumbnail:hover {
  transform: scale(1.02);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.ap-video-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ap-video-thumbnail__overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ap-video-thumbnail:hover .ap-video-thumbnail__overlay {
  opacity: 1;
}

.ap-video-thumbnail__play {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(0, 122, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: transform 0.2s ease;
}

.ap-video-thumbnail:hover .ap-video-thumbnail__play {
  transform: scale(1.1);
}

.ap-video-thumbnail__duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
}

/* ============================================
   MEDIA CARDS
   ============================================ */

.ap-media-card {
  background: var(--material-regular);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ap-media-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.ap-media-card__media {
  position: relative;
  aspect-ratio: 16 / 9;
  background-color: var(--bg-tertiary);
}

.ap-media-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ap-media-card__content {
  padding: 16px;
}

.ap-media-card__title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.ap-media-card__description {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.ap-media-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ap-media-card__meta {
  font-size: 12px;
  color: var(--text-tertiary);
}

.ap-media-card__actions {
  display: flex;
  gap: 8px;
}

/* ============================================
   INTERACTIVE COMPONENTS
   ============================================ */

/* ============================================
   MODAL
   ============================================ */

.ap-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ap-modal--open {
  opacity: 1;
  visibility: visible;
}

.ap-modal__backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: modalBackdropFadeIn 0.3s ease;
}

@keyframes modalBackdropFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ap-modal__content {
  position: relative;
  background: var(--material-regular);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.ap-modal__header {
  padding: var(--space-5);
  border-bottom: 1px solid var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ap-modal__title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.ap-modal__close {
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ap-modal__close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.ap-modal__body {
  padding: var(--space-5);
}

.ap-modal__footer {
  padding: var(--space-5);
  border-top: 1px solid var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* Modal Variants */
.ap-modal--small .ap-modal__content {
  max-width: 400px;
}

.ap-modal--large .ap-modal__content {
  max-width: 800px;
}

/* ============================================
   DRAWER
   ============================================ */

.ap-drawer {
  position: fixed;
  top: 0;
  right: -320px;
  width: 320px;
  height: 100vh;
  background: var(--material-regular);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
  z-index: 999;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
}

.ap-drawer--open {
  right: 0;
}

.ap-drawer--left {
  right: auto;
  left: -320px;
}

.ap-drawer--left.ap-drawer--open {
  left: 0;
}

.ap-drawer__header {
  padding: var(--space-4);
  border-bottom: 1px solid var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ap-drawer__title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.ap-drawer__close {
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ap-drawer__close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.ap-drawer__body {
  flex: 1;
  padding: var(--space-4);
  overflow-y: auto;
}

.ap-drawer__footer {
  padding: var(--space-4);
  border-top: 1px solid var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* ============================================
   TOAST
   ============================================ */

.ap-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--material-regular);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  z-index: 1001;
  animation: toastSlideIn 0.3s ease, toastFadeOut 0.3s ease 3s;
  opacity: 0;
  transform: translateX(100%);
}

.ap-toast--visible {
  opacity: 1;
  transform: translateX(0);
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastFadeOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

.ap-toast__icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.ap-toast--success .ap-toast__icon {
  background: rgba(52, 199, 89, 0.15);
  color: var(--system-green);
}

.ap-toast--error .ap-toast__icon {
  background: rgba(255, 59, 48, 0.15);
  color: var(--system-red);
}

.ap-toast--warning .ap-toast__icon {
  background: rgba(255, 149, 0, 0.15);
  color: var(--system-orange);
}

.ap-toast--info .ap-toast__icon {
  background: rgba(0, 122, 255, 0.15);
  color: var(--system-blue);
}

.ap-toast__content {
  flex: 1;
  min-width: 0;
}

.ap-toast__title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.ap-toast__message {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ap-toast__close {
  background: none;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ap-toast__close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* ============================================
   TOOLTIP
   ============================================ */

.ap-tooltip {
  position: relative;
  cursor: help;
}

.ap-tooltip__content {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  z-index: 1000;
  margin-bottom: var(--space-2);
}

.ap-tooltip__content::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 4px;
  border-style: solid;
  border-color: rgba(0, 0, 0, 0.8) transparent transparent transparent;
}

.ap-tooltip:hover .ap-tooltip__content {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-4px);
}

/* Tooltip Variants */
.ap-tooltip--top .ap-tooltip__content {
  bottom: 100%;
  top: auto;
}

.ap-tooltip--bottom .ap-tooltip__content {
  bottom: auto;
  top: 100%;
  margin-bottom: 0;
  margin-top: var(--space-2);
}

.ap-tooltip--bottom .ap-tooltip__content::after {
  top: auto;
  bottom: 100%;
  border-color: transparent transparent rgba(0, 0, 0, 0.8) transparent;
}

.ap-tooltip--left .ap-tooltip__content {
  bottom: 50%;
  left: auto;
  right: 100%;
  transform: translateY(50%);
  margin-bottom: 0;
  margin-right: var(--space-2);
}

.ap-tooltip--left .ap-tooltip__content::after {
  top: 50%;
  left: auto;
  right: -8px;
  transform: translateY(-50%);
  border-color: transparent transparent transparent rgba(0, 0, 0, 0.8);
}

.ap-tooltip--right .ap-tooltip__content {
  bottom: 50%;
  left: 100%;
  transform: translateY(50%);
  margin-bottom: 0;
  margin-left: var(--space-2);
}

.ap-tooltip--right .ap-tooltip__content::after {
  top: 50%;
  left: -8px;
  transform: translateY(-50%);
  border-color: transparent rgba(0, 0, 0, 0.8) transparent transparent;
}

/* ============================================
   POPOVER
   ============================================ */

.ap-popover {
  position: relative;
  display: inline-block;
}

.ap-popover__content {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--material-regular);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: var(--space-4);
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  z-index: 999;
  margin-top: var(--space-2);
}

.ap-popover__content::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: transparent transparent var(--bg-secondary) transparent;
}

.ap-popover--open .ap-popover__content {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(4px);
}

/* Popover Variants */
.ap-popover--top .ap-popover__content {
  top: auto;
  bottom: 100%;
  margin-top: 0;
  margin-bottom: var(--space-2);
}

.ap-popover--top .ap-popover__content::after {
  bottom: auto;
  top: 100%;
  border-color: var(--bg-secondary) transparent transparent transparent;
}

.ap-popover--left .ap-popover__content {
  top: 50%;
  left: auto;
  right: 100%;
  transform: translateY(-50%);
  margin-top: 0;
  margin-right: var(--space-2);
}

.ap-popover--left .ap-popover__content::after {
  top: 50%;
  left: auto;
  right: -12px;
  transform: translateY(-50%);
  border-color: transparent transparent transparent var(--bg-secondary);
}

.ap-popover--right .ap-popover__content {
  top: 50%;
  left: 100%;
  transform: translateY(-50%);
  margin-top: 0;
  margin-left: var(--space-2);
}

.ap-popover--right .ap-popover__content::after {
  top: 50%;
  left: -12px;
  transform: translateY(-50%);
  border-color: transparent var(--bg-secondary) transparent transparent;
}

/* ============================================
   CONTEXT MENU
   ============================================ */

.ap-context-menu {
  position: fixed;
  background: var(--material-regular);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: var(--space-2);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.95);
  transition: all 0.2s ease;
}

.ap-context-menu--open {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.ap-context-menu__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color 0.2s ease;
  white-space: nowrap;
}

.ap-context-menu__item:hover {
  background: var(--bg-tertiary);
}

.ap-context-menu__item--disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ap-context-menu__item--disabled:hover {
  background: transparent;
}

.ap-context-menu__separator {
  height: 1px;
  background: var(--bg-tertiary);
  margin: var(--space-2) 0;
}

/* ============================================
   UTILITY COMPONENTS
   ============================================ */

/* ============================================
   TOOLBAR
   ============================================ */

.ap-toolbar {
  background: var(--material-regular);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--bg-tertiary);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.ap-toolbar__left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.ap-toolbar__center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
}

.ap-toolbar__right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.ap-toolbar__button {
  background: none;
  border: none;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.ap-toolbar__button:hover {
  background: var(--bg-tertiary);
}

.ap-toolbar__button--icon {
  padding: var(--space-2);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================
   SIDEBAR
   ============================================ */

.ap-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  background: var(--material-regular);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--bg-tertiary);
  display: flex;
  flex-direction: column;
  z-index: 900;
  transition: transform 0.3s ease;
}

.ap-sidebar--collapsed {
  transform: translateX(-100%);
}

.ap-sidebar__header {
  padding: var(--space-4);
  border-bottom: 1px solid var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ap-sidebar__logo {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.ap-sidebar__close {
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ap-sidebar__close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.ap-sidebar__content {
  flex: 1;
  padding: var(--space-4);
  overflow-y: auto;
}

.ap-sidebar__footer {
  padding: var(--space-4);
  border-top: 1px solid var(--bg-tertiary);
}

/* ============================================
   PANEL
   ============================================ */

.ap-panel {
  background: var(--material-regular);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ap-panel:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.ap-panel__header {
  padding: var(--space-4);
  border-bottom: 1px solid var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ap-panel__title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.ap-panel__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.ap-panel__body {
  padding: var(--space-4);
}

.ap-panel__footer {
  padding: var(--space-4);
  border-top: 1px solid var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

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

.ap-card {
  background: var(--material-regular);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ap-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.ap-card__header {
  margin-bottom: var(--space-4);
}

.ap-card__title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.ap-card__subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.ap-card__body {
  margin-bottom: var(--space-4);
}

.ap-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Card Variants */
.ap-card--elevated {
  box-shadow: var(--shadow-md);
}

.ap-card--outlined {
  border: 1px solid var(--bg-tertiary);
  box-shadow: none;
}

.ap-card--compact {
  padding: var(--space-4);
}

/* ============================================
   HEADER
   ============================================ */

.ap-header {
  background: var(--material-regular);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--bg-tertiary);
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  position: sticky;
  top: 0;
  z-index: 800;
}

.ap-header__left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.ap-header__logo {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.ap-header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.ap-header__nav-item {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: var(--font-medium);
  transition: color var(--transition-fast);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
}

.ap-header__nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.ap-header__nav-item--active {
  color: var(--system-blue);
  background: rgba(0, 122, 255, 0.1);
}

.ap-header__right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ============================================
   FOOTER
   ============================================ */

.ap-footer {
  background: var(--material-regular);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--bg-tertiary);
  padding: var(--space-6) var(--space-5);
}

.ap-footer__content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

.ap-footer__section {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.ap-footer__section-title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.ap-footer__link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
  font-size: var(--text-sm);
}

.ap-footer__link:hover {
  color: var(--system-blue);
}

.ap-footer__bottom {
  border-top: 1px solid var(--bg-tertiary);
  padding-top: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.ap-footer__copyright {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.ap-footer__social {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.ap-footer__social-link {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.ap-footer__social-link:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* ============================================
   RESPONSIVE UTILITIES
   ============================================ */

/* Mobile-first approach */

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
  .ap-container {
    max-width: 540px;
  }
  
  .demo-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
  .ap-container {
    max-width: 720px;
  }
  
  .demo-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .ap-sidebar {
    width: 240px;
  }
  
  .ap-content {
    margin-left: 240px;
  }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
  .ap-container {
    max-width: 960px;
  }
  
  .demo-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .ap-sidebar {
    width: 280px;
  }
  
  .ap-content {
    margin-left: 280px;
  }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
  .ap-container {
    max-width: 1140px;
  }
  
  .demo-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ============================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================ */

/* Focus styles */
.ap-btn:focus,
.ap-input:focus,
.ap-textarea:focus,
.ap-select:focus,
.ap-switch:focus-within,
.ap-slider:focus-within,
.ap-dropdown__trigger:focus,
.ap-date-picker__input:focus,
.ap-time-picker__input:focus {
  outline: 2px solid var(--system-blue);
  outline-offset: 2px;
}

/* Reduce motion for users who prefer 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;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --bg-primary: #ffffff;
    --bg-secondary: #f0f0f0;
    --bg-tertiary: #e0e0e0;
    --text-primary: #000000;
    --text-secondary: #333333;
  }
  
  @media (prefers-color-scheme: dark) {
    :root {
      --bg-primary: #000000;
      --bg-secondary: #222222;
      --bg-tertiary: #333333;
      --text-primary: #ffffff;
      --text-secondary: #cccccc;
    }
  }
}

/* ============================================
   ADDITIONAL COMPONENTS - SLIDER
   ============================================ */

.ap-slider {
  position: relative;
  width: 100%;
  padding: var(--space-2) 0;
}

.ap-slider__track {
  width: 100%;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  position: relative;
  cursor: pointer;
}

.ap-slider__progress {
  position: absolute;
  height: 100%;
  background: var(--system-blue);
  border-radius: 2px;
  transition: width 0.1s ease;
}

.ap-slider__thumb {
  position: absolute;
  width: 20px;
  height: 20px;
  background: white;
  border: 2px solid var(--system-blue);
  border-radius: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  cursor: grab;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.ap-slider__thumb:hover {
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow: var(--shadow-md);
}

.ap-slider__thumb:active {
  cursor: grabbing;
  transform: translate(-50%, -50%) scale(1.15);
}

.ap-slider--disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Slider Variants */
.ap-slider--range .ap-slider__thumb:nth-child(2) {
  background: var(--system-green);
  border-color: var(--system-green);
}

/* ============================================
   ADDITIONAL COMPONENTS - RATING
   ============================================ */

.ap-rating {
  display: flex;
  gap: var(--space-1);
  align-items: center;
}

.ap-rating__star {
  width: 24px;
  height: 24px;
  cursor: pointer;
  transition: all 0.2s ease;
  fill: var(--system-gray3);
}

.ap-rating__star:hover {
  transform: scale(1.1);
}

.ap-rating__star--filled {
  fill: var(--system-yellow);
}

.ap-rating__star--half {
  fill: url(#half-star-gradient);
}

.ap-rating--disabled .ap-rating__star {
  cursor: default;
  pointer-events: none;
}

.ap-rating--small .ap-rating__star {
  width: 16px;
  height: 16px;
}

.ap-rating--large .ap-rating__star {
  width: 32px;
  height: 32px;
}

/* ============================================
   ADDITIONAL COMPONENTS - TAG CLOUD
   ============================================ */

.ap-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.ap-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  background: var(--system-gray5);
  color: var(--text-primary);
  font-size: var(--text-sm);
  border-radius: var(--radius-full);
  transition: all 0.2s ease;
  cursor: pointer;
}

.ap-tag:hover {
  background: var(--system-gray4);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.ap-tag--selected {
  background: var(--system-blue);
  color: white;
}

.ap-tag--selected:hover {
  background: #0066cc;
}

.ap-tag--outlined {
  background: transparent;
  border: 1px solid var(--system-gray3);
}

.ap-tag--outlined:hover {
  background: var(--bg-tertiary);
}

.ap-tag__close {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.ap-tag__close:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* ============================================
   ADDITIONAL COMPONENTS - CODE BLOCK
   ============================================ */

.ap-code-block {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  overflow-x: auto;
  position: relative;
  border: 1px solid var(--bg-tertiary);
}

.ap-code-block__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-3);
  border-bottom: 1px solid var(--bg-tertiary);
}

.ap-code-block__language {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  text-transform: uppercase;
  font-weight: var(--font-medium);
}

.ap-code-block__copy {
  background: var(--bg-tertiary);
  border: none;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.ap-code-block__copy:hover {
  background: var(--bg-quaternary);
}

.ap-code-block pre {
  margin: 0;
  white-space: pre;
  overflow-x: auto;
}

.ap-code-block code {
  font-family: var(--font-mono);
  color: var(--text-primary);
}

/* ============================================
   ADDITIONAL COMPONENTS - PROGRESS RING
   ============================================ */

.ap-progress-ring {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ap-progress-ring__circle {
  transform: rotate(-90deg);
  transform-origin: center;
}

.ap-progress-ring__background {
  fill: none;
  stroke: var(--bg-tertiary);
  stroke-width: 4;
}

.ap-progress-ring__progress {
  fill: none;
  stroke: var(--system-blue);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s ease;
}

.ap-progress-ring__text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.ap-progress-ring--small {
  width: 32px;
  height: 32px;
}

.ap-progress-ring--small .ap-progress-ring__text {
  font-size: var(--text-xs);
}

.ap-progress-ring--large {
  width: 64px;
  height: 64px;
}

.ap-progress-ring--large .ap-progress-ring__text {
  font-size: var(--text-lg);
}

/* ============================================
   ADDITIONAL COMPONENTS - NOTIFICATION
   ============================================ */

.ap-notification {
  background: var(--material-regular);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-lg);
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  max-width: 400px;
  animation: notificationSlideIn 0.3s ease;
  position: relative;
}

@keyframes notificationSlideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.ap-notification__icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ap-notification--info .ap-notification__icon {
  background: rgba(0, 122, 255, 0.15);
  color: var(--system-blue);
}

.ap-notification--success .ap-notification__icon {
  background: rgba(52, 199, 89, 0.15);
  color: var(--system-green);
}

.ap-notification--warning .ap-notification__icon {
  background: rgba(255, 149, 0, 0.15);
  color: var(--system-orange);
}

.ap-notification--error .ap-notification__icon {
  background: rgba(255, 59, 48, 0.15);
  color: var(--system-red);
}

.ap-notification__content {
  flex: 1;
  min-width: 0;
}

.ap-notification__title {
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.ap-notification__message {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-normal);
}

.ap-notification__close {
  background: none;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.ap-notification__close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* ============================================
   ADDITIONAL COMPONENTS - BADGE GROUP
   ============================================ */

.ap-badge-group {
  display: inline-flex;
  align-items: center;
  position: relative;
}

.ap-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border-radius: var(--radius-full);
  line-height: 1;
}

.ap-badge--primary {
  background: var(--system-blue);
  color: white;
}

.ap-badge--secondary {
  background: var(--system-gray);
  color: white;
}

.ap-badge--success {
  background: var(--system-green);
  color: white;
}

.ap-badge--warning {
  background: var(--system-orange);
  color: white;
}

.ap-badge--error {
  background: var(--system-red);
  color: white;
}

.ap-badge--outline {
  background: transparent;
  border: 1px solid var(--system-gray3);
  color: var(--text-primary);
}

.ap-badge--dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border-radius: 50%;
}

.ap-badge--count {
  min-width: 20px;
  height: 20px;
  padding: 0 var(--space-1);
}

.ap-badge--top-right {
  position: absolute;
  top: -8px;
  right: -8px;
  transform: translate(50%, -50%);
}

/* ============================================
   ADDITIONAL COMPONENTS - STEPPER
   ============================================ */

.ap-stepper {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.ap-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  position: relative;
  flex: 1;
}

.ap-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 16px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--bg-tertiary);
  z-index: 0;
}

.ap-step__number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-medium);
  z-index: 1;
  transition: all 0.3s ease;
}

.ap-step--completed .ap-step__number {
  background: var(--system-green);
  color: white;
}

.ap-step--active .ap-step__number {
  background: var(--system-blue);
  color: white;
  transform: scale(1.1);
}

.ap-step__title {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  text-align: center;
  transition: color 0.3s ease;
}

.ap-step--completed .ap-step__title,
.ap-step--active .ap-step__title {
  color: var(--text-primary);
}

/* ============================================
   ADDITIONAL COMPONENTS - CALENDAR
   ============================================ */

.ap-calendar {
  background: var(--material-regular);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  box-shadow: var(--shadow-md);
  width: 320px;
}

.ap-calendar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.ap-calendar__month {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.ap-calendar__nav {
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.2s ease;
}

.ap-calendar__nav:hover {
  background: var(--bg-tertiary);
}

.ap-calendar__weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: var(--space-2);
}

.ap-calendar__weekday {
  text-align: center;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  padding: var(--space-2) 0;
}

.ap-calendar__days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.ap-calendar__day {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.ap-calendar__day:hover {
  background: var(--bg-tertiary);
}

.ap-calendar__day--today {
  font-weight: var(--font-semibold);
  position: relative;
}

.ap-calendar__day--today::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  background: var(--system-blue);
  border-radius: 50%;
}

.ap-calendar__day--selected {
  background: var(--system-blue);
  color: white;
  font-weight: var(--font-medium);
}

.ap-calendar__day--selected:hover {
  background: #0066cc;
}

.ap-calendar__day--disabled {
  color: var(--text-tertiary);
  cursor: not-allowed;
}

.ap-calendar__day--disabled:hover {
  background: transparent;
}

/* ============================================
   ADDITIONAL COMPONENTS - COLOR PICKER
   ============================================ */

.ap-color-picker {
  background: var(--material-regular);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  box-shadow: var(--shadow-md);
  width: 280px;
}

.ap-color-picker__spectrum {
  width: 100%;
  height: 200px;
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
  position: relative;
  cursor: crosshair;
  background: linear-gradient(to bottom, transparent, black), linear-gradient(to right, white, transparent);
}

.ap-color-picker__selector {
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid white;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}

.ap-color-picker__controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.ap-color-picker__hue {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, 
    #FF0000, #FFFF00, #00FF00, #00FFFF, #0000FF, #FF00FF, #FF0000
  );
  position: relative;
  cursor: pointer;
}

.ap-color-picker__hue-thumb {
  position: absolute;
  width: 16px;
  height: 16px;
  background: white;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-radius: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  box-shadow: var(--shadow-sm);
}

.ap-color-picker__preview {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.ap-color-picker__preview-color {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  border: 2px solid var(--bg-tertiary);
}

.ap-color-picker__input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-transform: uppercase;
}

/* ============================================
   ADDITIONAL COMPONENTS - TREE VIEW
   ============================================ */

.ap-tree-view {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
}

.ap-tree-node {
  display: flex;
  flex-direction: column;
}

.ap-tree-node__content {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.2s ease;
}

.ap-tree-node__content:hover {
  background: var(--bg-tertiary);
}

.ap-tree-node__content--selected {
  background: rgba(0, 122, 255, 0.1);
  color: var(--system-blue);
}

.ap-tree-node__toggle {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.ap-tree-node__toggle:hover {
  background: var(--bg-tertiary);
}

.ap-tree-node__toggle--open {
  transform: rotate(90deg);
}

.ap-tree-node__icon {
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.ap-tree-node__label {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.ap-tree-node__children {
  padding-left: var(--space-6);
  display: none;
}

.ap-tree-node__children--open {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ============================================
   ADDITIONAL COMPONENTS - METER / GAUGE
   ============================================ */

.ap-meter {
  position: relative;
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.ap-meter__fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.ap-meter--low .ap-meter__fill {
  background: var(--system-green);
}

.ap-meter--medium .ap-meter__fill {
  background: var(--system-orange);
}

.ap-meter--high .ap-meter__fill {
  background: var(--system-red);
}

.ap-meter__label {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.ap-gauge {
  position: relative;
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  width: 200px;
  height: 100px;
}

.ap-gauge__background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 200px 200px 0 0;
  background: conic-gradient(
    var(--system-green) 0%, 
    var(--system-green) 33%, 
    var(--system-orange) 33%, 
    var(--system-orange) 66%, 
    var(--system-red) 66%, 
    var(--system-red) 100%
  );
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  opacity: 0.3;
}

.ap-gauge__progress {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 160px;
  height: 80px;
  background: var(--bg-secondary);
  border-radius: 160px 160px 0 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.ap-gauge__needle {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 2px;
  height: 70px;
  background: var(--system-blue);
  transform-origin: bottom center;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2;
}

.ap-gauge__needle::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--system-blue);
}

.ap-gauge__value {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  z-index: 1;
}

/* ============================================
   ADDITIONAL COMPONENTS - AVATAR GROUP
   ============================================ */

.ap-avatar-group {
  display: flex;
  align-items: center;
  position: relative;
}

.ap-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--system-blue);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-medium);
  font-size: var(--text-sm);
  border: 2px solid var(--bg-primary);
  position: relative;
  transition: transform 0.2s ease;
  overflow: hidden;
}

.ap-avatar:hover {
  transform: translateY(-2px);
  z-index: 10;
}

.ap-avatar:not(:first-child) {
  margin-left: -12px;
}

.ap-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ap-avatar--small {
  width: 32px;
  height: 32px;
  font-size: var(--text-xs);
}

.ap-avatar--large {
  width: 48px;
  height: 48px;
  font-size: var(--text-base);
}

.ap-avatar--square {
  border-radius: var(--radius-md);
}

.ap-avatar--status {
  position: relative;
}

.ap-avatar--status::after {
  content: '';
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-primary);
}

.ap-avatar--online::after {
  background: var(--system-green);
}

.ap-avatar--offline::after {
  background: var(--system-gray);
}

.ap-avatar--away::after {
  background: var(--system-orange);
}

.ap-avatar--busy::after {
  background: var(--system-red);
}

.ap-avatar__count {
  background: var(--system-gray);
  font-size: var(--text-xs);
}

/* ============================================
   ADDITIONAL COMPONENTS - CHIP GROUP
   ============================================ */

.ap-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.ap-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: var(--text-sm);
  border-radius: var(--radius-full);
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid var(--bg-tertiary);
}

.ap-chip:hover {
  background: var(--bg-tertiary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.ap-chip--selected {
  background: var(--system-blue);
  color: white;
  border-color: var(--system-blue);
}

.ap-chip--selected:hover {
  background: #0066cc;
}

.ap-chip--disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.ap-chip__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.ap-chip__remove {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s ease;
  margin-left: var(--space-1);
}

.ap-chip__remove:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* ============================================
   ADDITIONAL COMPONENTS - TOAST
   ============================================ */

.ap-toast {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%);
  background: var(--material-regular);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 300px;
  z-index: 1000;
  animation: toastSlideUp 0.3s ease;
}

@keyframes toastSlideUp {
  from {
    transform: translateX(-50%) translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

.ap-toast__icon {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ap-toast--info .ap-toast__icon {
  background: rgba(0, 122, 255, 0.15);
  color: var(--system-blue);
}

.ap-toast--success .ap-toast__icon {
  background: rgba(52, 199, 89, 0.15);
  color: var(--system-green);
}

.ap-toast--warning .ap-toast__icon {
  background: rgba(255, 149, 0, 0.15);
  color: var(--system-orange);
}

.ap-toast--error .ap-toast__icon {
  background: rgba(255, 59, 48, 0.15);
  color: var(--system-red);
}

.ap-toast__content {
  flex: 1;
}

.ap-toast__title {
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  font-size: var(--text-sm);
  margin-bottom: 2px;
}

.ap-toast__message {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.ap-toast__close {
  background: none;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.ap-toast__close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* ============================================
   ANIMATIONS & TRANSITIONS
   ============================================ */

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

@keyframes ap-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes ap-bounce {
  0%, 20%, 53%, 80%, 100% { transform: translate3d(0, 0, 0); }
  40%, 43% { transform: translate3d(0, -10px, 0); }
  70% { transform: translate3d(0, -5px, 0); }
  90% { transform: translate3d(0, -2px, 0); }
}

@keyframes ap-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ap-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes ap-slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes ap-slide-down {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes ap-zoom-in {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Animation utility classes */
.ap-animate-spin { animation: ap-spin 1s linear infinite; }
.ap-animate-pulse { animation: ap-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.ap-animate-bounce { animation: ap-bounce 1s ease infinite; }
.ap-animate-fade-in { animation: ap-fade-in 0.3s ease forwards; }
.ap-animate-fade-out { animation: ap-fade-out 0.3s ease forwards; }
.ap-animate-slide-up { animation: ap-slide-up 0.3s ease forwards; }
.ap-animate-slide-down { animation: ap-slide-down 0.3s ease forwards; }
.ap-animate-zoom-in { animation: ap-zoom-in 0.3s ease forwards; }
