/* ============================================================
   AQVEX — Folha de Estilos Global (Mobile-First)
   ============================================================ */

/* Variáveis (paleta AQVEX extraída do site) */
:root {
  --primary:        #1b2f55; /* Roxo Aqvex */
  --secondary:      #E9671A; /* Mesma cor para manter identidade visual */
  --primary-dark:   #13223f;
  --primary-light:  #284479;
  --accent:         #25d366; /* Verde Aqvex (WhatsApp/Suporte) */
  --accent-hover:   #128c7e;
  --accent-light:   #e9f7ef;
  --bg:             #f4f7fa;
  --surface:        #ffffff;
  --surface-2:      #f8f9fa;
  --border:         #e0e6ed;
  --text:           #2c3e50; /* Cor de texto do site */
  --text-muted:     #7f8c8d;
  --success:        #27ae60;
  --warning:        #f39c12;
  --danger:         #e74c3c;
  --info:           #3498db;
  --sidebar-w:      260px;
  --header-h:       64px;
  --radius:         12px;
  --radius-sm:      8px;
  --shadow:         0 4px 12px rgba(0,0,0,0.05);
  --shadow-md:      0 8px 24px rgba(143, 44, 173, 0.12);
  --transition:     .3s cubic-bezier(0.4, 0, 0.2, 1);
  --font:           'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { 
  font-size: 16px; 
  -webkit-text-size-adjust: 100%; 
  scroll-behavior: smooth;
  height: 100%;
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; outline: none; }

/* ── Login ─────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  padding: 1.5rem;
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  animation: fadeUp 0.5s ease-out;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo img { height: 60px; margin: 0 auto 0.8rem; }
.login-logo .brand {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
}
.login-logo .brand span { color: var(--text); }
.login-logo p { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.3rem; }

.login-card h2 {
  font-size: 1.25rem;
  color: var(--text);
  margin-bottom: 1.5rem;
  font-weight: 700;
  text-align: center;
}

/* ── Formulários ────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.input-wrap { position: relative; }
.input-wrap i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.input-wrap input,
.input-wrap select {
  width: 100%;
  padding: 0.8rem 1rem 0.8rem 2.8rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  transition: all var(--transition);
}
/* TEXTAREA */

.input-wrap textarea{
  width:100%;
  min-height:120px;
  padding:1rem 1rem 1rem 2.8rem;
  border:1.5px solid var(--border);
  border-radius:var(--radius-sm);
  background:var(--surface-2);
  color:var(--text);
  transition:all var(--transition);
  resize:vertical;
  line-height:1.5;
}

.input-wrap textarea + i,
.input-wrap textarea ~ i{
  top:1rem;
  transform:none;
}
.input-wrap input:focus,
.input-wrap select:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(143, 44, 173, 0.1);
}
.input-wrap .toggle-pass {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
}

.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}
.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.form-check input { accent-color: var(--primary); width: 16px; height: 16px; }

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  color: #b8d8e7;
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(143, 44, 173, 0.2);
}

.btn-secondary {
  background: var(--secondary);
  color: #fff;
}
.btn-secondary:hover {
  background: var(--secondary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(108, 117, 125, 0.2);
}

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover {
  background: var(--success-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(25, 135, 84, 0.2);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: var(--danger-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.2);
}

.btn-warning {
  background: var(--warning);
  color: #212529;
}
.btn-warning:hover {
  background: var(--warning-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.2);
}

.btn-info {
  background: var(--info);
  color: #fff;
}
.btn-info:hover {
  background: var(--info-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(13, 202, 240, 0.2);
}

.btn-light {
  background: var(--light);
  color: #212529;
  border: 1px solid #dee2e6;
}
.btn-light:hover {
  background: var(--light-dark);
  transform: translateY(-1px);
}

.btn-dark {
  background: var(--dark);
  color: #fff;
}
.btn-dark:hover {
  background: var(--dark-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(33, 37, 41, 0.2);
}

.btn-block {
  width: 100%;
}

/* ── Layout Principal (App Style) ─────────────────────────── */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow);
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
}
.header-logo img { height: 32px; }

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}
.user-info {
  display: none; /* Escondido no mobile */
}
@media (min-width: 768px) {
  .user-info { display: block; text-align: right; }
  .user-name { font-weight: 700; font-size: 0.9rem; display: block; }
  .user-role { font-size: 0.75rem; color: var(--text-muted); display: block; }
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary-light);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

/* Dashboard Cards */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  padding: 1.25rem;
}
.stat-card {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

/* Grid Responsivo de Clientes */
.content-area {
  padding: 1.25rem;
  flex: 1;
}
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  padding: 1.5rem;
}
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th {
  background: var(--surface-2);
  padding: 1rem;
  text-align: left;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
}
th:hover { color: var(--primary); }
td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}
tr:hover td { background: var(--surface-2); }

