/* Sistema de Controle de Corte - Styles */
/* Baseado nos wireframes com identidade visual completa */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #F4F6F9;
  --surface: #FFFFFF;
  --border: #D0D7E2;
  --border-dark: #A0AABB;
  --text: #1A2233;
  --text-muted: #6B7A99;
  --accent: #4F8F54;
  --accent-light: #EBF3FB;
  --green: #375623;
  --green-bg: #E2EFDA;
  --yellow: #7F6000;
  --yellow-bg: #FFF2CC;
  --red: #C00000;
  --red-bg: #FCE4D6;
  --radius: 6px;
  --shadow: 0 2px 8px rgba(0,0,0,0.10);
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── TOPBAR ── */
.topbar {
  background: var(--accent);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.topbar-back {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 18px;
  transition: background .15s;
}

.topbar-back:hover {
  background: rgba(255,255,255,.3);
}

.topbar-title {
  flex: 1;
}

.topbar h2 {
  font-size: 16px;
  font-weight: 600;
}

.topbar-sub {
  font-size: 11px;
  opacity: .8;
  margin-top: 1px;
}

.topbar-icon {
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
  transition: transform .15s;
}

.topbar-icon:hover {
  transform: scale(1.1);
}

/* ── CONTAINER ── */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 16px;
}

.login-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.login-header {
  background: var(--accent);
  padding: 40px 16px 32px;
  text-align: center;
  color: #fff;
}

.login-header .logo {
  font-size: 36px;
  margin-bottom: 8px;
}
.header-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.logo img {
  width: 230px;
  height: auto;
}

.logo-top img{
  height: 32px;
  margin-right: 10px;
}

.title-area {
  border-left: 2px solid #ddd;
  padding-left: 20px;
}

.title-area h1 {
  margin: 0;
}

.title-area p {
  margin: 5px 0 0 0;
  color: #666;
}

.login-header h1 {
  font-size: 22px;
  font-weight: 700;
}

.login-header p {
  color: rgba(255,255,255,.7);
  font-size: 13px;
  margin-top: 4px;
}

.login-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 16px;
  gap: 16px;
}

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.card:last-child {
  margin-bottom: 0;
}

.card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 12px;
}

/* ── FIELDS ── */
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.field:last-child {
  margin-bottom: 0;
}

.field label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.field input,
.field select,
.field textarea {
  height: 40px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: #F9FAFB;
  padding: 0 12px;
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
  transition: all .15s;
}

.field textarea {
  height: 80px;
  padding: 10px 12px;
  resize: vertical;
  min-height: 60px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
}

.field input:disabled,
.field select:disabled {
  background: #e9ecef;
  cursor: not-allowed;
  opacity: .7;
}

.field-icon {
  position: relative;
}

.field-icon input {
  padding-left: 38px;
}

.field-icon .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-15%);
  font-size: 16px;
  color: var(--text-muted);
}

.row-fields {
  display: grid;
  gap: 10px;
}

.row-fields.col2 {
  grid-template-columns: 1fr 1fr;
}

.row-fields.col3 {
  grid-template-columns: 1fr 1fr 1fr;
}

/* ── BUTTONS ── */
.btn {
  height: 46px;
  border-radius: var(--radius);
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  transition: all .15s;
  width: 100%;
  text-decoration: none;
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: #424242;
}

.btn-success {
  background: var(--green);
  color: #fff;
}

.btn-success:hover:not(:disabled) {
  background: #2A441B;
}

.btn-warning {
  background: var(--yellow);
  color: #fff;
}

.btn-warning:hover:not(:disabled) {
  background: #654D00;
}

.btn-danger {
  background: var(--red);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #9B0000;
}

