/* ══════════════════════════════════════════════════════
   FCR Company Billing — Styles
   Dark cinematic: uses main.css CSS variables
   ══════════════════════════════════════════════════════ */

/* ── Variables (fallbacks if loaded without main.css) ── */
:root {
  --fcb-bg:       var(--bg2,  #101010);
  --fcb-bg-card:  var(--bg3,  #181818);
  --fcb-bg-input: var(--bg4,  #222222);
  --fcb-gold:     var(--gold, #D4A017);
  --fcb-gold-dim: var(--gold-dim, rgba(212,160,23,.10));
  --fcb-gold-bdr: var(--gold-bdr, rgba(212,160,23,.28));
  --fcb-white:    var(--white, #fff);
  --fcb-gray:     var(--gray,  #999);
  --fcb-border:   var(--border, rgba(255,255,255,.07));
  --fcb-error:    #e05050;
  --fcb-success:  #4caf7d;
  --fcb-radius:   0px;
  --fcb-font-ui:  'Barlow Condensed', sans-serif;
  --fcb-font-hd:  'Bebas Neue', sans-serif;
}

/* ── Section divider ── */
.fcb-section-divider {
  height: 1px;
  background: var(--fcb-border);
  margin: 28px 0 24px;
}

/* ── Toggle row ── */
.fcb-toggle-row {
  margin-bottom: 4px;
}

.fcb-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  font-family: var(--fcb-font-ui);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--fcb-white);
  text-transform: uppercase;
}

/* ── Custom checkbox ── */
.fcb-checkbox-ui {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.fcb-checkbox-ui input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}

.fcb-checkbox-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--fcb-gold-bdr);
  background: var(--fcb-bg-input);
  transition: border-color .2s, background .2s;
}

.fcb-checkbox-ui input:checked + .fcb-checkbox-mark {
  background: var(--fcb-gold);
  border-color: var(--fcb-gold);
}

.fcb-checkbox-ui input:checked + .fcb-checkbox-mark::after {
  content: '';
  display: block;
  width: 5px;
  height: 9px;
  border: 2px solid #080808;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translate(-1px, -1px);
}

.fcb-checkbox-ui--sm .fcb-checkbox-mark {
  width: 16px;
  height: 16px;
}

/* ── Section (collapsible) ── */
.fcb-section {
  max-height: 0;
  overflow: hidden;
  transition: max-height .4s ease;
}

.fcb-section--visible {
  max-height: 4000px;
  overflow: visible;
  transition: max-height .6s ease;
}

/* ── Profile cards grid ── */
.fcb-profiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding-top: 20px;
  padding-bottom: 4px;
}

.fcb-profile-card {
  position: relative;
  padding: 16px;
  background: var(--fcb-bg-card);
  border: 1px solid var(--fcb-border);
  cursor: pointer;
  transition: border-color .2s;
}

.fcb-profile-card:hover {
  border-color: var(--fcb-gold-bdr);
}

.fcb-profile-card.fcb-selected {
  border-color: var(--fcb-gold);
  background: var(--fcb-gold-dim);
  box-shadow: 0 0 0 1px var(--fcb-gold);
}

.fcb-profile-card.fcb-selected::before {
  content: '✓';
  position: absolute;
  top: 10px;
  right: 12px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--fcb-gold);
  color: #080808;
  font-size: 11px;
  font-weight: 900;
  border-radius: 50%;
}

.fcb-card-main {
  cursor: pointer;
}

.fcb-card-name {
  font-family: var(--fcb-font-ui);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .03em;
  color: var(--fcb-white);
  margin-bottom: 4px;
  text-transform: uppercase;
}

.fcb-card-nip,
.fcb-card-addr {
  font-family: var(--fcb-font-ui);
  font-size: 12px;
  color: var(--fcb-gray);
  line-height: 1.5;
}

.fcb-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--fcb-border);
}

.fcb-card-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--fcb-border);
  color: var(--fcb-gray);
  cursor: pointer;
  transition: color .2s, border-color .2s;
}

.fcb-card-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.fcb-card-edit:hover  { color: var(--fcb-gold);  border-color: var(--fcb-gold-bdr); }
.fcb-card-delete:hover { color: var(--fcb-error); border-color: var(--fcb-error); }

