/* Core Styles - Layout, Typography, Spacing */
/* Colors are inherited from theme files via CSS variables */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.layout {
  display: flex;
  height: 100vh;
}

/* Navigation Sidebar */
#menu {
  width: 280px;
  background: linear-gradient(to bottom, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  flex-shrink: 0;
  box-shadow: var(--shadow-lg);
}

#menu::-webkit-scrollbar {
  width: 6px;
}

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

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

#menu::-webkit-scrollbar-thumb:hover {
  background: var(--bg-hover);
}

.home-btn {
  font-size: 28px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg-secondary);
  position: relative;
}

.home-btn::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 40px;
  height: 2px;
  background: var(--accent-primary);
  transition: transform 0.3s ease;
}

.home-btn:hover {
  background: var(--bg-hover);
  transform: scale(1.05);
}

.home-btn:hover::after {
  transform: translateX(-50%) scaleX(1);
}

/* Menu Sections */
.menu-section {
  border-bottom: 1px solid var(--border-color);
}

.menu-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: transparent;
}

.menu-section-header:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.menu-toggle {
  font-size: 10px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-block;
  opacity: 0.6;
}

.menu-section.collapsed .menu-toggle {
  transform: rotate(-90deg);
}

.menu-section-content {
  display: flex;
  flex-direction: column;
  padding: 6px 0;
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-section.collapsed .menu-section-content {
  max-height: 0;
}

.menu-section-content button {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 11px 20px 11px 32px;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
  border-left: 2px solid transparent;
  position: relative;
  font-weight: 400;
}

.menu-section-content button::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent-primary);
  transform: scaleY(0);
  transition: transform 0.2s ease;
}

.menu-section-content button:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  padding-left: 36px;
}

.menu-section-content button.active {
  background: var(--bg-active);
  color: var(--accent-primary);
  font-weight: 500;
}

.menu-section-content button.active::before {
  transform: scaleY(1);
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
}

#top-bar-container {
  background: var(--bg-primary);
  min-height: 0;
}

#content {
  flex: 1;
  overflow-y: auto;
  padding: 56px 40px;
}

#content::-webkit-scrollbar {
  width: 8px;
}

#content::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

#content::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

#content::-webkit-scrollbar-thumb:hover {
  background: var(--bg-hover);
}

/* Tool Content Styles */
.tool-page {
  max-width: 920px;
  margin: 0 auto;
}

.tool-header {
  margin-bottom: 40px;
}

.tool-header h1 {
  font-size: 32px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
  letter-spacing: -0.5px;
}

.tool-header p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 680px;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
}

.tool-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--border-hover);
}

/* Form Groups */
.form-group {
  margin-bottom: 24px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Input Wrapper - Container for outputs with copy buttons */
.input-wrapper {
  position: relative;
  width: 100%;
}

.input-wrapper > input,
.input-wrapper > textarea,
.input-wrapper > pre {
  width: 100%;
}

/* Copy Button */
.copy-button {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  margin-top: 8px;
  width: fit-content;
  margin-left: auto;
}

.copy-button:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.copy-button:active {
  transform: translateY(0);
}

.copy-button.copied {
  background: var(--accent-subtle);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.copy-button svg {
  width: 14px;
  height: 14px;
}

.form-control,
textarea,
input[type="text"],
input[type="number"],
input[type="date"],
select {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px 16px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Courier New', monospace;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

textarea {
  resize: vertical;
  min-height: 140px;
  line-height: 1.6;
}

.form-control:focus,
textarea:focus,
input:focus,
select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-subtle);
  background: var(--bg-primary);
}

.form-control::placeholder,
textarea::placeholder,
input::placeholder {
  color: var(--text-tertiary);
}

.form-control:read-only,
textarea:read-only {
  background: var(--bg-tertiary);
  cursor: not-allowed;
}

/* Output Elements */
pre {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px 16px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Courier New', monospace;
  line-height: 1.6;
  min-height: 140px;
  max-height: 400px;
  overflow-y: auto;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: var(--shadow-sm);
  margin: 0;
}

/* Color Input */
input[type="color"] {
  width: 100%;
  height: 80px;
  cursor: pointer;
  border: 2px solid var(--border-color);
  transition: all 0.2s ease;
}

input[type="color"]:hover {
  border-color: var(--accent-primary);
}

/* Button Groups */
.button-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.btn,
button[type="button"],
button[type="submit"] {
  padding: 12px 24px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background: var(--accent-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:active {
  transform: translateY(0);
}

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

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: translateY(0);
}

/* Home Page */
.home-page {
  text-align: center;
  max-width: 640px;
  margin: 100px auto;
}

.home-page h1 {
  font-size: 56px;
  margin-bottom: 20px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.home-page p {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 48px;
  line-height: 1.7;
}

.home-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 56px;
  text-align: left;
}

.home-feature {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 28px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-md);
}

.home-feature:hover {
  border-color: var(--accent-primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.home-feature h3 {
  font-size: 18px;
  margin-bottom: 10px;
  color: var(--text-primary);
  font-weight: 600;
}

.home-feature p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.6;
}

/* Info Box */
.info-box {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-primary);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
}

.info-box h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-box p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.6;
}

