/* MTA Brand DNA — formularz rejestracji firmy */

:root {
  --accent: #AA5D26;
  --accent-light: #C68E4D;
  --bg: #050505;
  --bg-card: #0D0D0D;
  --bg-elevated: #121212;
  --bg-input: #0D0D0D;
  --text: #FFFFFF;
  --muted: #A3A3A3;
  --muted-2: #A5AFBD;
  --border: #3A3A3A;
  --success: #4BDE80;
  --danger: #ef4444;
}

html { scroll-behavior: smooth; }

body {
  font-feature-settings: "ss01", "cv01";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* subtle copper-tinted noise via gradient — premium "filmic" feel */
  background-image:
    radial-gradient(circle at 0% 0%, rgba(170, 93, 38, 0.06), transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(198, 142, 77, 0.04), transparent 50%);
  background-attachment: fixed;
}

/* Animated gradient text — używane w hero h1 */
@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.bg-gradient-to-r.bg-clip-text {
  animation: gradientShift 8s ease infinite;
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* Radial gradient utility (Tailwind nie ma natywnego) */
.bg-gradient-radial {
  background-image: radial-gradient(var(--tw-gradient-stops));
}

/* Date input — fix native browser dark mode */
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7) sepia(1) saturate(3) hue-rotate(15deg);
  cursor: pointer;
  opacity: 0.7;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }

/* Number input — remove arrows on Firefox/Chrome */
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* File input — hide native, custom label handles UI */
input[type="file"] { display: none; }

/* Modern card — glassmorphism + premium depth */
section[data-section] {
  position: relative;
  transition: opacity 0.4s ease, transform 0.4s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  animation: sectionEnter 0.5s ease backwards;
  background:
    linear-gradient(180deg, rgba(20, 16, 12, 0.7) 0%, rgba(10, 10, 10, 0.9) 100%),
    radial-gradient(ellipse at top right, rgba(170, 93, 38, 0.08), transparent 50%);
  background-blend-mode: normal, screen;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 0 0 1px rgba(170, 93, 38, 0.1) inset,
    0 30px 60px -20px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(58, 58, 58, 0.4);
  border-color: transparent !important;
}

/* Top accent line — gradient po górze sekcji */
section[data-section]::before {
  content: '';
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(170, 93, 38, 0.4) 30%, rgba(198, 142, 77, 0.6) 50%, rgba(170, 93, 38, 0.4) 70%, transparent);
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

section[data-section]:focus-within::before { opacity: 1; }

/* Premium glow gdy sekcja zawiera focused input */
section[data-section]:focus-within {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 0 0 1px rgba(170, 93, 38, 0.3) inset,
    0 30px 60px -20px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(170, 93, 38, 0.5),
    0 0 80px -10px rgba(170, 93, 38, 0.25);
}

section[data-section].hidden { opacity: 0; transform: translateY(8px); animation: none; }

/* Section header dot — bigger + ring */
section[data-section] > div:first-child > div:first-child {
  /* sekcja header dot — extra glow */
}

/* H2 in section — modern typography */
section[data-section] h2 {
  letter-spacing: -0.02em;
}

/* Inputs — cleaner premium feel */
input[type="text"], input[type="email"], input[type="tel"], input[type="number"],
input[type="date"], textarea, select {
  background: rgba(8, 8, 8, 0.6) !important;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
input[type="text"]:focus, input[type="email"]:focus, input[type="tel"]:focus,
input[type="number"]:focus, input[type="date"]:focus, textarea:focus, select:focus {
  background: rgba(8, 8, 8, 0.85) !important;
}

@keyframes sectionEnter {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Inputs — modern hover state */
input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="date"],
textarea, select {
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}
input[type="text"]:hover, input[type="email"]:hover, input[type="tel"]:hover,
input[type="number"]:hover, input[type="date"]:hover, textarea:hover, select:hover {
  border-color: #4a4a4a;
}

/* Submit button — pulse subtle */
#submitBtn:not(:disabled):hover {
  transform: translateY(-1px);
}
#submitBtn:active:not(:disabled) {
  transform: translateY(0);
}

/* Select dropdown — option styling (limited browser support) */
select option {
  background: var(--bg-card);
  color: var(--text);
  padding: 12px;
}

