/* =============================================================
   TICKIFY SECURITY SCANNER - Modern Bright Theme
   ============================================================= */

/* ==================== CSS VARIABLES ==================== */
:root {
  --bg-primary: #f0f4ff;
  --bg-secondary: #e8edf8;
  --bg-card: #ffffff;
  --bg-input: #f5f7ff;
  --bg-topbar: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --primary: #667eea;
  --primary-light: #8b9cf7;
  --primary-dark: #4a5ec7;
  --accent: #f5576c;
  --secondary: #43e97b;
  --success: #43e97b;
  --success-dark: #38c96a;
  --warning: #f7971e;
  --danger: #f5576c;
  --info: #667eea;
  --text: #2d3748;
  --text-muted: #718096;
  --border: #d6dff5;
  --border-dark: #b0bde0;
  --border-light: #e8edf8;
  --shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
  --shadow-lg: 0 8px 24px rgba(102, 126, 234, 0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.2s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-primary);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ==================== LOGIN ==================== */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.campus-slideshow {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.campus-slideshow .campus-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1.5s ease-in-out;
}
.campus-slideshow .campus-slide.active {
  opacity: 1;
}
.campus-slideshow::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 40, 0.65);
  z-index: 1;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 28px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 2;
  backdrop-filter: blur(10px);
}

.login-logo {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 24px;
  color: white;
  box-shadow: var(--shadow-lg);
}

.login-card h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.login-subtitle {
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 12px;
}

/* ==================== FORM ==================== */
.form-group {
  margin-bottom: 14px;
  text-align: left;
}
.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.form-group input {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}
.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
  background: #fff;
}

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  background: var(--bg-secondary);
  color: var(--text);
  box-shadow: var(--shadow);
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}
.btn:active {
  transform: translateY(0);
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
  color: #fff;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #7b93f0 0%, #8659b5 100%);
}
.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, #38c96a 100%);
  color: #fff;
}
.btn-success:hover {
  background: linear-gradient(135deg, #5eeda0 0%, #43e97b 100%);
}
.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(102, 126, 234, 0.06);
}
.btn-full {
  width: 100%;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}
.btn-icon {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius);
  transition: var(--transition);
}
.btn-icon:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: #fef2f2;
}

/* ==================== ALERTS ==================== */
.alert {
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  margin-bottom: 12px;
  font-weight: 600;
  border: 1px solid;
}
.alert-danger {
  background: #fadbd8;
  color: #922b21;
  border-color: #f5b7b1;
}

/* ==================== HEADER ==================== */
.scanner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-topbar);
  border-bottom: none;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  color: #fff;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
}
.header-left i {
  color: rgba(255, 255, 255, 0.9);
  font-size: 18px;
}

/* ==================== TABS ==================== */
.scanner-wrapper {
  max-width: 500px;
  margin: 0 auto;
  padding: 16px;
}
.tab-bar {
  display: flex;
  gap: 2px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 600;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.tab:hover {
  background: rgba(102, 126, 234, 0.08);
  color: var(--text);
}
.tab.active {
  background: linear-gradient(135deg, var(--primary), #764ba2);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow);
}
.tab-content {
  display: none;
  animation: fadeIn 0.2s ease;
}
.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ==================== QR SCANNER ==================== */
.scan-area {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
#qr-reader {
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}
#qr-reader video {
  width: 100% !important;
  border-radius: var(--radius);
}
#qr-reader__scan_region {
  min-height: 250px;
}

/* ==================== MANUAL ENTRY ==================== */
.manual-entry {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  box-shadow: var(--shadow);
}
.manual-entry h3 {
  margin-bottom: 6px;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.manual-entry p {
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 20px;
}

/* ==================== SCAN RESULT ==================== */
#scan-result {
  margin-top: 16px;
  animation: slideUp 0.2s ease;
}
.result-card {
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  border: 2px solid;
  background: var(--bg-card);
  box-shadow: var(--shadow);
}
.result-card.valid {
  border-color: var(--success);
}
.result-card.invalid {
  border-color: var(--danger);
}
.result-card.warning {
  border-color: var(--warning);
}

.result-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin: 0 auto 12px;
  border: 1px solid;
}
.result-card.valid .result-icon {
  background: #d5f5e3;
  color: var(--success);
  border-color: #a9dfbf;
}
.result-card.invalid .result-icon {
  background: #fadbd8;
  color: var(--danger);
  border-color: #f5b7b1;
}
.result-card.warning .result-icon {
  background: #fdebd0;
  color: var(--warning);
  border-color: #f5cba7;
}

.result-message {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 2px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.result-sub {
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 12px;
}

.result-details {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-top: 12px;
  text-align: left;
}
.result-details .detail-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
}
.result-details .detail-row:last-child {
  border-bottom: none;
}
.result-details .detail-row label {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.3px;
}

.result-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.result-actions .btn {
  flex: 1;
}

/* ==================== HISTORY ==================== */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary);
}
.history-header h3 {
  font-size: 14px;
  color: var(--text);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 6px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.history-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.history-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  border: 1px solid;
}
.history-icon.ok {
  background: #d5f5e3;
  color: var(--success);
  border-color: #a9dfbf;
}
.history-icon.fail {
  background: #fadbd8;
  color: var(--danger);
  border-color: #f5b7b1;
}
.history-icon.warn {
  background: #fdebd0;
  color: var(--warning);
  border-color: #f5cba7;
}

.history-info {
  flex: 1;
  min-width: 0;
}
.history-info .code {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  font-family: 'Courier New', monospace;
  letter-spacing: 0.5px;
}
.history-info .desc {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 2px;
}
.history-time {
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
  font-weight: 600;
}

.empty-state {
  text-align: center;
  padding: 36px 16px;
  color: var(--text-muted);
}
.empty-state i {
  font-size: 36px;
  margin-bottom: 10px;
  opacity: 0.3;
  display: block;
}
.empty-state p {
  font-size: 12px;
}

/* ==================== TOAST ==================== */
.toast {
  position: fixed;
  bottom: -80px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  z-index: 10000;
  transition: bottom 0.3s ease;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
  border: 1px solid;
}
.toast.show {
  bottom: 30px;
}
.toast.success {
  background: #d5f5e3;
  color: #1e8449;
  border-color: #a9dfbf;
}
.toast.error {
  background: #fadbd8;
  color: #922b21;
  border-color: #f5b7b1;
}
.toast.info {
  background: #d4e6f1;
  color: #21618c;
  border-color: #a9cce3;
}
.toast.warning {
  background: #fdebd0;
  color: #9c640c;
  border-color: #f5cba7;
}

/* ==================== ANIMATIONS ==================== */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 480px) {
  .scanner-wrapper {
    padding: 10px;
  }
  .login-card {
    padding: 24px 20px;
  }
  .tab {
    font-size: 11px;
    padding: 8px 6px;
  }
}
