/* assets/measurements.css - Minhas Medidas Essenza Interiores */

.medidas-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  box-sizing: border-box;
  animation: medFadeIn 0.2s ease-out;
}

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

/* ─── TOPO DA TELA ─── */
.medidas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  background: #161b26;
  border: 1.5px solid #283548;
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
}

.medidas-title-box h1 {
  font-size: 1.45rem;
  font-weight: 800;
  color: #f1f5f9;
  margin: 0;
  letter-spacing: -0.01em;
}

.medidas-title-box p {
  font-size: 0.85rem;
  color: #8492a6;
  margin: 0.25rem 0 0 0;
}

.medidas-actions-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-med-novo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  background: #2563eb;
  border: 1px solid #3b82f6;
  border-radius: 12px;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.btn-med-novo:active {
  transform: scale(0.96);
  background: #1d4ed8;
}

/* ─── BUSCA E FILTROS ─── */
.medidas-filter-bar {
  display: flex;
  gap: 0.75rem;
  background: #161b26;
  border: 1px solid #283548;
  border-radius: 12px;
  padding: 0.65rem 1rem;
  align-items: center;
}

.medidas-filter-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #f1f5f9;
  font-size: 0.95rem;
  outline: none;
}

.medidas-filter-input::placeholder {
  color: #64748b;
}

/* ─── GRID DE CARDS DE MEDIDAS ─── */
.medidas-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 680px) {
  .medidas-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .medidas-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* O CARD DA MEDIDA SALVA */
.medida-card {
  background: #1c2333;
  border: 1.5px solid #2a354a;
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: all 0.15s ease;
}

.medida-card:hover {
  border-color: #3b82f6;
  background: #1e273a;
}

.medida-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  border-bottom: 1px solid #283548;
  padding-bottom: 0.75rem;
}

.medida-client-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: #f1f5f9;
  margin: 0 0 0.2rem 0;
}

.medida-client-env {
  font-size: 0.85rem;
  color: #38bdf8;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.medida-type-badge {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 9px;
  border-radius: 20px;
}

.medida-type-badge.papel {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.4);
}

.medida-type-badge.persiana {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

/* Corpo das Medidas */
.medida-body-specs {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.medida-spec-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.88rem;
}

.medida-spec-label {
  color: #8492a6;
}

.medida-spec-val {
  font-weight: 700;
  color: #f1f5f9;
}

.medida-highlight-box {
  background: #141a26;
  border: 1px solid #283548;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.medida-highlight-main {
  font-size: 1.15rem;
  font-weight: 800;
  color: #38bdf8;
}

.medida-highlight-sub {
  font-size: 0.78rem;
  color: #94a3b8;
  font-weight: 600;
}

.medida-notes-text {
  font-size: 0.8rem;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin: 0;
  line-height: 1.4;
  border-left: 3px solid #3b82f6;
}

/* Botões de Ação no Card */
.medida-card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-top: 1px solid #283548;
  padding-top: 0.75rem;
  flex-wrap: wrap;
}

.btn-med-action {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.12s ease;
  touch-action: manipulation;
}

.btn-med-action.wa {
  background: #065f46;
  color: #34d399;
  border: 1px solid #059669;
}
.btn-med-action.wa:active {
  background: #047857;
  color: #ffffff;
}

.btn-med-action.quote {
  background: #1e3a8a;
  color: #93c5fd;
  border: 1px solid #2563eb;
}
.btn-med-action.quote:active {
  background: #2563eb;
  color: #ffffff;
}

.btn-med-action.edit {
  background: #2d3748;
  color: #cbd5e1;
  flex: 0 0 auto;
  padding: 0.55rem 0.75rem;
}
.btn-med-action.edit:active {
  background: #4a5568;
}

.btn-med-action.del {
  background: #451a1a;
  color: #fca5a5;
  flex: 0 0 auto;
  padding: 0.55rem 0.75rem;
}
.btn-med-action.del:active {
  background: #dc2626;
  color: #ffffff;
}

/* ─── MODAL DE CADASTRO / EDIÇÃO DE MEDIDA (TOUCH MODAL) ─── */
.med-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 1rem;
  box-sizing: border-box;
}

.med-modal-content {
  background: #161b26;
  border: 2px solid #2a354a;
  border-radius: 20px;
  width: 100%;
  max-width: 650px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 1.5rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  box-sizing: border-box;
  animation: medPopIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes medPopIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.med-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1.5px solid #283548;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
}

.med-modal-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #f1f5f9;
  margin: 0;
}

.med-modal-close {
  background: #232a38;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: #8492a6;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: bold;
}

.med-modal-close:hover {
  color: #ffffff;
  background: #333f52;
}

/* Chave Seletora Touch de Tipo (Papel vs Persiana) */
.med-type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  background: #12151c;
  border: 1.5px solid #283548;
  border-radius: 14px;
  padding: 5px;
  margin-bottom: 1.25rem;
}

.med-type-opt {
  padding: 0.85rem;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 800;
  color: #8492a6;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.med-type-opt.active {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

/* Campos de Formulário */
.med-form-group {
  margin-bottom: 1rem;
}

.med-form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.med-form-input, .med-form-select, .med-form-textarea {
  width: 100%;
  background: #1c2333;
  border: 1.5px solid #2a354a;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  color: #f1f5f9;
  font-size: 1rem;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s;
}

.med-form-input:focus, .med-form-select:focus, .med-form-textarea:focus {
  border-color: #3b82f6;
  background: #20293d;
}

.med-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.med-calc-preview {
  background: #121722;
  border: 1.5px dashed #3b82f6;
  border-radius: 12px;
  padding: 1rem;
  margin: 1.25rem 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  text-align: center;
}

.med-calc-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: #38bdf8;
}

.med-calc-sub {
  font-size: 0.72rem;
  color: #8492a6;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 3px;
}

.btn-med-save {
  width: 100%;
  padding: 1.1rem;
  background: #2563eb;
  border: 1px solid #3b82f6;
  border-radius: 12px;
  color: #ffffff;
  font-size: 1.15rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
  touch-action: manipulation;
  transition: all 0.15s;
}

.btn-med-save:active {
  transform: scale(0.97);
  background: #1d4ed8;
}

/* Estado vazio */
.medidas-empty {
  text-align: center;
  padding: 3.5rem 1rem;
  background: #161b26;
  border: 2px dashed #283548;
  border-radius: 16px;
  color: #8492a6;
}

.medidas-empty h3 {
  color: #f1f5f9;
  font-size: 1.35rem;
  margin-bottom: 0.5rem;
}