/* Add-new card */
.fcb-profile-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 100px;
  border-style: dashed;
  color: var(--fcb-gray);
  font-family: var(--fcb-font-ui);
  font-size: 13px;
  letter-spacing: .04em;
  text-transform: uppercase;
  transition: color .2s, border-color .2s;
}

.fcb-profile-add:hover {
  color: var(--fcb-gold);
  border-color: var(--fcb-gold-bdr);
}

.fcb-add-icon {
  font-size: 22px;
  line-height: 1;
  color: var(--fcb-gold);
}

/* ── Form wrap ── */
.fcb-form-wrap {
  margin-top: 20px;
  padding: 24px;
  background: var(--fcb-bg-card);
  border: 1px solid var(--fcb-border);
}

.fcb-form-header {
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--fcb-border);
}

.fcb-form-title {
  font-family: var(--fcb-font-hd);
  font-size: 22px;
  letter-spacing: .08em;
  color: var(--fcb-white);
  text-transform: uppercase;
}

/* ── Form grid ── */
.fcb-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}

.fcb-field--nip      { grid-column: 1; }
.fcb-field--company  { grid-column: 2; }
.fcb-field--regon    { grid-column: 1; }
.fcb-field--address  { grid-column: 1 / -1; }
.fcb-field--postcode { grid-column: 1; }
.fcb-field--city     { grid-column: 2; }
.fcb-field--label    { grid-column: 1 / -1; }

@media (max-width: 640px) {
  .fcb-form-grid { grid-template-columns: 1fr; }
  .fcb-field--nip,
  .fcb-field--company,
  .fcb-field--regon,
  .fcb-field--address,
  .fcb-field--postcode,
  .fcb-field--city,
  .fcb-field--label { grid-column: 1; }
}

/* ── Field ── */
.fcb-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.fcb-field label {
  font-family: var(--fcb-font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--fcb-gray);
}

.fcb-req {
  color: var(--fcb-gold);
  margin-left: 2px;
}

.fcb-input-wrap {
  position: relative;
}

.fcb-field input,
.fcb-input-wrap input {
  width: 100%;
  padding: 10px 12px;
  background: var(--fcb-bg-input);
  border: 1px solid rgba(255,255,255,.1);
  color: var(--fcb-white);
  font-family: var(--fcb-font-ui);
  font-size: 14px;
  letter-spacing: .02em;
  outline: none;
  transition: border-color .2s;
  border-radius: var(--fcb-radius);
  -webkit-appearance: none;
}

.fcb-field input:focus,
.fcb-input-wrap input:focus {
  border-color: var(--fcb-gold-bdr);
}

.fcb-field input.fcb-readonly,
.fcb-field input[readonly] {
  opacity: .6;
  cursor: default;
  border-color: rgba(255,255,255,.05);
}

.fcb-field input.fcb-invalid {
  border-color: var(--fcb-error) !important;
}

.fcb-field-error {
  display: none;
  font-family: var(--fcb-font-ui);
  font-size: 12px;
  color: var(--fcb-error);
  letter-spacing: .02em;
}

/* ── NIP indicator ── */
.fcb-nip-indicator {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
}

.fcb-nip-valid    { color: var(--fcb-success); }
.fcb-nip-invalid  { color: var(--fcb-error); }
.fcb-nip-notfound { color: var(--fcb-gray); }

/* Spinner inside indicator */
.fcb-nip-loading .fcb-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.15);
  border-top-color: var(--fcb-gold);
  border-radius: 50%;
  animation: fcb-spin .7s linear infinite;
}

@keyframes fcb-spin {
  to { transform: rotate(360deg); }
}

/* ── Form actions ── */
.fcb-form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* ── Save row ── */
.fcb-save-row {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--fcb-border);
}

.fcb-save-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-family: var(--fcb-font-ui);
  font-size: 13px;
  color: var(--fcb-gray);
  letter-spacing: .03em;
}

.fcb-profile-label-wrap {
  margin-top: 12px;
}

.fcb-profile-label-wrap input {
  width: 100%;
  max-width: 320px;
  padding: 8px 12px;
  background: var(--fcb-bg-input);
  border: 1px solid rgba(255,255,255,.1);
  color: var(--fcb-white);
  font-family: var(--fcb-font-ui);
  font-size: 13px;
  outline: none;
  border-radius: var(--fcb-radius);
}

.fcb-profile-label-wrap input:focus {
  border-color: var(--fcb-gold-bdr);
}

