/* UI components for ICARUS blog */

/* Buttons */
.btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 14px;
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--fg) 8%, transparent);
  color: var(--fg);
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 15px;
  line-height: 1;
  text-decoration: none !important;
  cursor: pointer;
  transition: border-color 180ms ease, box-shadow 160ms ease;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  transition: opacity 180ms ease;
  pointer-events: none;
  border-radius: inherit;
}

.btn:active { transform: none; }
.btn[disabled], .btn.is-disabled { opacity: 0.6; cursor: not-allowed; }

.btn.primary {
  background: #111 !important;
  border-radius: 999px;
  border: 1px solid #111 !important;
  color: #fff !important;
}

.btn.primary:visited {
  color: #fff !important;
  opacity: 1 !important;
}

.btn.primary:hover { border-color: #000 !important; filter: brightness(0.95); }
.btn.primary:active { filter: brightness(0.9); }
.btn.primary:hover::before { opacity: 0; }
.btn.primary:active::before { opacity: 0; }

.btn.secondary {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.btn.secondary, .btn.secondary:hover, .btn.secondary:visited { color: var(--fg) !important; }
.btn.secondary:hover { border: 1px solid rgba(0, 0, 0, 0.14); }
.btn.secondary:active { border: 1px solid rgba(0, 0, 0, 0.18); }
.btn.secondary:hover::before { opacity: 0.02; }
.btn.secondary:active::before { opacity: 0.05; }

.btn.ghost {
  background: transparent;
  border-color: color-mix(in srgb, var(--fg) 12%, transparent);
}

.btn.plain {
  background: transparent;
  border-color: transparent !important;
  color: var(--fg);
}

.btn.plain, .btn.plain:hover, .btn.plain:visited { color: var(--fg) !important; }
.btn.plain::before { display: none; }
.btn.plain:hover, .btn.plain:focus-visible {
  background: rgba(0, 0, 0, 0.04);
}
.btn.plain:active {
  background: rgba(0, 0, 0, 0.08);
}

/* Size variants */
.btn.small, .btn.sm { min-height: 32px; padding: 0 12px; border-radius: 8px; }
.btn.standard { min-height: 36px; padding: 0 14px; border-radius: 8px; }
.btn.big, .btn.lg { font-size: 16px; min-height: 40px; padding: 0 18px; border-radius: 100px; }

/* Input styles */
.input, input.input, input[type="text"], input[type="email"], input[type="search"], input[type="number"], input[type="url"], input[type="password"], textarea.input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--fg) 15%, transparent);
  background: color-mix(in srgb, var(--bg) 96%, var(--fg) 4%);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 1rem;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.input:focus, input:focus, textarea:focus {
  border-color: color-mix(in srgb, var(--blue) 50%, var(--fg) 50%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 15%, transparent);
}

.input.invalid { border-color: var(--red); }

.field { display: grid; gap: 0.35rem; }
.field label { font-family: var(--font-sans); color: var(--fg2); font-size: 0.95rem; }
.field .error { color: var(--red); font-size: 0.92rem; }

/* Cards */
.card {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 0.5rem;
  padding: 1.1rem;
  margin: 0.75rem 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card-header {
  font-weight: 600;
  font-size: 1.125rem;
  margin-bottom: 0.75rem;
  color: #000;
}

.card-body {
  color: #666;
  line-height: 1.6;
}

/* Alerts */
.alert {
  padding: 0.75rem;
  margin: 0.75rem 0;
  border-radius: 0.375rem;
  border: 1px solid transparent;
}

.alert-info {
  background: #e7f3ff;
  border-color: #b3d9ff;
  color: #0066cc;
}

.alert-warning {
  background: #fff3cd;
  border-color: #ffeaa7;
  color: #856404;
}

.alert-error {
  background: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}

.alert-success {
  background: #d4edda;
  border-color: #c3e6cb;
  color: #155724;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 0.25rem;
  background: #6b7280;
  color: #fff;
}

.badge-primary {
  background: #007f86;
}

.badge-secondary {
  background: #6b7280;
}

.badge-success {
  background: #28a745;
}

.badge-warning {
  background: #ffc107;
  color: #000;
}

.badge-error {
  background: #dc3545;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: #333;
}

.form-input {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  line-height: 1.5;
  color: #333;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  transition: border-color 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: #007f86;
  box-shadow: 0 0 0 3px rgba(0, 127, 134, 0.1);
}

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

.form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

/* Navigation */
.nav {
  display: flex;
  flex-wrap: wrap;
  padding-left: 0;
  margin-bottom: 0;
  list-style: none;
}

.nav-item {
  margin-right: 1rem;
}

.nav-link {
  display: block;
  padding: 0.35rem 0;
  color: #666;
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: #000;
}

.nav-link.active {
  color: #007f86;
  font-weight: 500;
}

/* Breadcrumbs */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  padding: 0;
  margin: 0 0 0.75rem 0;
  list-style: none;
  font-size: 0.875rem;
  color: #666;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: ">";
  margin: 0 0.5rem;
  color: #999;
}

.breadcrumb-item a {
  color: #007f86;
  text-decoration: none;
}

.breadcrumb-item a:hover {
  text-decoration: underline;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 1.25rem 0;
}

.pagination .btn {
  margin: 0 0.25rem;
}

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

/* Loading states */
.loading {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #007f86;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Tooltips */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltip-text {
  visibility: hidden;
  width: 200px;
  background-color: #333;
  color: #fff;
  text-align: center;
  border-radius: 0.375rem;
  padding: 0.5rem;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -100px;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 0.875rem;
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Responsive utilities */
@media (max-width: 768px) {
  .btn {
    padding: 0.75rem 1rem;
    font-size: 1rem;
  }
  
  .card {
    padding: 1rem;
    margin: 0.5rem 0;
  }
  
  .nav {
    flex-direction: column;
  }
  
  .nav-item {
    margin-right: 0;
    margin-bottom: 0.5rem;
  }
}
