/* Utility Den - Main Stylesheet */
/* Mobile-First Responsive Design */

/* ============================================
   CSS VARIABLES & RESET
   ============================================ */
:root {
  /* Colors */
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --accent: #f59e0b;
  --accent-dark: #d97706;
  --background: #f9fafb;
  --surface: #ffffff;
  --text: #1f2937;
  --text-light: #6b7280;
  --success: #10b981;
  --error: #ef4444;
  --border: #e5e7eb;
  
  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  
  /* Typography */
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-heading: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  
  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  
  /* Transitions */
  --transition: all 0.3s ease;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--background);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: var(--spacing-md);
}

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

p {
  margin-bottom: var(--spacing-md);
}

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

a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */
header {
  background-color: var(--surface);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.logo:hover {
  text-decoration: none;
}

.tagline {
  font-size: 0.875rem;
  color: var(--text-light);
  font-weight: 400;
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: block;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text);
  padding: var(--spacing-sm);
}

/* Navigation */
nav ul {
  list-style: none;
  display: none;
  flex-direction: column;
  gap: var(--spacing-sm);
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  padding: var(--spacing-md);
  box-shadow: var(--shadow-md);
  z-index: 200;
}

nav ul.active {
  display: flex;
}

nav ul li {
  position: relative;
}

nav ul li a {
  display: block;
  padding: var(--spacing-sm) var(--spacing-md);
  color: var(--text);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

nav ul li a:hover {
  background-color: var(--background);
  color: var(--primary);
  text-decoration: none;
}

/* Dropdown Menu */
.dropdown {
  position: relative;
}

.dropdown > a {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.dropdown-icon {
  font-size: 0.75rem;
  transition: transform 0.3s ease;
}

.dropdown.active .dropdown-icon {
  transform: rotate(180deg);
}

.dropdown-menu {
  display: none;
  flex-direction: column;
  gap: 0;
  background: var(--background);
  border-radius: var(--radius-md);
  margin-top: var(--spacing-sm);
  padding: var(--spacing-sm);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.dropdown.active .dropdown-menu {
  display: flex;
  max-height: 600px;
}

.dropdown-menu li {
  list-style: none;
}

.dropdown-menu li a {
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 0.9375rem;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: var(--spacing-lg);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
  text-align: center;
  padding: var(--spacing-2xl) var(--spacing-md);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border-radius: var(--radius-xl);
  margin-bottom: var(--spacing-xl);
}

.hero h1 {
  color: white;
  font-size: 2.5rem;
  margin-bottom: var(--spacing-md);
}

.hero p {
  font-size: 1.125rem;
  opacity: 0.9;
  margin-bottom: 0;
}

/* ============================================
   TOOL GRID
   ============================================ */
.tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
}

.tool-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  cursor: pointer;
  border: 2px solid transparent;
  position: relative;
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.tool-card-icon {
  font-size: 2.5rem;
  margin-bottom: var(--spacing-md);
}

.tool-card h3 {
  margin-bottom: var(--spacing-sm);
  color: var(--primary);
}

.tool-card p {
  color: var(--text-light);
  margin-bottom: 0;
  font-size: 0.9375rem;
}

/* NEW Badge */
.new-badge {
  position: absolute;
  top: var(--spacing-md);
  right: var(--spacing-md);
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  padding: 0.25rem 0.625rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* ============================================
   TOOL CONTAINER
   ============================================ */
.tool-container {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--spacing-xl);
}

.tool-header {
  margin-bottom: var(--spacing-lg);
  border-bottom: 2px solid var(--border);
  padding-bottom: var(--spacing-md);
}

.tool-header h1 {
  margin-bottom: var(--spacing-sm);
}

.tool-description {
  color: var(--text-light);
  font-size: 1rem;
}

/* ============================================
   FORMS & INPUTS
   ============================================ */
.form-group {
  margin-bottom: var(--spacing-lg);
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
  color: var(--text);
}

input, select, textarea {
  width: 100%;
  padding: var(--spacing-md);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: var(--font-body);
  transition: var(--transition);
  background-color: var(--surface);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input[type="number"] {
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

textarea {
  resize: vertical;
  min-height: 100px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-block;
  padding: var(--spacing-md) var(--spacing-xl);
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  font-family: var(--font-body);
}

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

.btn-primary:hover {
  background-color: var(--primary-dark);
  text-decoration: none;
  color: white;
}

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

.btn-accent:hover {
  background-color: var(--accent-dark);
  text-decoration: none;
  color: white;
}

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

.btn-secondary:hover {
  background-color: var(--border);
  text-decoration: none;
}

.btn-block {
  display: block;
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   CONVERTER SPECIFIC
   ============================================ */
.converter-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.conversion-display {
  background: var(--background);
  padding: var(--spacing-lg);
  border-radius: var(--radius-md);
  text-align: center;
  margin-top: var(--spacing-md);
}

.conversion-result {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin: var(--spacing-md) 0;
}

.swap-btn {
  background: none;
  border: 2px solid var(--primary);
  color: var(--primary);
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin: var(--spacing-md) auto;
  font-size: 1.25rem;
  transition: var(--transition);
}

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

/* ============================================
   WEATHER CARD
   ============================================ */
.weather-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: var(--spacing-xl);
  border-radius: var(--radius-lg);
  margin-bottom: var(--spacing-lg);
}

.weather-current {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

.weather-icon {
  font-size: 4rem;
}

.weather-temp {
  font-size: 3rem;
  font-weight: 700;
}

.weather-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-md);
}

.weather-detail {
  background: rgba(255, 255, 255, 0.1);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
}

.forecast-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-md);
}

.forecast-item {
  background: var(--surface);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ============================================
   ALERTS & NOTIFICATIONS
   ============================================ */
.alert {
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-md);
  border-left: 4px solid;
}

.alert-info {
  background-color: #dbeafe;
  border-color: var(--primary);
  color: var(--primary-dark);
}

.alert-success {
  background-color: #d1fae5;
  border-color: var(--success);
  color: #065f46;
}

.alert-error {
  background-color: #fee2e2;
  border-color: var(--error);
  color: #991b1b;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--text);
  color: white;
  padding: var(--spacing-md) var(--spacing-xl);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  transition: bottom 0.3s ease;
}

.toast.show {
  bottom: var(--spacing-xl);
}

/* ============================================
   FUN FACT
   ============================================ */
.fun-fact {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  padding: var(--spacing-lg);
  border-radius: var(--radius-md);
  margin: var(--spacing-xl) 0;
  border-left: 4px solid var(--accent);
}

.fun-fact::before {
  content: "💡 ";
  font-size: 1.5rem;
}

/* ============================================
   AD CONTAINERS
   ============================================ */
.ad-placeholder {
  margin: var(--spacing-xl) 0;
  text-align: center;
}

.ad-placeholder-disabled {
  background-color: var(--background);
  padding: var(--spacing-xl);
  border-radius: var(--radius-md);
  color: var(--text-light);
  border: 2px dashed var(--border);
}

.ad-container {
  margin: var(--spacing-md) 0;
}

/* ============================================
   FOOTER
   ============================================ */
footer {
  background-color: var(--text);
  color: white;
  padding: var(--spacing-xl) var(--spacing-md);
  margin-top: auto;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  list-style: none;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.8);
}

