/* =====================================================
   Global Wines Helpdesk — style.css v3
   Paleta oficial: Vermelho #AE0F21 + Oliva #AEB704 + Preto
   ===================================================== */

@import url("https://fonts.googleapis.com/css2?family=Barlow:wght@300;400;500;600;700&family=Barlow+Condensed:wght@400;600;700&display=swap");

:root {
  --red:         #AE0F21;
  --red-dark:    #7A0918;
  --red-light:   #C8162A;
  --olive:       #AEB704;
  --olive-dark:  #7A8003;
  --olive-light: #C8D006;
  --black:       #1A1A1A;
  --black-soft:  #2A2A2A;
  --bg:          #F0EEE8;
  --surface:     #FFFFFF;
  --border:      #E2E0D8;
  --text:        #1A1A1A;
  --text-muted:  #6B6860;
  --sidebar-w:   248px;
  --radius:      8px;
  --shadow:      0 2px 10px rgba(0,0,0,0.08);
  --shadow-lg:   0 8px 28px rgba(0,0,0,0.14);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Barlow", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ---- LAYOUT ---- */
.app-layout { display: flex; min-height: 100vh; }

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w);
  background: #141414;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  border-right: 3px solid var(--red);
}

.sidebar-logo {
  padding: 1.1rem 1.1rem 0.9rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.sidebar-logo a {
  display: block;
  line-height: 0;
}

.sidebar-logo img {
  width: 148px;
  height: auto;
  display: block;
}

.logo-sub {
  display: block;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--olive);
  margin-top: 4px;
  padding-left: 1px;
}

.sidebar-nav { padding: 1rem 0; flex: 1; }

.nav-section {
  padding: 0.75rem 1.1rem 0.25rem;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1.1rem;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 400;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.nav-item:hover { background: rgba(255,255,255,0.05); color: white; }
.nav-item.active { background: rgba(174,15,33,0.18); color: #fff; border-left-color: var(--red); font-weight: 600; }
.nav-icon { font-size: 11px; width: 16px; text-align: center; opacity: 0.7; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.9rem 1.1rem;
  border-top: 1px solid rgba(255,255,255,0.07);
}

.user-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--red), var(--red-light));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white;
  flex-shrink: 0;
  font-family: "Barlow Condensed", sans-serif;
}

.user-info { flex: 1; min-width: 0; }
.user-name { display: block; font-size: 12.5px; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { display: block; font-size: 10px; color: var(--olive); text-transform: capitalize; letter-spacing: 0.05em; }

.btn-logout {
  color: rgba(255,255,255,0.35);
  text-decoration: none;
  font-size: 14px;
  padding: 4px;
  transition: color 0.15s;
}
.btn-logout:hover { color: var(--red); }

/* ---- MAIN CONTENT ---- */
.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}

.page-title {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--black);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.content-area { padding: 1.75rem 2rem; flex: 1; }

/* ---- STATS GRID ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.stat-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.stat-number {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.25rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.stat-label { font-size: 11.5px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }

/* ---- CARDS ---- */
.table-card, .content-card, .form-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.form-card { padding: 2rem; max-width: 720px; }
.content-card { padding: 1.25rem; }

