/* 
 * style.css - Clean & Accessible Design System
 * Focus: Eye-friendly backgrounds, distraction-free interface
 * Updated: 2026-01-23 (Soft Blue Theme)
 */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&family=Noto+Sans+JP:wght@300;400;700&display=swap');

:root {
  /* Universal Design Palette - Soft Blue Edition */
  --primary-color: #4a90e2;
  --primary-color-rgb: 74, 144, 226;
  /* Soft Blue - Professional and eye-friendly */
  --secondary-color: #007d32;
  /* Rich Green - Kept for contrast */
  --accent-color: #d10000;
  /* Deep Red - Kept for visibility */

  --primary-gradient: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
  --secondary-gradient: linear-gradient(135deg, #007d32 0%, #004d1f 100%);
  --accent-gradient: linear-gradient(135deg, #d10000 0%, #800000 100%);

  --glass-bg: rgba(255, 255, 255, 0.98);
  /* Increased opacity for maximum legibility */
  --glass-border: rgba(0, 0, 0, 0.2);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.08);

  --bg-light: #f4f7f9;
  /* Slightly cooler, very soft background */
  --text-primary: #0f172a;
  /* Near-black for maximum contrast */
  --text-secondary: #475569;
  /* Balanced slate for secondary info */

  /* Neutral tones for accessible background */
  --bg-subtle: #ebf0f3;
  --bg-input: #ffffff;
}

body.dark-mode {
  --glass-bg: rgba(30, 30, 30, 0.95);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 4px 24px 0 rgba(0, 0, 0, 0.6);

  --bg-light: #0f1115;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;

  --bg-subtle: #1a1d23;
  --bg-input: #1e222a;
}

/* Base Styles */
/* Main Background */
body {
  font-family: 'Outfit', 'Noto Sans JP', sans-serif;
  color: var(--text-primary);
  background-color: var(--bg-light);
  background-image: linear-gradient(to bottom, var(--bg-subtle) 0%, var(--bg-light) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  margin: 0;
  transition: background-color 0.5s ease, color 0.5s ease;
  overflow-x: hidden;
  position: relative;
  font-size: 1.05rem;
  line-height: 1.7;
}

/* Clear Focus Rings for Accessibility */
:focus-visible {
  outline: 3px solid var(--primary-color) !important;
  outline-offset: 2px;
}

/* Navbar */
.navbar {
  background: var(--glass-bg) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar-brand {
  font-weight: 700;
  letter-spacing: -0.5px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 1.5rem;
}

.nav-link {
  color: var(--text-secondary) !important;
  font-weight: 500;
  margin: 0 0.15rem;
  padding: 0.5rem 0.8rem !important;
  border-radius: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 0;
  overflow: hidden;
  white-space: nowrap;
}

/* Theme Toggle Button - Icon Only Premium */
.theme-toggle-btn {
  background: rgba(var(--primary-color-rgb, 74, 144, 226), 0.08);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  margin-left: 0.5rem;
}

.theme-toggle-btn:hover {
  background: rgba(var(--primary-color-rgb, 74, 144, 226), 0.15);
  color: var(--primary-color);
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.2);
}

.theme-toggle-btn .material-icons {
  font-size: 22px;
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.theme-toggle-btn:active {
  transform: scale(0.95);
}

body.dark-mode .theme-toggle-btn {
  background: rgba(74, 144, 226, 0.12);
  color: var(--primary-color);
}

.nav-link .material-icons {
  font-size: 22px;
  transition: transform 0.3s ease;
}

.nav-text {
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  display: inline-block;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.9rem;
  margin-left: 0;
}

.nav-link:hover {
  color: var(--text-primary) !important;
  background: rgba(74, 144, 226, 0.1);
  gap: 8px;
}

.nav-link:hover .nav-text {
  max-width: 150px;
  opacity: 1;
  margin-left: 4px;
}

.nav-link:hover .material-icons {
  color: var(--primary-color);
  transform: scale(1.1);
}

/* Dropdown on Click (Bootstrap Default) */
.dropdown-menu.show {
  display: block;
  margin-top: 0;
  animation: dropdown-fade-in 0.3s ease;
}

@keyframes dropdown-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-toggle::after {
  display: inline-block !important;
  vertical-align: middle;
  margin-left: 4px;
  content: "";
  border-top: 0.3em solid;
  border-right: 0.3em solid transparent;
  border-bottom: 0;
  border-left: 0.3em solid transparent;
  opacity: 0.5;
  transition: transform 0.3s ease;
}

.dropdown-toggle.show::after {
  transform: rotate(180deg);
}

.dropdown-menu {
  border-radius: 16px !important;
  padding: 0.5rem !important;
  min-width: 180px;
}

.dropdown-item {
  border-radius: 8px;
  transition: all 0.2s ease;
}

.dropdown-item:hover {
  background-color: rgba(74, 144, 226, 0.1);
  color: var(--primary-color);
}

/* On mobile, show text/labels normally or keep icons large */
@media (max-width: 991px) {
  .nav-text {
    max-width: none;
    opacity: 1;
    margin-left: 8px;
  }

  .nav-link {
    gap: 8px;
    margin: 0.2rem 0;
  }
}

/* Cards & Containers */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: var(--glass-shadow);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.25);
}

.header-section {
  padding: 4rem 1rem;
  text-align: center;
}

.header-section h1 {
  font-weight: 800;
  font-size: 3.5rem;
  margin-bottom: 1rem;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--primary-color);
  /* Fallback */
}

/* Buttons */
.btn {
  border-radius: 16px;
  padding: 0.6rem 1.5rem;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
  filter: brightness(1.1);
}

.btn-outline-secondary {
  background: var(--glass-bg);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}

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

/* Forms */
.form-control,
.form-select {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 0.8rem 1.2rem;
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
  background: var(--glass-bg);
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(0, 82, 163, 0.15);
  color: var(--text-primary);
}

/* Icons */
.material-icons {
  vertical-align: middle;
}

/* Special Components */
.result-wrapper {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  padding: 1.5rem;
  position: relative;
}

/* Loading States */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(var(--bg-light), 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.loading-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.spinner-premium {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(74, 144, 226, 0.1);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Shimmer Animation for Empty States */
.shimmer {
  background: linear-gradient(90deg, transparent 25%, rgba(0, 0, 0, 0.05) 50%, transparent 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

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

  to {
    background-position: 200% 0;
  }
}

/* Theme Logic Styles */
.theme-toggle-btn:hover .material-icons {
  transform: rotate(15deg) scale(1.1);
}

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

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

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
  border: 3px solid var(--bg-light);
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Diff tool specific styles */
.diff-delete {
  background-color: rgba(244, 63, 94, 0.2);
  color: #e11d48;
  text-decoration: line-through;
  padding: 0 2px;
}

.diff-insert {
  background-color: rgba(45, 212, 191, 0.2);
  color: #0d9488;
  padding: 0 2px;
}

.diff-container {
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.6;
}

/* Markdown specific */
.editor-toolbar {
  background: rgba(0, 0, 0, 0.02);
  display: flex;
  gap: 4px;
  padding: 8px;
  flex-wrap: wrap;
}

/* Responsive */
@media (max-width: 768px) {
  .header-section h1 {
    font-size: 2rem;
  }
}