.footer-links a:hover {
  color: white;
}

/* ============================================
   404 PAGE
   ============================================ */
.error-page {
  text-align: center;
  padding: var(--spacing-2xl) var(--spacing-md);
}

.error-code {
  font-size: 6rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: var(--spacing-md);
}

/* ============================================
   PASSWORD GENERATOR
   ============================================ */
.strength-meter {
  height: 0.5rem;
  background: var(--border);
  border-radius: var(--radius-md);
  margin: var(--spacing-md) 0;
  overflow: hidden;
  position: relative;
}

.strength-meter::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  transition: var(--transition);
}

.strength-weak::after {
  width: 33%;
  background: var(--error);
}

.strength-medium::after {
  width: 66%;
  background: var(--accent);
}

.strength-strong::after {
  width: 100%;
  background: var(--success);
}

.password-options label {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
  cursor: pointer;
}

.password-options input[type="checkbox"] {
  width: auto;
  cursor: pointer;
}

.slider-container {
  margin: var(--spacing-md) 0;
}

input[type="range"] {
  width: 100%;
  height: 0.5rem;
  border-radius: var(--radius-md);
  background: var(--border);
  outline: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
}

/* ============================================
   COLOR PICKER
   ============================================ */
.color-preview {
  width: 100%;
  height: 8rem;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  margin: var(--spacing-md) 0;
}

input[type="color"] {
  width: 100%;
  height: 3rem;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
}

/* ============================================
   UTILITIES
   ============================================ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--spacing-md); }
.mb-2 { margin-bottom: var(--spacing-lg); }
.mb-3 { margin-bottom: var(--spacing-xl); }

.mt-1 { margin-top: var(--spacing-md); }
.mt-2 { margin-top: var(--spacing-lg); }
.mt-3 { margin-top: var(--spacing-xl); }

/* ============================================
   RESPONSIVE - TABLET
   ============================================ */
@media (min-width: 768px) {
  h1 { font-size: 2.5rem; }
  h2 { font-size: 2rem; }
  
  .mobile-menu-btn {
    display: none;
  }
  
  nav ul {
    display: flex;
    flex-direction: row;
    position: static;
    box-shadow: none;
    padding: 0;
    background: none;
  }
  
  /* Desktop Dropdown */
  .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm);
    margin-top: var(--spacing-sm);
    display: none;
    flex-direction: column;
    z-index: 300;
  }
  
  .dropdown:hover .dropdown-menu,
  .dropdown.active .dropdown-menu {
    display: flex;
    max-height: none;
  }
  
  .dropdown-menu li a {
    white-space: nowrap;
  }
  
  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .converter-controls {
    grid-template-columns: 1fr auto 1fr;
    align-items: end;
  }
  
  .forecast-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  main {
    padding: var(--spacing-xl);
  }
}

/* ============================================
   RESPONSIVE - DESKTOP
   ============================================ */
@media (min-width: 1024px) {
  h1 { font-size: 3rem; }
  
  .hero h1 {
    font-size: 3.5rem;
  }
  
  .tools-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .forecast-grid {
    grid-template-columns: repeat(5, 1fr);
  }
  
  .weather-details {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  header, footer, .ad-placeholder, .btn {
    display: none;
  }
}
