/* ============================================
   Sakadang Tools — Shared Design System
   ============================================ */

/* --- Google Font Import --- */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;500;600;700;800&display=swap');

/* --- CSS Custom Properties --- */
:root {
  /* Colors — Dark Theme */
  --bg-primary: #07070e;
  --bg-secondary: #0e0e1a;
  --bg-surface: #141428;
  --bg-elevated: #1c1c3a;
  --bg-hover: #24244a;

  /* Accent */
  --accent: #00d4ff;
  --accent-hover: #33ddff;
  --accent-glow: rgba(0, 212, 255, 0.15);
  --accent-secondary: #7c3aed;
  --accent-secondary-hover: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #00d4ff, #7c3aed);
  --accent-gradient-vivid: linear-gradient(135deg, #00d4ff 0%, #7c3aed 50%, #ec4899 100%);

  /* Text */
  --text-primary: #eaeaf2;
  --text-secondary: #9898b4;
  --text-muted: #5a5a78;
  --text-inverse: #07070e;

  /* Borders */
  --border: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.1);
  --border-accent: rgba(0, 212, 255, 0.3);

  /* Status */
  --danger: #ef4444;
  --danger-hover: #f87171;
  --success: #22c55e;
  --warning: #f59e0b;

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(0, 212, 255, 0.1);

  /* Glass */
  --glass-bg: rgba(20, 20, 40, 0.6);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur: blur(24px);
  /* Transitions */
  --transition-fast: 120ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Typography */
  --font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-xs: 0.7rem;
  --font-size-sm: 0.8rem;
  --font-size-base: 0.9rem;
  --font-size-lg: 1.05rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.6rem;
  --font-size-3xl: 2.2rem;
  --font-size-4xl: 3.2rem;
}

[data-theme="light"] {
  /* Colors — Light Theme */
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-elevated: #e2e8f0;
  --bg-hover: #e2e8f0;

  /* Text */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;
  
  /* Gradients for Light Mode */
  --accent-gradient: linear-gradient(135deg, #0284c7, #6d28d9);
  --accent-gradient-vivid: linear-gradient(135deg, #0284c7 0%, #6d28d9 50%, #be185d 100%);

  /* Borders */
  --border: rgba(0, 0, 0, 0.1);
  --border-light: rgba(0, 0, 0, 0.05);
  --border-accent: rgba(0, 212, 255, 0.5);

  /* Glass */
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(0, 0, 0, 0.08);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  font-family: var(--font-family);
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  font-size: inherit;
}

input, select {
  font-family: var(--font-family);
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition-fast);
}

input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* --- Utility Classes --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Shared Button Styles --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-gradient);
  color: var(--text-inverse);
  font-weight: 600;
}

.btn-primary:hover {
  opacity: 0.9;
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.4);
}

/* --- Glass Panel --- */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
}

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* --- Selection --- */
::selection {
  background: rgba(0, 212, 255, 0.3);
  color: var(--text-primary);
}

/* Utility Classes */
.hidden { display: none !important; }

/* ============================================
   Universal App Toolbar
   ============================================ */
.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-primary);
}

.app-toolbar {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.toolbar-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: transparent;
  transition: all 0.2s;
  text-decoration: none;
}
.toolbar-back:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

.toolbar-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
}

.toolbar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
}
.toolbar-title .brand { color: var(--text-primary); }
.toolbar-title .sep { color: var(--text-muted); }
.toolbar-title .tool-name { color: var(--accent); }

.toolbar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.toolbar-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}
.toolbar-btn.primary {
  background: var(--accent);
  color: #000;
  border: none;
}
.toolbar-btn.primary:hover {
  opacity: 0.9;
  box-shadow: var(--shadow-glow);
}
.toolbar-btn.small {
  padding: 8px;
  width: 36px;
  height: 36px;
  justify-content: center;
}
