/* ============================================================
   SISTEMA SURVEI OPINIAUN PÚBLIKU – TIMOR-LESTE
   Main Stylesheet
   ============================================================ */

:root {
  --blue: #2563eb;
  --blue-light: #dbeafe;
  --green: #16a34a;
  --green-light: #dcfce7;
  --red: #dc2626;
  --red-light: #fee2e2;
  --orange: #d97706;
  --orange-light: #fef3c7;
  --teal: #0891b2;
  --teal-light: #cffafe;
  --gray: #6b7280;
  --gray-light: #f3f4f6;
  --gray-border: #e5e7eb;
  --white: #ffffff;
  --text: #1f2937;
  --text-muted: #6b7280;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: #f9fafb;
}

/* ============================================================ NAVBAR */
.navbar {
  background: #1e3a5f;
  color: #fff;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.navbar-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.navbar-brand .flag { font-size: 1.4rem; }
.navbar-menu { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.navbar-menu a {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  white-space: nowrap;
  transition: all 0.2s;
}
.navbar-menu a:hover, .navbar-menu a.active {
  background: rgba(255,255,255,0.15);
  color: #fff;
}
.navbar-user { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.user-info { font-size: 0.85rem; display: flex; flex-direction: column; align-items: flex-end; }

/* ============================================================ CONTAINER */
.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

/* ============================================================ TYPOGRAPHY */
h1, h2, h3 { font-weight: 600; line-height: 1.3; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }

.page-header { margin-bottom: 1.5rem; }
.page-header h2 { margin-bottom: 4px; }
.page-header p { color: var(--text-muted); }

.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-danger { color: var(--red); }
.required { color: var(--red); }

/* ============================================================ GRID */
.row { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.col-4 { flex: 0 0 calc(33.333% - 0.84rem); }
.col-6 { flex: 0 0 calc(50% - 0.625rem); }
.col-8 { flex: 0 0 calc(66.667% - 0.42rem); }
.form-row { display: flex; gap: 1rem; }
.form-row .col-4 { flex: 1; }
.form-row .col-6 { flex: 1; }

/* ============================================================ CARDS */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-border);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-border);
}
.card-header h3 { margin: 0; }
.card-header .card-actions { display: flex; gap: 8px; }
.card-body { padding: 1.25rem; }

/* ============================================================ STAT CARDS */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
  border: 1px solid var(--gray-border);
  box-shadow: var(--shadow);
}
.stat-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.stat-number { font-size: 2rem; font-weight: 700; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.stat-blue { border-top: 4px solid var(--blue); }
.stat-green { border-top: 4px solid var(--green); }
.stat-orange { border-top: 4px solid var(--orange); }
.stat-teal { border-top: 4px solid var(--teal); }
.stat-red { border-top: 4px solid var(--red); }
.stat-gray { border-top: 4px solid var(--gray); }
.stat-blue .stat-number { color: var(--blue); }
.stat-green .stat-number { color: var(--green); }
.stat-orange .stat-number { color: var(--orange); }
.stat-teal .stat-number { color: var(--teal); }
.stat-red .stat-number { color: var(--red); }

/* ============================================================ ACTION BAR */
.action-bar { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; align-items: center; }

/* ============================================================ FORMS */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 0.9rem; }
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--white);
  transition: border-color 0.2s;
  color: var(--text);
}
.form-control:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-control-inline { padding: 4px 8px; border: 1px solid var(--gray-border); border-radius: var(--radius); font-size: 0.85rem; width: 150px; margin-left: 6px; font-family: inherit; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ============================================================ BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: #4b5563; color: #fff; border-color: #4b5563; }
.btn-success { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-warning { background: var(--orange); color: #fff; }
.btn-outline { background: transparent; border-color: var(--gray-border); color: var(--text); }
.btn-outline:hover { background: var(--gray-light); }
.btn-block { width: 100%; justify-content: center; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-xl { padding: 14px 36px; font-size: 1.05rem; border-radius: 10px; }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-xs { padding: 3px 8px; font-size: 0.75rem; }

/* ============================================================ BADGES */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.badge-success { background: var(--green-light); color: var(--green); }
.badge-danger { background: var(--red-light); color: var(--red); }
.badge-warning { background: var(--orange-light); color: var(--orange); }
.badge-admin { background: #ede9fe; color: #7c3aed; }
.badge-researcher { background: var(--blue-light); color: var(--blue); }

/* ============================================================ ALERTS */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 1rem; border-left: 4px solid; font-size: 0.9rem; }
.alert-success { background: var(--green-light); border-color: var(--green); color: #166534; }
.alert-danger { background: var(--red-light); border-color: var(--red); color: #991b1b; }
.alert-info { background: var(--blue-light); border-color: var(--blue); color: #1e40af; }
.alert-warning { background: var(--orange-light); border-color: var(--orange); color: #92400e; }

/* ============================================================ TABLES */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th { background: var(--gray-light); padding: 10px 12px; text-align: left; font-weight: 600; font-size: 0.8rem; border-bottom: 2px solid var(--gray-border); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--gray-border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--gray-light); }
.table-sm th, .table-sm td { padding: 7px 10px; font-size: 0.85rem; }
.table-bordered td, .table-bordered th { border: 1px solid var(--gray-border); }
.table-leader td, .table-leader th { text-align: center; }
.table-leader td:first-child, .table-leader th:first-child { text-align: left; }
.table-likert td, .table-likert th { text-align: center; }
.table-likert td:first-child, .table-likert th:first-child { text-align: left; width: 55%; }

/* ============================================================ SURVEY FORM */
.survey-header {
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
  color: #fff;
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  text-align: center;
}
.survey-header h2 { font-size: 1.2rem; margin-bottom: 6px; }
.survey-header p { opacity: 0.85; font-size: 0.9rem; }

.section-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-border);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.section-title {
  background: #1e3a5f;
  color: #fff;
  padding: 12px 20px;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.section-card .alert, .section-card .question-block, .section-card .gps-box,
.section-card .form-group, .section-card .form-row, .section-card .script-box,
.section-card .section-note, .section-card .table-responsive {
  padding-left: 20px;
  padding-right: 20px;
}
.section-card .question-block { padding-top: 14px; padding-bottom: 2px; }
.section-card .form-group { padding-top: 8px; }
.section-card .alert { margin: 12px 20px; padding-left: 12px; }
.section-card .table-responsive { padding-bottom: 12px; padding-top: 12px; }

.script-box {
  background: #f0f9ff;
  border-left: 4px solid var(--blue);
  padding: 12px 20px !important;
  margin: 12px 20px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  font-size: 0.9rem;
}

.question-label { font-weight: 600; margin-bottom: 10px; font-size: 0.92rem; color: #1e3a5f; }
.section-note { padding-top: 12px; padding-bottom: 12px; font-size: 0.85rem; color: var(--text-muted); }

.radio-group, .checkbox-group { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; }
.radio-group-grid { display: grid; grid-template-columns: repeat(2, 1fr); }
.radio-label, .checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 7px 10px;
  border-radius: var(--radius);
  transition: background 0.15s;
  font-size: 0.9rem;
}
.radio-label:hover, .checkbox-label:hover { background: var(--gray-light); }
.radio-label input, .checkbox-label input[type="radio"], .checkbox-label input[type="checkbox"] {
  width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; accent-color: var(--blue);
}

/* ============================================================ GPS BOX */
.gps-box {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: var(--radius);
  padding: 14px !important;
  margin: 12px 20px;
}
.gps-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-weight: 600; }
.gps-status { font-size: 0.85rem; color: var(--text-muted); padding: 6px 0; }
.gps-status.gps-loading { color: var(--blue); }
.gps-status.gps-success { color: var(--green); font-weight: 600; }
.gps-status.gps-error { color: var(--red); }
.gps-result { margin-top: 8px; padding: 10px; background: #e0f2fe; border-radius: var(--radius); }
.gps-coord { font-weight: 600; font-size: 0.85rem; }
.gps-addr { font-size: 0.8rem; color: var(--text-muted); margin-top: 3px; }

/* ============================================================ QUOTA */
.quota-info-box { padding: 10px 14px; border-radius: var(--radius); margin-top: 8px; font-size: 0.9rem; }
.quota-open { background: var(--green-light); color: #166534; }
.quota-closed { background: var(--red-light); color: #991b1b; }
.quota-list { display: flex; flex-direction: column; gap: 8px; }
.quota-item { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: var(--radius); background: var(--gray-light); }
.quota-info { flex: 0 0 130px; }
.quota-info .quota-name { display: block; font-weight: 600; font-size: 0.85rem; }
.quota-info small { color: var(--text-muted); font-size: 0.75rem; }
.quota-bar-wrap { flex: 1; display: flex; align-items: center; gap: 8px; }
.quota-bar { flex: 1; height: 8px; background: #e5e7eb; border-radius: 99px; overflow: hidden; }
.quota-fill { height: 100%; background: var(--blue); border-radius: 99px; transition: width 0.3s; }
.quota-item.full .quota-fill { background: var(--green); }
.quota-item.near .quota-fill { background: var(--orange); }
.quota-count { font-size: 0.8rem; font-weight: 600; min-width: 40px; text-align: right; }

/* ============================================================ SUBMIT SECTION */
.submit-section { background: var(--white); border-radius: var(--radius-lg); border: 2px solid var(--blue); padding: 2rem; text-align: center; margin-top: 1.5rem; }
.timer-display { font-size: 1.2rem; font-weight: 700; color: var(--blue); margin-bottom: 1rem; }
.submit-warning { background: var(--orange-light); color: #92400e; padding: 10px 16px; border-radius: var(--radius); font-size: 0.85rem; margin-bottom: 1.5rem; }
.submit-section .btn { margin: 0 8px; }

/* ============================================================ SUCCESS SCREEN */
.success-screen { text-align: center; padding: 4rem 2rem; }
.success-icon { font-size: 5rem; margin-bottom: 1rem; }
.success-screen h2 { font-size: 2rem; color: var(--green); margin-bottom: 0.5rem; }
.interview-code { font-family: monospace; font-size: 1.6rem; font-weight: 700; background: var(--green-light); color: var(--green); padding: 12px 24px; border-radius: var(--radius); display: inline-block; margin: 1rem 0; letter-spacing: 2px; }
.success-actions { display: flex; gap: 1rem; justify-content: center; margin-top: 1.5rem; }

/* ============================================================ LOGIN */
.login-page { background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-wrapper { width: 100%; max-width: 440px; padding: 1rem; }
.login-box { background: var(--white); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); overflow: hidden; }
.login-header { background: #1e3a5f; color: #fff; padding: 2rem; text-align: center; }
.login-logo { font-size: 3.5rem; margin-bottom: 0.5rem; }
.login-header h1 { font-size: 1.5rem; margin-bottom: 4px; }
.login-header p { opacity: 0.85; font-size: 0.9rem; }
.login-header small { opacity: 0.65; font-size: 0.75rem; }
.login-box .form-group { padding: 0 2rem; margin-bottom: 1rem; }
.login-box .form-group:first-of-type { margin-top: 1.5rem; }
.login-box .btn-primary { margin: 1rem 2rem; width: calc(100% - 4rem); }
.login-footer { padding: 1rem 2rem 1.5rem; text-align: center; font-size: 0.85rem; color: var(--text-muted); }
.login-footer a { color: var(--blue); }
.login-footer hr { border: none; border-top: 1px solid var(--gray-border); margin: 0.75rem 0; }

/* ============================================================ FOOTER */
.footer { background: #1e3a5f; color: rgba(255,255,255,0.6); text-align: center; padding: 1.2rem; margin-top: 3rem; font-size: 0.8rem; }

/* ============================================================ MISC */
code { background: var(--gray-light); padding: 2px 6px; border-radius: 4px; font-family: monospace; font-size: 0.85rem; }
.progress-bar-sm { width: 100%; height: 6px; background: var(--gray-border); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--blue); }
.progress-fill.full { background: var(--green); }
.progress-fill.near { background: var(--orange); }
.table-responsive { overflow-x: auto; }
.gps-link { font-size: 1.1rem; text-decoration: none; }
.form-actions { display: flex; gap: 10px; margin-top: 1rem; }