/* Specific tool styling */
#current-time-display {
  font-size: 42px;
  text-align: center;
  padding: 40px;
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  border-radius: 12px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-md);
  font-weight: 300;
  letter-spacing: 2px;
  color: var(--accent-primary);
}

#time-details,
#headers-output,
#ua-info {
  background: var(--bg-secondary);
  padding: 20px;
  border-radius: 10px;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
  font-size: 13px;
  line-height: 1.8;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

/* Search Component Styles */
.top-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
}

.theme-switcher-container {
  position: relative;
}

.theme-switcher {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  min-width: 140px;
}

.theme-switcher:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.theme-switcher:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.search-container {
  position: relative;
  width: auto;
}

.search-input {
  width: 400px;
  max-width: 400px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 16px;
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

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

.search-results {
  position: absolute;
  top: 100%;
  right: 0;
  width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  margin-top: 8px;
  max-height: 400px;
  overflow-y: auto;
  display: none;
  box-shadow: var(--shadow-xl);
  z-index: 1000;
}

.search-results.active {
  display: block;
}

.search-result-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: var(--bg-hover);
}

.search-result-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.search-result-category {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* Selection styling */
::selection {
  background: var(--accent-primary);
  color: white;
}

::-moz-selection {
  background: var(--accent-primary);
  color: white;
}

/* Mobile hamburger menu button - only visible on screens ≤768px */
.hamburger-button {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 1001;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
}

.hamburger-button:hover {
  background: var(--bg-hover);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-lg);
}

.hamburger-button:active {
  transform: scale(0.95);
}

.hamburger-icon {
  width: 24px;
  height: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.hamburger-icon span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hamburger-button.open .hamburger-icon span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.hamburger-button.open .hamburger-icon span:nth-child(2) {
  opacity: 0;
}

.hamburger-button.open .hamburger-icon span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* Menu Overlay - Hidden on Desktop */
.menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.menu-overlay.active {
  opacity: 1;
}

/* Mobile Theme Switcher - Hidden on Desktop */
.mobile-theme-switcher {
  display: none;
}

/* Responsive */
@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }
  
  /* Show hamburger button on mobile */
  .hamburger-button {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Show overlay on mobile when active */
  .menu-overlay {
    display: block;
  }
  
  /* Mobile menu - hidden off-screen by default */
  #menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    max-height: none;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    box-shadow: var(--shadow-lg);
  }
  
  /* Menu visible when open */
  #menu.open {
    transform: translateX(0);
  }
  
  /* Show mobile theme switcher in menu */
  .mobile-theme-switcher {
    display: block;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
  }
  
  .mobile-theme-switcher .theme-switcher {
    width: 100%;
    min-width: auto;
  }
  
  /* Hide search and top bar theme switcher on mobile */
  .search-container {
    display: none;
  }
  
  #top-bar-container {
    display: none;
  }
  
  /* Adjust main content for mobile */
  .main-wrapper {
    width: 100%;
    padding-top: 0;
  }
  
  #content {
    padding: 32px 20px;
  }
  
  .tool-card {
    padding: 24px;
  }
  
  .home-page {
    margin: 60px auto;
  }
  
  .home-page h1 {
    font-size: 40px;
  }
  
  .home-feature-grid {
    grid-template-columns: 1fr;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tool-page {
  animation: fadeIn 0.4s ease;
}

.home-page {
  animation: fadeIn 0.5s ease;
}