.card-section-title {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---- TABLE ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 0.7rem 1rem;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: #F8F7F3;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #F0EEE8;
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #FAFAF6; }
.row-critical { border-left: 3px solid var(--red); }
.row-inactive { opacity: 0.45; }

.ticket-id { font-family: "Barlow Condensed", sans-serif; font-size: 13px; color: var(--text-muted); font-weight: 700; letter-spacing: 0.04em; }
.ticket-title { font-weight: 500; max-width: 320px; }

/* ---- BADGES ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: var(--red)15;
  color: var(--red);
  border: 1px solid var(--red)30;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tag-internal { background: #7C3AED15; color: #7C3AED; border-color: #7C3AED30; }

/* ---- BUTTONS ---- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.25rem;
  background: var(--red);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  font-family: "Barlow", sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.btn-primary:hover { background: var(--red-light); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 1.25rem;
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  font-family: "Barlow", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.btn-secondary:hover { background: var(--bg); border-color: #ccc; }

.btn-sm {
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-family: "Barlow", sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.btn-danger  { background: #FEE2E2; color: #DC2626; }
.btn-success { background: #D1FAE5; color: #059669; }
.btn-link { color: var(--red); text-decoration: none; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.btn-link:hover { color: var(--red-light); }

/* ---- FORMS ---- */
.form-title {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group { margin-bottom: 1.25rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-label { display: block; font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 0.4rem; text-transform: uppercase; letter-spacing: 0.06em; }
.required { color: var(--red); }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }

.input-field {
  width: 100%;
  padding: 0.55rem 0.85rem;
  background: #FAFAF7;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: "Barlow", sans-serif;
  color: var(--text);
  transition: border-color 0.15s;
}

.input-field:focus { outline: none; border-color: var(--red); background: white; }
.textarea { resize: vertical; min-height: 120px; }
.input-sm { width: auto; padding: 3px 8px; font-size: 12px; }

/* ---- FILTERS ---- */
.filters-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.filters-form {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
  flex: 1;
}

.filters-form .input-field { width: auto; flex: 1; min-width: 120px; max-width: 200px; }
.filters-count { font-size: 12px; color: var(--text-muted); white-space: nowrap; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }

/* ---- TICKET DETAIL ---- */
.ticket-layout { display: grid; grid-template-columns: 1fr 280px; gap: 1.5rem; align-items: start; }

.ticket-header-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--red);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.ticket-meta-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.75rem; }
.ticket-id-large { font-family: "Barlow Condensed", sans-serif; font-size: 14px; color: var(--text-muted); font-weight: 700; letter-spacing: 0.08em; }

.ticket-title-large {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 0.75rem;
  line-height: 1.25;
  letter-spacing: 0.02em;
}

.ticket-info-row { display: flex; flex-wrap: wrap; gap: 0.5rem; font-size: 13px; color: var(--text-muted); align-items: center; }
.dot { color: var(--border); }
.ticket-description { font-size: 14px; line-height: 1.75; color: var(--text); }

.comments-section { }
.comment { display: flex; gap: 0.75rem; margin-bottom: 1rem; }
.comment-internal { background: #7C3AED08; border-left: 3px solid #7C3AED; border-radius: 0 var(--radius) var(--radius) 0; padding: 0.75rem; }
.comment-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--black); display: flex; align-items: center; justify-content: center; font-family: "Barlow Condensed", sans-serif; font-size: 14px; font-weight: 700; color: white; flex-shrink: 0; }
.comment-body { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.85rem 1rem; }
.comment-header { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; font-size: 13px; }
.comment-text { font-size: 14px; line-height: 1.65; }

.info-row { display: flex; justify-content: space-between; padding: 0.45rem 0; font-size: 13px; border-bottom: 1px solid var(--border); }
.info-row:last-child { border-bottom: none; }
.history-item { font-size: 12px; color: var(--text-muted); padding: 0.35rem 0; border-bottom: 1px solid var(--border); }
.history-item:last-child { border-bottom: none; }

/* ---- SECTION HEADER ---- */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.section-title { font-family: "Barlow Condensed", sans-serif; font-size: 18px; font-weight: 700; color: var(--black); text-transform: uppercase; letter-spacing: 0.04em; }

/* ---- TABS ---- */
.tabs { display: flex; gap: 0; margin-bottom: 1.5rem; border-bottom: 2px solid var(--border); }
.tab-btn { padding: 0.6rem 1.25rem; font-size: 12.5px; font-weight: 700; color: var(--text-muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.15s; text-transform: uppercase; letter-spacing: 0.06em; }
.tab-btn:hover { color: var(--red); }
.tab-btn.active { color: var(--red); border-bottom-color: var(--red); }

/* ---- PAGINATION ---- */
.pagination { display: flex; gap: 0.4rem; justify-content: center; padding: 1.5rem 0; }
.page-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: var(--radius); font-size: 13px; text-decoration: none; color: var(--text-muted); border: 1.5px solid var(--border); transition: all 0.15s; font-weight: 600; }
.page-btn:hover, .page-btn.active { background: var(--red); color: white; border-color: var(--red); }