/* Shareholder card */
.shareholder-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem;
  transition: border-color 0.2s ease;
}
.shareholder-card:hover { border-color: rgba(170, 93, 38, 0.4); }

/* Suma akcji status */
.shares-sum-ok { color: var(--success); border-color: rgba(25, 195, 125, 0.4) !important; }
.shares-sum-error { color: var(--danger); border-color: rgba(239, 68, 68, 0.5) !important; background: rgba(239, 68, 68, 0.05); }

/* Brreg name status icons */
.status-checking { color: var(--muted); animation: pulse 1.5s ease-in-out infinite; }
.status-ok { color: var(--success); }
.status-taken { color: var(--danger); }

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

/* Shake — used for Brreg "name taken" alert */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.shake-once { animation: shake 0.5s ease-in-out; }

/* Toast slide-in */
#toast.show {
  display: block;
  animation: slideIn 0.3s ease forwards;
}
@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Field-level error UI */
.field-error-msg {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: #fca5a5;
  line-height: 1.3;
}
.field-error-msg::before {
  content: '⚠ ';
  font-weight: 700;
}
.field-invalid,
input.field-invalid,
textarea.field-invalid,
select.field-invalid {
  border-color: rgba(239, 68, 68, 0.7) !important;
  background-color: rgba(239, 68, 68, 0.05) !important;
}
.field-invalid:focus {
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25) !important;
}

/* Disabled / loading state */
button:disabled { cursor: not-allowed; }
.loading {
  position: relative;
  pointer-events: none;
}
.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.3);
  border-radius: inherit;
}

/* ========== MOBILE-FIRST FIXES ========== */

/* iOS Safari — prevent zoom-in on focus (input font-size must be >=16px) */
input[type="text"], input[type="email"], input[type="tel"], input[type="number"],
input[type="date"], textarea, select {
  font-size: 16px;
}
@media (min-width: 640px) {
  input[type="text"], input[type="email"], input[type="tel"], input[type="number"],
  input[type="date"], textarea, select {
    font-size: 15px;
  }
}

/* Touch targets — minimum 44×44px (Apple HIG / WCAG 2.5.5) */
button, label[for], input[type="radio"] + div, input[type="checkbox"] + span {
  min-height: 44px;
}
.shareholder-card .sh-remove,
.board-member-card .bm-remove {
  min-height: 36px; /* dla "Usuń" w kartach OK 36 */
}

/* Bottom safe area — submit button nie pod home indicator iOS */
main {
  padding-bottom: calc(env(safe-area-inset-bottom, 0) + 6rem);
}

/* Section padding — wyzwajamy szerokość na małych ekranach */
section[data-section] {
  padding-left: clamp(1rem, 4vw, 2rem);
  padding-right: clamp(1rem, 4vw, 2rem);
  padding-top: clamp(1.25rem, 4vw, 2rem);
  padding-bottom: clamp(1.25rem, 4vw, 2rem);
}

/* Sticky header — tap-area i z-index */
header { padding-top: env(safe-area-inset-top, 0); }

/* Disable hover effects on touch devices (no hover) */
@media (hover: none) {
  .group:hover > div,
  button:not(:disabled):hover {
    transform: none !important;
    box-shadow: none !important;
  }
}

/* Disable parallax / smooth-scroll on slow devices */
@media (prefers-reduced-motion: reduce), (max-width: 360px) {
  html { scroll-behavior: auto; }
}

/* Very small screens (320-360px) */
@media (max-width: 380px) {
  body { font-size: 14px; }
  h1, h2, h3 { letter-spacing: -0.01em; }
  .max-w-3xl { max-width: 100%; }
  /* Mniejsze gap żeby zmieścić więcej */
  .grid.gap-4 { gap: 0.75rem; }
}

/* Desktop polish — większy padding gdy jest miejsce */
@media (min-width: 1024px) {
  main { padding-top: 1rem; }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* Print — basic */
@media print {
  header, footer, #toast, button[type="submit"] { display: none !important; }
  body { background: white; color: black; }
  section[data-section] { break-inside: avoid; border: 1px solid #ccc !important; background: white !important; }
}

/* Focus-visible — keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Make labels have proper cursor */
label[for] { cursor: pointer; }
