/* iOS Safari viewport fix - override h-screen with dvh */
/* h-screen uses 100vh which is taller than visible area on iOS */
.h-screen {
  height: 100dvh;
}

/* Fallback for older browsers that don't support dvh */
@supports not (height: 100dvh) {
  .h-screen {
    height: 100vh;
    height: -webkit-fill-available;
  }
}

/* Ensure html/body fill viewport without extra space */
html, body {
  height: 100%;
  overflow: hidden;
}

/* Cyberpunk corner cut cards */
.cyber-card {
  position: relative;
  clip-path: polygon(
    12px 0,
    100% 0,
    100% calc(100% - 12px),
    calc(100% - 12px) 100%,
    0 100%,
    0 12px
  );
}

/* Top-left corner accent */
.cyber-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 17px;
  height: 2px;
  background: #00ff88;
  transform: rotate(-45deg);
  transform-origin: 0 0;
  z-index: 10;
}

/* Bottom-right corner accent */
.cyber-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 17px;
  height: 2px;
  background: #00ff88;
  transform: rotate(-45deg);
  transform-origin: 100% 100%;
  z-index: 10;
}

/* Table and modal - corner cuts only, no accent lines */
.cyber-table,
.cyber-modal {
  clip-path: polygon(
    12px 0,
    100% 0,
    100% calc(100% - 12px),
    calc(100% - 12px) 100%,
    0 100%,
    0 12px
  );
}

/* Smaller corner cuts for buttons and inputs */
.cyber-btn {
  clip-path: polygon(
    6px 0,
    100% 0,
    100% calc(100% - 6px),
    calc(100% - 6px) 100%,
    0 100%,
    0 6px
  );
}

/* Number input spinner styling */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  appearance: none;
  background: #1c1c2e;
  border-left: 1px solid #2a2a3a;
  width: 1.5rem;
  height: 100%;
  position: absolute;
  right: 0;
  top: 0;
  cursor: pointer;
  opacity: 1;
}

/* Hide default spinners and use custom approach */
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

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

/* Cyberpunk checkbox styling */
input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 1rem;
  height: 1rem;
  background-color: #12121a;
  border: 1px solid #2a2a3a;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
  clip-path: polygon(
    3px 0,
    100% 0,
    100% calc(100% - 3px),
    calc(100% - 3px) 100%,
    0 100%,
    0 3px
  );
}

input[type="checkbox"]:hover {
  border-color: #00ff88;
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.3);
}

input[type="checkbox"]:checked {
  background-color: #00ff88;
  border-color: #00ff88;
}

input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  font-weight: bold;
  color: #0a0a0f;
  line-height: 1;
}

input[type="checkbox"]:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.2), 0 0 8px rgba(0, 255, 136, 0.3);
}

/* Toggle switch - hide the checkbox input, override global checkbox styles */
input[type="checkbox"].toggle-input {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: none;
  border: 0;
  background: none;
}

input[type="checkbox"].toggle-input:hover {
  box-shadow: none;
}

input[type="checkbox"].toggle-input:checked {
  background: none;
}

input[type="checkbox"].toggle-input:checked::after {
  content: none;
}

/* Toggle switch track */
.toggle-track {
  position: relative;
  width: 2.75rem;
  height: 1.5rem;
  background-color: #1c1c2e;
  border: 1px solid #2a2a3a;
  border-radius: 9999px;
  transition: all 0.2s ease;
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 2px;
  transform: translateY(-50%);
  width: 1.125rem;
  height: 1.125rem;
  background-color: #6b7280;
  border: 1px solid #2a2a3a;
  border-radius: 9999px;
  transition: all 0.2s ease;
}

.toggle-input:checked ~ .toggle-track {
  background-color: rgba(0, 255, 136, 0.2);
  border-color: rgba(0, 255, 136, 0.5);
}

.toggle-input:checked ~ .toggle-track::after {
  transform: translateX(100%) translateY(-50%);
  background-color: #00ff88;
  border-color: #00ff88;
}

/* Align checkbox with adjacent label */
input[type="checkbox"] + label {
  margin-bottom: 0 !important;
  line-height: 1rem;
}

/* Cyberpunk grid background */
.cyber-grid {
  position: relative;
  background-color: #0a0a0f;
  background-image:
    /* Main grid lines */
    linear-gradient(rgba(0, 255, 136, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 136, 0.03) 1px, transparent 1px),
    /* Larger grid squares */
    linear-gradient(rgba(0, 255, 136, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 136, 0.05) 1px, transparent 1px),
    /* Subtle radial glow in corners */
    radial-gradient(ellipse at 0% 0%, rgba(0, 255, 136, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 100% 100%, rgba(255, 0, 255, 0.05) 0%, transparent 50%);
  background-size:
    25px 25px,
    25px 25px,
    100px 100px,
    100px 100px,
    100% 100%,
    100% 100%;
  background-position:
    0 0,
    0 0,
    0 0,
    0 0,
    0 0,
    0 0;
}

/* Optional scanline overlay effect */
.cyber-grid::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.1) 2px,
    rgba(0, 0, 0, 0.1) 4px
  );
  pointer-events: none;
  z-index: 9999;
  opacity: 0.3;
}
