/* ═══════════════════════════════════════════════
   Ákotí Forms — Input & Form Token System
   CSS-first. Every input, select, textarea.
   ═══════════════════════════════════════════════ */

/* ═══ BASE INPUT ═══ */
.ak-input {
  width: 100%;
  padding: 8px 12px;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #1e1e24;
  background: white;
  border: 1.5px solid rgba(26,47,94,0.12);
  border-radius: 14px 5px 14px 5px;
  outline: none;
  transition: border-color 0.2s, border-radius 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.ak-input::placeholder { color: #8a8a96; font-weight: 400; }

.ak-input:hover { border-color: rgba(26,47,94,0.2); }

.ak-input:focus {
  border-color: #a8c8e8;
  border-radius: 5px 14px 5px 14px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.04);
}

/* Error state */
.ak-input.ak-error {
  border-color: #C62828;
  background: rgba(198,40,40,0.02);
}
.ak-input.ak-error:focus {
  border-color: #C62828;
  box-shadow: inset 0 2px 4px rgba(198,40,40,0.06);
}

/* Success state */
.ak-input.ak-valid {
  border-color: #2D6A4F;
}

/* Disabled */
.ak-input:disabled, .ak-input[readonly] {
  background: rgba(26,47,94,0.02);
  color: #8a8a96;
  cursor: default;
  border-color: rgba(26,47,94,0.06);
}

/* Sizes */
.ak-input-sm { padding: 5px 8px; font-size: 11px; }
.ak-input-lg { padding: 10px 14px; font-size: 15px; }

/* ═══ NUMBER / CURRENCY ═══ */
.ak-number {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: 'DM Sans', 'Outfit', system-ui, sans-serif;
}
.ak-number-positive { color: #2D6A4F; }
.ak-number-negative { color: #C62828; }

/* ═══ SEARCH ═══ */
.ak-search-wrap { position: relative; }
.ak-search {
  padding-left: 32px;
  padding-right: 32px;
}
.ak-search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: #8a8a96; pointer-events: none;
}
.ak-search-icon svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.ak-search-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; border: none; background: rgba(26,47,94,0.06);
  border-radius: 50%; color: #8a8a96; cursor: pointer; font-size: 10px;
  display: none; align-items: center; justify-content: center; padding: 0;
}
.ak-search-clear:hover { background: rgba(232,180,184,0.2); color: #C62828; }
.ak-search:not(:placeholder-shown) ~ .ak-search-clear { display: flex; }

/* ═══ SELECT ═══ */
.ak-select {
  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 24 24' fill='none' stroke='%238a8a96' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}

/* ═══ TEXTAREA ═══ */
.ak-textarea {
  min-height: 80px;
  resize: vertical;
  line-height: 1.6;
}

/* ═══ LABEL ═══ */
.ak-label {
  display: block;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #4a4a56;
  margin-bottom: 4px;
}
.ak-label-required::after { content: ' *'; color: #C62828; }

/* ═══ HELP TEXT ═══ */
.ak-help { font-size: 10px; color: #8a8a96; margin-top: 3px; }
.ak-help-error { color: #C62828; }

/* ═══ FIELD GROUP ═══ */
.ak-field { margin-bottom: 14px; }

/* ═══ INPUT GROUP (prefix/suffix) ═══ */
.ak-input-group {
  display: flex;
  align-items: stretch;
}
.ak-input-group .ak-input {
  border-radius: 0;
  flex: 1;
}
.ak-input-group .ak-input:first-child { border-radius: 14px 0 0 5px; }
.ak-input-group .ak-input:last-child { border-radius: 0 5px 14px 0; }
.ak-input-prefix, .ak-input-suffix {
  display: flex; align-items: center; padding: 0 10px;
  font-size: 12px; font-weight: 600; color: #8a8a96;
  background: rgba(26,47,94,0.03);
  border: 1.5px solid rgba(26,47,94,0.12);
  white-space: nowrap;
}
.ak-input-prefix { border-right: none; border-radius: 14px 0 0 5px; }
.ak-input-suffix { border-left: none; border-radius: 0 5px 14px 0; }

/* ═══ INLINE CELL INPUT (for spreadsheets) ═══ */
.ak-cell-input {
  width: 100%;
  padding: 4px 6px;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 12px;
  color: #1e1e24;
  border: 1.5px solid transparent;
  border-radius: 4px;
  background: transparent;
  outline: none;
  transition: border-color 0.1s, background 0.1s;
}
.ak-cell-input:hover { background: rgba(168,200,232,0.03); }
.ak-cell-input:focus {
  border-color: #a8c8e8;
  background: white;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.04);
}
.ak-cell-input[readonly] {
  color: #8a8a96;
  cursor: default;
}
/* Editable state — show border */
.ak-cell-editable .ak-cell-input { border-color: rgba(26,47,94,0.08); }
/* View state — hide everything */
.ak-cell-view .ak-cell-input { pointer-events: none; opacity: 0.7; border-color: transparent; }

/* ═══ IN-CELL DROPDOWN (Ákotí styled, for spreadsheets) ═══ */
.ak-cell-dd {
  position: relative;
  cursor: pointer;
  min-height: 26px;
  display: flex;
  align-items: center;
}
.ak-cell-dd-val {
  padding: 4px 20px 4px 6px;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 12px;
  color: #1e1e24;
  border: 1.5px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  transition: border-color 0.1s;
}
.ak-cell-dd-val::after {
  content: '▾';
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 8px;
  color: #8a8a96;
}
.ak-cell-dd-val.ak-empty { color: #8a8a96; }
.ak-cell-editable .ak-cell-dd-val { border-color: rgba(26,47,94,0.08); }
.ak-cell-editable .ak-cell-dd-val:hover { background: rgba(168,200,232,0.04); border-color: rgba(168,200,232,0.3); }
.ak-cell-view .ak-cell-dd-val { pointer-events: none; opacity: 0.7; }
.ak-cell-view .ak-cell-dd-val::after { display: none; }

/* Panel — position:fixed, appended to body */
.ak-cell-dd-panel {
  position: fixed;
  z-index: 10000;
  background: white;
  border: 1px solid rgba(26,47,94,0.1);
  border-radius: 10px 4px 10px 4px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  padding: 3px;
  min-width: 140px;
  max-height: 200px;
  overflow-y: auto;
  display: none;
}
.ak-cell-dd-panel.ak-open { display: block; animation: ak-dd-in 0.15s ease-out; }
@keyframes ak-dd-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: translateY(0); } }

.ak-cell-dd-panel::-webkit-scrollbar { width: 3px; }
.ak-cell-dd-panel::-webkit-scrollbar-thumb { background: rgba(26,47,94,0.1); border-radius: 2px; }

.ak-cell-dd-opt {
  padding: 6px 10px;
  font-size: 12px;
  color: #1e1e24;
  cursor: pointer;
  border-radius: 6px 2px 6px 2px;
  transition: background 0.1s;
}
.ak-cell-dd-opt:hover {
  background: rgba(168,200,232,0.12);
  border-radius: 2px 6px 2px 6px;
}
.ak-cell-dd-opt.ak-sel {
  background: rgba(168,200,232,0.15);
  font-weight: 600;
  color: #1a2f5e;
}

/* ═══ MOBILE ═══ */
@media (max-width: 640px) {
  .ak-input { padding: 10px 12px; font-size: 14px; }
  .ak-input-sm { padding: 7px 10px; font-size: 12px; }
}
