/**
 * BRI Mobile Attendance - Core CSS Design System & Layout Architecture
 * Identity Colors: BRI Navy (#00529C, #002E5D), White (#FFFFFF), BRI Orange Accent (#F37021)
 */

:root {
  --bri-navy: #002E5D;
  --bri-blue: #00529C;
  --bri-orange: #F37021;
  --bri-orange-hover: #D95C0E;
  --bri-light-blue: #E8F1F9;
  
  --bg-body: #F4F7FA;
  --card-bg: #FFFFFF;
  --text-dark: #1E293B;
  --text-muted: #64748B;
  
  --status-hadir: #10B981;
  --status-terlambat: #F59E0B;
  --status-izin: #3B82F6;
  --status-alpha: #EF4444;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  
  --shadow-card: 0 4px 20px -2px rgba(0, 46, 93, 0.08);
  --shadow-header: 0 4px 12px rgba(0, 82, 156, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body.mobile-apk-body {
  background-color: #001529;
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  margin: 0;
}

/* Smartphone Container Shell */
.app-container {
  width: 100%;
  max-width: 440px;
  min-height: 100vh;
  background-color: var(--bg-body);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 50px rgba(0,0,0,0.6);
  overflow-x: hidden;
  padding-bottom: 80px;
}

/* On Desktop Large Screens: Rounded Device Mockup */
@media (min-width: 601px) {
  body.mobile-apk-body {
    padding: 20px 0;
  }
  .app-container {
    min-height: 840px;
    height: 840px;
    border-radius: 36px;
    border: 8px solid #002E5D;
    overflow-y: auto;
  }
}

/* On Mobile Device / Standalone App Mode: Fullscreen Edge-to-Edge */
@media all and (display-mode: standalone), (max-width: 600px) {
  body.mobile-apk-body {
    background: var(--bg-body);
    padding: 0;
    margin: 0;
  }
  .app-container {
    max-width: 100% !important;
    width: 100vw !important;
    min-height: 100vh !important;
    min-height: -webkit-fill-available !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    border: none !important;
  }
}

/* Top App Header */
.app-header {
  background: linear-gradient(135deg, var(--bri-navy) 0%, var(--bri-blue) 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-header);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bri-logo-badge {
  background: white;
  color: var(--bri-blue);
  font-weight: 900;
  font-size: 16px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

.app-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.btn-header-logout {
  background: #EF4444;
  color: white;
  border: none;
  border-radius: 20px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
  transition: transform 0.2s ease;
}

.btn-header-logout:active {
  transform: scale(0.95);
}

/* Top PWA Install Banner */
.pwa-install-banner {
  background: var(--bri-navy);
  color: white;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  border-bottom: 2px solid var(--bri-orange);
  width: 100%;
}

.btn-install-pwa {
  background: var(--bri-orange);
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 16px;
  font-weight: 800;
  font-size: 11px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(243, 112, 33, 0.4);
}

/* Main Content Wrapper */
.main-content {
  padding: 16px;
  flex: 1;
}

/* Cards System */
.card-box {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(226, 232, 240, 0.8);
}

/* Buttons System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--bri-blue);
  color: white;
}

.btn-orange {
  background: linear-gradient(135deg, var(--bri-orange) 0%, #D95C0E 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(243, 112, 33, 0.35);
}

.btn-block {
  width: 100%;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--bri-blue);
  color: var(--bri-blue);
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-hadir { background: #D1FAE5; color: #065F46; }
.badge-terlambat { background: #FEF3C7; color: #92400E; }
.badge-izin { background: #DBEAFE; color: #1E40AF; }
.badge-alpha { background: #FEE2E2; color: #991B1B; }

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid #CBD5E1;
  background: #F8FAFC;
  font-size: 14px;
  color: var(--text-dark);
  outline: none;
}

.form-control:focus {
  border-color: var(--bri-blue);
  background: white;
  box-shadow: 0 0 0 3px rgba(0, 82, 156, 0.1);
}

/* Toast Container */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 90%;
  max-width: 400px;
  pointer-events: none;
}

.toast {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: white;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: slideDown 0.3s ease;
}

.toast-success { background: #059669; }
.toast-error { background: #DC2626; }
.toast-info { background: #0284C7; }

@keyframes slideDown {
  from { transform: translateY(-30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Modal System */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: popUp 0.25s ease;
}

.modal-header {
  background: var(--bri-navy);
  color: white;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 18px;
}

@keyframes popUp {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