.btn-outline {
  background: #fff;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}

.btn-outline:hover:not(:disabled) {
  background: var(--accent-light);
}

.btn-group {
  display: flex;
  gap: 8px;
}

.btn-group .btn {
  flex: 1;
}

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green {
  background: var(--green-bg);
  color: var(--green);
}

.badge-yellow {
  background: var(--yellow-bg);
  color: var(--yellow);
}

.badge-red {
  background: var(--red-bg);
  color: var(--red);
}

.badge-blue {
  background: var(--accent-light);
  color: var(--accent);
}

/* ── ALERTS ── */
.alert {
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.alert .icon {
  flex-shrink: 0;
  font-size: 16px;
}

.alert-green {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid #A9D18E;
}

.alert-yellow {
  background: var(--yellow-bg);
  color: var(--yellow);
  border: 1px solid #FFD966;
}

.alert-red {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid #F4AAAA;
}

.alert-blue {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid #9DC3E6;
}

/* ── INFO ROWS ── */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.info-row:last-child {
  border-bottom: none;
}

.info-row .label {
  font-size: 12px;
  color: var(--text-muted);
}

.info-row .value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* ── LIST ITEMS ── */
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all .15s;
}

.list-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.list-item:last-child {
  margin-bottom: 0;
}

.list-item .main {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.list-item .sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── STATS ── */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.stat-box .stat-val {
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
}

.stat-box .stat-lbl {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ── TIMER ── */
.timer {
  text-align: center;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
}

.timer .time-big {
  font-size: 48px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
}

.timer .time-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.timer .time-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ── TOGGLE ── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}

.toggle {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: var(--border);
  position: relative;
  cursor: pointer;
  transition: background .15s;
}

.toggle.on {
  background: var(--accent);
}

.toggle::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: left .15s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.toggle.on::after {
  left: 23px;
}

/* ── TAB BAR ── */
.tab-bar {
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  gap: 4px;
  transition: all .15s;
  text-decoration: none;
}

.tab-item.active {
  color: var(--accent);
  background: var(--accent-light);
}

.tab-item:hover {
  background: #F9FAFB;
}

.tab-icon {
  font-size: 20px;
}

/* ── LOADING ── */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.hidden {
  display: none !important;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: .5;
}

.empty-state p {
  font-size: 14px;
}

/* ── DIVIDER ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ── MODAL ── */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.modal-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 20px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: #f0f0f0;
}

.modal-body {
  padding: 16px;
}

/* ── RESPONSIVE MOBILE ── */
@media (max-width: 480px) {
  .row-fields.col3 {
    grid-template-columns: 1fr;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }

  .timer .time-big {
    font-size: 36px;
  }
}

/* ── DESKTOP LAYOUT (≥768px) ── */
@media (min-width: 768px) {

  /* Topbar: altura fixa para o sidebar se alinhar */
  .topbar {
    height: 60px;
    padding-left: 24px;
    padding-right: 24px;
  }

  /* Tab-bar vira sidebar lateral */
  .tab-bar {
    top: 60px;
    left: 0;
    bottom: 0;
    right: auto;
    width: 200px;
    flex-direction: column;
    align-items: stretch;
    border-top: none;
    border-right: 1px solid var(--border);
    box-shadow: 2px 0 8px rgba(0,0,0,0.06);
    padding-top: 8px;
  }

  .tab-item {
    flex-direction: row;
    justify-content: flex-start;
    padding: 14px 20px;
    font-size: 14px;
    gap: 12px;
    border-radius: 4px;
    margin: 2px 8px;
  }

  .tab-item.active {
    border-radius: 4px;
  }

  .tab-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
  }

  /* Container: usa o espaço todo, offset do sidebar */
  .container {
    margin-left: 200px;
    margin-right: 0;
    max-width: none;
    padding: 24px 32px;
  }

  /* Remove padding extra do tab na parte de baixo */
  .pb-tab {
    padding-bottom: 24px;
  }

  /* Stats: 4 colunas no desktop */
  .stat-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Row fields col3 mantém 3 colunas em telas maiores */
  .row-fields.col3 {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

/* ── UTILITY CLASSES ── */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: 12px; }
.mt-2 { margin-top: 8px; }
.mb-2 { margin-bottom: 8px; }
.pb-tab { padding-bottom: 70px; }