/* Mobile Table (Card Style) */
@media (max-width: 600px) {
  .table-responsive table, 
  .table-responsive thead, 
  .table-responsive tbody, 
  .table-responsive th, 
  .table-responsive td, 
  .table-responsive tr { 
    display: block; 
  }
  .table-responsive thead tr { position: absolute; top: -9999px; left: -9999px; }
  .table-responsive tr { border: 1px solid var(--border); margin-bottom: 1rem; border-radius: var(--radius-sm); }
  .table-responsive td {
    border: none;
    border-bottom: 1px solid var(--surface-2);
    position: relative;
    padding-left: 50%;
    text-align: right;
  }
  .table-responsive td:before {
    position: absolute;
    left: 1rem;
    width: 45%;
    padding-right: 10px;
    white-space: nowrap;
    text-align: left;
    font-weight: 700;
    content: attr(data-label);
    color: var(--text-muted);
  }
}

/* Bottom Nav (Mobile Only) */
.bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  height: 60px;
  z-index: 1000;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}
@media (min-width: 768px) {
  .bottom-nav { display: none; }
  .app-container { padding-bottom: 0; }
}
@media (max-width: 767px) {
  .app-container { padding-bottom: 60px; }
}
.nav-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.7rem;
  gap: 0.25rem;
}
.nav-link.active { color: var(--primary); }
.nav-link i { font-size: 1.25rem; }

/* Alerts */
.alert {
  padding: 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}
.alert-error { background: #fff5f5; color: #c53030; border: 1px solid #feb2b2; }
.alert-success { background: #f0fff4; color: #2f855a; border: 1px solid #9ae6b4; }

.btn-filtrar {
    padding: 0.8rem 1.5rem;
}

/* 📱 Celular */
@media (max-width: 768px) {
    .btn-filtrar {
        flex: 1;
        min-width: 150px;
    }
}

/* Ajustes globais de responsividade para formulários e ações */
.page-actions,
.form-actions,
.filters-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}
.responsive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.card-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--surface-2);
  padding-bottom: 0.5rem;
}
@media (max-width: 767px) {
  .content-area { padding: 1rem 0.85rem; }
  .app-header { padding: 0 0.75rem; }
  .header-logo img { max-width: 80px; height: auto; }
  .modules-menu-trigger span { max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .btn { width: 100%; min-height: 44px; }
  .page-actions, .form-actions, .filters-row { flex-direction: column; align-items: stretch; }
  .responsive-grid { grid-template-columns: 1fr !important; }
  .card { border-radius: 10px; }
  .card[style*="padding"] { padding: 1rem !important; }
  h1 { font-size: 1.25rem !important; }
  input, select, textarea { min-height: 44px; }
  .table-responsive td { min-height: 44px; }
  .table-responsive td[data-label="Ações"] { padding-left: 1rem; text-align: left; justify-content: stretch !important; }
  .table-responsive td[data-label="Ações"] .btn { flex: 1; }
}
@media print {
  .app-header, .bottom-nav, .no-print { display: none !important; }
  body { background: #fff; }
  .content-area { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

/* LOGO RESPONSIVA */

.header-logo{
    display:flex;
    align-items:center;
    flex-shrink:0;
}

.header-logo a{
    display:flex;
    align-items:center;
    text-decoration:none;
}

.header-logo-img{
    display:block;
    width:auto;
    height:38px;
    max-width:220px;
    object-fit:contain;
    transition:all .2s ease;
}

/* TABLET */

@media (max-width:768px){

    .header-logo-img{
        height:28px;
        max-width:120px;
    }
}

/* MOBILE */

@media (max-width:480px){

    .header-logo-img{
        height:24px;
        max-width:100px;
    }

    .app-header{
        min-height:56px;
        padding:8px 10px;
    }

    .header-left{
        min-width:auto;
    }
}

#itensTable {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.tr-total td {
  width: 100% !important;
  padding: 0;
  border: none;
}

.footer-total {
  width: 100% !important;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  background: #fff;
  font-weight: 800;
  box-sizing: border-box;
}

.footer-total strong {
  color: var(--primary);
  font-size: 1.1rem;
}

/* Responsivo */
@media(max-width: 768px) {
  .footer-total {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .footer-total strong {
    font-size: 1.3rem;
  }
}
/* Padronização Global de Inputs e Selects */
input[type="text"], 
input[type="number"], 
input[type="date"], 
input[type="email"], 
input[type="password"], 
input[type="file"], 
select, 
textarea {
    width: 100% !important;
    padding: 0.75rem 1rem !important;
    border: 1px solid var(--border) !important;
    border-radius: 8px !important;
    background-color: white !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 0.9rem !important;
    transition: border-color 0.2s, box-shadow 0.2s !important;
    outline: none !important;
    box-sizing: border-box !important;
}

select {
    appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 1rem center !important;
    background-size: 1.25rem !important;
    padding-right: 2.5rem !important;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px var(--primary-light) !important;
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrap i {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    pointer-events: none;
}

.input-wrap input {
    padding-left: 2.5rem !important;
}
