/* ============================================================
   K-ZICK DESIGN SYSTEM — v1.0
   Personal site & project suite · kzick.dev
   Fragment stylesheet — drop into any K-Zick app.
   Usage: <link rel="stylesheet" href="/css/kzick-styles.css">
   Dark-first: always dark. Add class="dark" to <html>.
   Requires Inter + JetBrains Mono from Google Fonts:
   https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800
     &family=JetBrains+Mono:wght@700&display=swap
   ============================================================ */

/* ── TOKENS & ROOT ── */

html {
  --bg: #0a0f1a;
  --surface: #111820;
  --surface-raised: #1a1f2e;
  --border: #2a2f3e;
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-tertiary: #6b7280;
  --accent: #06b6d4;
  --accent-dark: #0891b2;
  --accent-light: #22d3ee;
  --danger: #f87171;
  --success: #4ade80;
  --glass: rgba(15, 23, 42, 0.8);
  --glass-hover: rgba(15, 23, 42, 0.95);
  --blur: 24px;
  
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: radial-gradient(
    circle at 60% 40%,
    rgba(6, 182, 212, 0.08) 0%,
    rgba(15, 23, 42, 0) 50%
  );
}

/* ── TYPOGRAPHY ── */

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p {
  margin: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-light);
}

code, pre {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9em;
  background-color: var(--surface);
  color: var(--accent-light);
  padding: 0.25em 0.5em;
  border-radius: 4px;
}

pre {
  padding: 1rem;
  overflow-x: auto;
}

/* ── GLASS PANELS ── */

.glass-panel {
  background: var(--glass);
  backdrop-filter: blur(var(--blur));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
}

.glass-panel:hover {
  background: var(--glass-hover);
  border-color: var(--accent);
}

/* ── INTERACTIVE TILES ── */

.app-tile {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.app-tile:hover {
  transform: scale(1.05);
}

.app-tile::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(34, 211, 238, 0.2), transparent 80%);
  opacity: 0;
  transition: opacity 0.3s ease-out;
  pointer-events: none;
}

.app-tile:hover::before {
  opacity: 1;
}

/* ── BUTTONS ── */

button {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease-out;
  font-weight: 600;
}

button.primary {
  background-color: var(--accent);
  color: var(--bg);
}

button.primary:hover {
  background-color: var(--accent-light);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(6, 182, 212, 0.3);
}

button.secondary {
  background-color: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

button.secondary:hover {
  background-color: var(--surface-raised);
  border-color: var(--accent);
}

button.danger {
  background-color: var(--danger);
  color: white;
}

button.danger:hover {
  background-color: #f05252;
  transform: translateY(-2px);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ── INPUTS ── */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.75rem 1rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 8px;
  transition: border-color 0.2s ease-out;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

/* ── TOGGLE SWITCH ── */

.toggle-checkbox {
  appearance: none;
  width: 48px;
  height: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  position: relative;
  transition: background-color 0.2s ease-out;
}

.toggle-checkbox::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: var(--text-primary);
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: left 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toggle-checkbox:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

.toggle-checkbox:checked::after {
  left: 26px;
}

/* ── BADGES ── */

.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background-color: var(--surface-raised);
  color: var(--text-secondary);
  border-radius: 16px;
  font-size: 0.875rem;
  font-weight: 600;
}

.badge.accent {
  background-color: rgba(6, 182, 212, 0.2);
  color: var(--accent-light);
}

.badge.danger {
  background-color: rgba(248, 113, 113, 0.2);
  color: var(--danger);
}

.badge.success {
  background-color: rgba(74, 222, 128, 0.2);
  color: var(--success);
}

/* ── MODALS ── */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-out;
  z-index: 1000;
}

.modal-backdrop.is-open {
  opacity: 1;
  pointer-events: all;
}

.modal-panel {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-backdrop.is-open .modal-panel {
  transform: scale(1);
}

/* ── TOAST ── */

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(200%);
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.5rem;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2000;
  max-width: 90%;
}

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

.toast.success {
  border-color: var(--success);
  color: var(--success);
}

.toast.error {
  border-color: var(--danger);
  color: var(--danger);
}

/* ── SKELETON LOADING ── */

@keyframes skeleton-shimmer {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

.skeleton-card {
  background: linear-gradient(
    90deg,
    var(--surface) 0%,
    var(--surface-raised) 50%,
    var(--surface) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}

/* ── SCROLLBAR ── */

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

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

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ── UTILITIES ── */

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1400px) {
  .grid-3 {
    grid-template-columns: repeat(4, 1fr);
  }
}

.center-content {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
}

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

.flex-col {
  display: flex;
  flex-direction: column;
}

/* ── ANIMATIONS ── */

@keyframes spring-ease {
  0% { transform: translateY(20px); opacity: 0; }
  70% { transform: translateY(-5px); }
  100% { transform: translateY(0); opacity: 1; }
}

.animate-spring {
  animation: spring-ease 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.animate-fade {
  animation: fade-in 0.3s ease-out;
}

/* ── RESPONSIVE ── */

@media (max-width: 768px) {
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  
  .glass-panel {
    padding: 1rem;
  }
  
  button {
    padding: 0.65rem 1.25rem;
  }
}

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