/* ---- ALERTS ---- */
.alert { padding: 0.85rem 1rem; border-radius: var(--radius); font-size: 13.5px; margin-bottom: 1rem; font-weight: 500; }
.alert-success { background: #D1FAE5; color: #065F46; border-left: 4px solid #10B981; }
.alert-error   { background: #FEE2E2; color: #991B1B; border-left: 4px solid var(--red); }

/* ---- MISC ---- */
.text-muted { color: var(--text-muted); }
.empty-state { text-align: center; padding: 3rem; color: var(--text-muted); font-size: 14px; }
.admin-layout { display: flex; gap: 1.5rem; align-items: flex-start; }

/* ---- LOGIN PAGE ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #555 url("bg-login.jpg") center center / cover no-repeat;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 20, 0.72);
  pointer-events: none;
}

.login-container { position: relative; z-index: 1; width: 100%; max-width: 440px; padding: 1.5rem; }

.login-card {
  background: #FFFFFF;
  border-radius: 12px;
  padding: 2.5rem;
  box-shadow: 0 25px 60px rgba(0,0,0,0.45);
  border: none;
  border-top: 3px solid var(--red);
}

.login-logo {
  margin-bottom: 1.75rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.login-logo-icon {
  width: 88px;
  height: auto;
  display: block;
  margin-bottom: 6px;
}

.login-logo-wordmark {
  font-family: "Barlow", sans-serif;
  font-size: 28px;
  font-weight: 300;
  color: var(--black);
  letter-spacing: 0.12em;
  line-height: 1;
  display: block;
}

.login-logo-wordmark sup {
  font-size: 12px;
  vertical-align: super;
  font-weight: 300;
}

.login-logo-tagline {
  font-family: "Barlow", sans-serif;
  font-size: 11px;
  font-weight: 300;
  color: var(--text-muted);
  letter-spacing: 0.28em;
  margin-top: 4px;
  display: block;
}

.login-logo-sub {
  display: block;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--olive-dark);
  margin-top: 10px;
}

.login-divider {
  height: 1px;
  background: var(--border);
  margin-bottom: 1.75rem;
}

.login-title {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.login-desc { color: var(--text-muted); font-size: 13.5px; margin-bottom: 2rem; line-height: 1.5; }
.login-footer { text-align: center; font-size: 11.5px; color: var(--text-muted); margin-top: 1.5rem; }
.login-footer2 { text-align: center; font-size: 6.9px; color: var(--text-muted); margin-top: 1.5rem; }

.btn-microsoft {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.9rem 1.5rem;
  background: white;
  color: #1A1A1A;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
  font-family: "Barlow", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.btn-microsoft:hover { background: #F0F0F0; }

/* ---- ATTACHMENTS ---- */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s, background 0.15s;
}
.upload-area.drag-over { border-color: var(--red); background: var(--red)05; }
.upload-placeholder {
  display: flex; flex-direction: column; align-items: center;
  gap: 0.4rem; padding: 2rem; cursor: pointer; text-align: center;
  color: var(--text-muted); font-size: 13.5px;
}
.upload-icon { font-size: 28px; }
.upload-placeholder:hover { color: var(--red); }
.file-list { padding: 0 1rem 1rem; }
.file-item { display: flex; justify-content: space-between; align-items: center; padding: 0.4rem 0; font-size: 13px; border-top: 1px solid var(--border); }

.attachments-grid { display: flex; flex-direction: column; gap: 0.5rem; }
.attachment-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 0.85rem; background: #FAFAF7; border: 1px solid var(--border); border-radius: var(--radius); }
.att-icon { font-size: 20px; flex-shrink: 0; }
.att-info { flex: 1; min-width: 0; }
.att-name { display: block; font-size: 13px; font-weight: 600; color: var(--red); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-name:hover { text-decoration: underline; }
.att-meta { font-size: 11px; color: var(--text-muted); }

/* ---- REPORTS ---- */
.report-filters { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.report-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.25rem; }
.report-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.25rem; margin-bottom: 1.5rem; }

.bar-list { display: flex; flex-direction: column; gap: 0.6rem; }
.bar-row { display: flex; align-items: center; gap: 0.6rem; font-size: 12.5px; }
.bar-label { width: 110px; flex-shrink: 0; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; height: 7px; background: var(--border); border-radius: 50px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 50px; transition: width 0.6s ease; }
.bar-value { width: 70px; text-align: right; font-size: 12px; color: var(--text-muted); flex-shrink: 0; }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .sidebar { width: 200px; }
  .main-content { margin-left: 200px; }
  .ticket-layout { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-layout { flex-direction: column; }
  .report-grid-2, .report-grid-3 { grid-template-columns: 1fr; }
}
