/* ==========================================
   KIOSK – COMMON STYLES
   Shared styles for both home and reader pages
   ========================================== */

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

:root {
  /* Glassmorphism theme - Light Mode (White & Red) */
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-bg-dark: rgba(255, 255, 255, 0.6);
  --glass-border: rgba(220, 220, 220, 0.5);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
  --glass-shadow-lg: 0 15px 50px 0 rgba(0, 0, 0, 0.15);
  
  --primary-bg: rgba(255, 255, 255, 0.98);
  --secondary-bg: rgba(250, 250, 250, 0.8);
  --tertiary-bg: rgba(245, 245, 245, 0.6);
  --border-color: rgba(230, 230, 230, 0.6);
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --text-muted: #999999;
  --accent-color: #dc2626;
  --accent-hover: #b91c1c;
  --accent-glow: rgba(220, 38, 38, 0.25);
  --success-color: #16a34a;
  --warning-color: #ea580c;
  --danger-color: #dc2626;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --transition: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 400ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Dark Mode - Black background, white PDF pages */
body[data-theme="dark"],
body[data-theme="auto"][data-system-theme="dark"] {
  --glass-bg: rgba(26, 26, 26, 0.85);
  --glass-bg-dark: rgba(26, 26, 26, 0.65);
  --glass-border: rgba(60, 60, 60, 0.5);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  --glass-shadow-lg: 0 15px 50px 0 rgba(0, 0, 0, 0.7);
  
  --primary-bg: rgba(18, 18, 18, 0.98);
  --secondary-bg: rgba(26, 26, 26, 0.8);
  --tertiary-bg: rgba(35, 35, 35, 0.6);
  --border-color: rgba(60, 60, 60, 0.6);
  --text-primary: #f5f5f5;
  --text-secondary: #a3a3a3;
  --text-muted: #737373;
  --accent-color: #ef4444;
  --accent-hover: #f87171;
  --accent-glow: rgba(239, 68, 68, 0.3);
  --success-color: #22c55e;
  --warning-color: #f97316;
  --danger-color: #ef4444;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
}

/* Night Mode - Black background AND inverted PDF */
body[data-theme="night"],
body[data-theme="auto"][data-system-theme="night"] {
  --glass-bg: rgba(26, 26, 26, 0.85);
  --glass-bg-dark: rgba(26, 26, 26, 0.65);
  --glass-border: rgba(60, 60, 60, 0.5);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  --glass-shadow-lg: 0 15px 50px 0 rgba(0, 0, 0, 0.7);
  
  --primary-bg: rgba(18, 18, 18, 0.98);
  --secondary-bg: rgba(26, 26, 26, 0.8);
  --tertiary-bg: rgba(35, 35, 35, 0.6);
  --border-color: rgba(60, 60, 60, 0.6);
  --text-primary: #f5f5f5;
  --text-secondary: #a3a3a3;
  --text-muted: #737373;
  --accent-color: #ef4444;
  --accent-hover: #f87171;
  --accent-glow: rgba(239, 68, 68, 0.3);
  --success-color: #22c55e;
  --warning-color: #f97316;
  --danger-color: #ef4444;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Dark/Night mode body background */
body[data-theme="dark"],
body[data-theme="night"],
body[data-theme="auto"][data-system-theme="dark"],
body[data-theme="auto"][data-system-theme="night"] {
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
}

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

/* Buttons */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  outline: none;
  transition: all var(--transition);
}

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

.btn {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary {
  background: var(--accent-color);
  color: white;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-secondary {
  background: var(--tertiary-bg);
  color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border-color);
}

.icon-button {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  -webkit-backdrop-filter: blur(0px);
  backdrop-filter: blur(0px);
  transition: all var(--transition);
}

.icon-button:hover {
  background: var(--glass-bg-dark);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--text-primary);
  transform: scale(1.05);
}

.icon-button svg {
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Input fields */
input[type="text"],
input[type="search"] {
  font-family: inherit;
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--primary-bg);
  color: var(--text-primary);
  transition: all var(--transition);
}

input[type="text"]:focus,
input[type="search"]:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Utility classes */
.text-muted {
  color: var(--text-muted);
}

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

.text-small {
  font-size: 0.75rem;
}

.text-medium {
  font-size: 0.875rem;
}

.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

/* Status indicators */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.5rem;
}

.status-dot.saved {
  background: var(--success-color);
}

.status-dot.unsaved {
  background: var(--warning-color);
}

.status-dot.saving {
  background: var(--accent-color);
  animation: pulse 1.5s ease-in-out infinite;
}

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

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

::-webkit-scrollbar-track {
  background: var(--secondary-bg);
}

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

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