/* ── Buttons ── */
.fcb-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  font-family: var(--fcb-font-ui);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .2s, color .2s, border-color .2s;
  border-radius: var(--fcb-radius);
  line-height: 1;
}

.fcb-btn--primary {
  background: var(--fcb-gold);
  color: #080808;
  border-color: var(--fcb-gold);
}

.fcb-btn--primary:hover {
  background: var(--gold-lt, #F0C040);
  border-color: var(--gold-lt, #F0C040);
}

.fcb-btn--secondary {
  background: transparent;
  color: var(--fcb-gray);
  border-color: rgba(255,255,255,.15);
}

.fcb-btn--secondary:hover {
  color: var(--fcb-white);
  border-color: rgba(255,255,255,.3);
}

.fcb-btn--danger {
  background: transparent;
  color: var(--fcb-error);
  border-color: var(--fcb-error);
}

.fcb-btn--danger:hover {
  background: var(--fcb-error);
  color: #fff;
}

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

/* ── Modal ── */
.fcb-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99990;
  align-items: center;
  justify-content: center;
}

.fcb-modal--visible {
  display: flex;
}

.fcb-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(3px);
}

.fcb-modal-box {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 32px;
  background: var(--fcb-bg-card);
  border: 1px solid var(--fcb-border);
  border-top: 3px solid var(--fcb-error);
  margin: 20px;
}

.fcb-modal-heading {
  font-family: var(--fcb-font-hd);
  font-size: 22px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--fcb-white);
  margin: 0 0 10px;
}

.fcb-modal-text {
  font-family: var(--fcb-font-ui);
  font-size: 14px;
  color: var(--fcb-gray);
  margin: 0 0 24px;
  line-height: 1.5;
}

.fcb-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── My Account tab ── */
.fcb-ma-wrap {
  color: var(--fcb-white);
}

.fcb-ma-header {
  margin-bottom: 28px;
}

.fcb-ma-title {
  font-family: var(--fcb-font-hd);
  font-size: 28px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--fcb-white);
  margin: 0 0 6px;
}

.fcb-ma-desc {
  font-family: var(--fcb-font-ui);
  font-size: 13px;
  color: var(--fcb-gray);
  line-height: 1.5;
}

.fcb-ma-empty {
  font-family: var(--fcb-font-ui);
  font-size: 14px;
  color: var(--fcb-gray);
  padding: 24px 0;
}

.fcb-ma-profiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.fcb-ma-card {
  padding: 20px;
  background: var(--fcb-bg-card);
  border: 1px solid var(--fcb-border);
  transition: border-color .2s;
}

.fcb-ma-card:hover {
  border-color: var(--fcb-gold-bdr);
}

.fcb-ma-card-name {
  font-family: var(--fcb-font-ui);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--fcb-white);
  margin-bottom: 4px;
}

.fcb-ma-card-company {
  font-size: 12px;
  color: var(--fcb-gray);
  margin-bottom: 8px;
}

.fcb-ma-card-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-family: var(--fcb-font-ui);
  font-size: 12px;
  color: var(--fcb-gold);
  letter-spacing: .03em;
  margin-bottom: 6px;
}

.fcb-ma-card-addr {
  font-family: var(--fcb-font-ui);
  font-size: 12px;
  color: var(--fcb-gray);
  line-height: 1.5;
  margin-bottom: 16px;
}

.fcb-ma-card-actions {
  display: flex;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--fcb-border);
}

.fcb-ma-btn-edit,
.fcb-ma-btn-delete {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--fcb-border);
  color: var(--fcb-gray);
  font-family: var(--fcb-font-ui);
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color .2s, border-color .2s;
}

.fcb-ma-btn-edit:hover   { color: var(--fcb-gold);  border-color: var(--fcb-gold-bdr); }
.fcb-ma-btn-delete:hover { color: var(--fcb-error); border-color: var(--fcb-error); }

.fcb-ma-add-row {
  margin-bottom: 28px;
}

.fcb-ma-form-wrap {
  padding: 28px;
  background: var(--fcb-bg-card);
  border: 1px solid var(--fcb-border);
  border-top: 2px solid var(--fcb-gold);
}

.fcb-ma-form-title {
  font-family: var(--fcb-font-hd);
  font-size: 20px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--fcb-white);
  margin: 0 0 20px;
}
