/* ============================================
   BEAVARO ATTENDANCE SYSTEM — styles.css
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --red: #FF0020;
  --orange: #FD6A00;
  --black: #000000;
  --white: #FFFFFF;
  --ink-soft: #111111;
  --surface-strong: rgba(255, 255, 255, 0.92);
  --surface-muted: rgba(255, 255, 255, 0.74);
  --gray-100: #F5F5F5;
  --gray-200: #E8E8E8;
  --gray-400: #999999;
  --gray-600: #555555;
  --gray-800: #1A1A1A;
  --gray-900: #0E0E0E;
  --surface: #FAFAFA;
  --border: rgba(17, 17, 17, 0.08);
  --border-dark: rgba(17, 17, 17, 0.18);
  --radius: 12px;
  --radius-lg: 24px;
  --font: 'Helvetica Neue', Helvetica, 'Neue Haas Grotesk', Arial, sans-serif;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --focus-ring: 0 0 0 3px rgba(255, 0, 32, 0.15);
  --shadow-sm: 0 8px 18px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 18px 40px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 30px 80px rgba(15, 23, 42, 0.14);
  --hero-glow: radial-gradient(circle at top left, rgba(255, 0, 32, 0.16), transparent 34%), radial-gradient(circle at top right, rgba(253, 106, 0, 0.16), transparent 28%), linear-gradient(180deg, #fcfcfd 0%, #f3f4f6 100%);
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font);
  background: var(--hero-glow);
  color: var(--black);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

body::before,
body::after {
  content: '';
  position: fixed;
  inset: auto;
  pointer-events: none;
  z-index: 0;
}

body::before {
  top: 88px;
  left: -80px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: rgba(255, 0, 32, 0.06);
  filter: blur(20px);
}

body::after {
  right: -100px;
  bottom: 90px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: rgba(253, 106, 0, 0.08);
  filter: blur(24px);
}

/* ============================================
   APP SHELL
   ============================================ */

.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============================================
   HEADER
   ============================================ */

.app-header {
  background: rgba(10, 10, 10, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 32px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.brand-mark {
  width: 164px;
  height: 36px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.brand-mark-icon {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--white);
  letter-spacing: 0.12em;
  line-height: 1;
}

.brand-sub {
  font-size: 9px;
  font-weight: 500;
  color: var(--gray-400);
  letter-spacing: 0.2em;
  line-height: 1;
}

.header-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.header-time {
  font-size: 20px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.header-date {
  font-size: 10px;
  font-weight: 500;
  color: var(--gray-400);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1;
}

.header-rule {
  height: 3px;
  background: linear-gradient(90deg, var(--red) 0%, var(--orange) 100%);
}

/* ============================================
   MAIN
   ============================================ */

.main-content {
  flex: 1;
  padding: 64px 24px 80px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.form-container {
  width: 100%;
  max-width: 860px;
}

/* ============================================
   SECTION HEAD
   ============================================ */

.section-head {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 30px;
  padding: 28px 30px;
  border: 1px solid rgba(17, 17, 17, 0.07);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.78)),
    linear-gradient(135deg, rgba(255, 0, 32, 0.06), rgba(253, 106, 0, 0.06));
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.section-head::after {
  content: '';
  position: absolute;
  right: -44px;
  top: -44px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 0, 32, 0.12) 0%, rgba(255, 0, 32, 0) 70%);
}

.section-head-line {
  width: 6px;
  height: 88px;
  background: linear-gradient(180deg, var(--red) 0%, var(--orange) 100%);
  flex-shrink: 0;
  margin-top: 2px;
  border-radius: 999px;
  box-shadow: 0 0 0 6px rgba(255, 0, 32, 0.06);
}

.section-head-text {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.section-kicker {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.05);
  color: var(--gray-600);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.section-title {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--gray-900);
  line-height: 0.98;
}

.section-desc {
  max-width: 620px;
  font-size: 15px;
  font-weight: 500;
  color: var(--gray-600);
  letter-spacing: 0.01em;
  line-height: 1.6;
}

.section-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.section-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(17, 17, 17, 0.06);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: var(--shadow-sm);
}

/* ============================================
   FORM
   ============================================ */

.attendance-form {
  background: linear-gradient(180deg, var(--surface-strong), var(--surface-muted));
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  position: relative;
}

.attendance-form::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, var(--red), var(--orange));
}

/* --- Field Row --- */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 32px;
  border-bottom: 1px solid rgba(17, 17, 17, 0.06);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.3));
}

.field-row > .field-group:first-child {
  padding-right: 22px;
  border-right: 1px solid rgba(17, 17, 17, 0.08);
}

.field-row > .field-group:last-child {
  padding-left: 22px;
}

/* --- Field Group --- */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

/* --- Labels --- */
.field-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--gray-600);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.required-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  background: var(--red);
  border-radius: 50%;
  flex-shrink: 0;
}

/* --- Select Wrapper --- */
.select-wrapper {
  position: relative;
}

select {
  width: 100%;
  height: 54px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(17, 17, 17, 0.12);
  border-radius: var(--radius);
  color: var(--black);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  padding: 0 48px 0 16px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition), transform var(--transition);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

select:focus {
  border-color: var(--red);
  box-shadow: var(--focus-ring);
  background: var(--white);
}

select:hover:not(:focus) {
  border-color: rgba(17, 17, 17, 0.22);
  transform: translateY(-1px);
}

select option[value=""][disabled] {
  color: var(--gray-400);
}

.select-arrow {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-600);
  pointer-events: none;
  transition: color var(--transition);
}

select:focus + .select-arrow {
  color: var(--red);
}

/* --- Textarea --- */
textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(17, 17, 17, 0.12);
  border-radius: var(--radius);
  color: var(--black);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.65;
  padding: 14px 16px;
  resize: vertical;
  min-height: 96px;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition), transform var(--transition);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

textarea:focus {
  border-color: var(--red);
  box-shadow: var(--focus-ring);
  background: var(--white);
}

textarea:hover:not(:focus) {
  border-color: rgba(17, 17, 17, 0.22);
  transform: translateY(-1px);
}

textarea::placeholder {
  color: var(--gray-400);
  font-weight: 400;
}

/* --- Input --- */
input[type="time"],
input[type="number"] {
  width: 100%;
  height: 54px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(17, 17, 17, 0.12);
  border-radius: var(--radius);
  color: var(--black);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  padding: 0 16px;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition), transform var(--transition);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

input[type="time"]:focus,
input[type="number"]:focus {
  border-color: var(--red);
  box-shadow: var(--focus-ring);
  background: var(--white);
}

input[type="time"]:hover:not(:focus),
input[type="number"]:hover:not(:focus) {
  border-color: rgba(17, 17, 17, 0.22);
  transform: translateY(-1px);
}

input[type="number"]::placeholder {
  color: var(--gray-400);
}

/* --- Error State --- */
.field-error {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--red);
  text-transform: uppercase;
  display: none;
  margin-top: -2px;
}

.field-group.has-error select,
.field-group.has-error textarea,
.field-group.has-error input {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(255, 0, 32, 0.12);
}

.field-group.has-error .field-error {
  display: block;
}

/* ============================================
   CONDITIONAL BLOCKS
   ============================================ */

.conditional-block {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition:
    max-height var(--transition-slow),
    opacity var(--transition-slow);
}

.conditional-block.visible {
  max-height: 720px;
  opacity: 1;
}

.conditional-block .field-row {
  border-top: none;
  border-bottom: none;
  padding-bottom: 0;
}

.conditional-block > .field-group {
  padding: 0 32px;
  margin-bottom: 24px;
}

.conditional-block > .field-group:last-child {
  padding-bottom: 32px;
}

/* --- Block Divider --- */
.block-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px 32px 24px;
  border-top: 1px solid rgba(17, 17, 17, 0.06);
}

.block-tag {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--white);
  background: var(--black);
  padding: 8px 12px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

#blockSignIn .block-tag { background: var(--red); }
#blockSignOut .block-tag { background: var(--gray-800); }
#blockHalfLeave .block-tag { background: var(--orange); }
#blockFullLeave .block-tag { background: var(--black); }

.block-rule {
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, rgba(17, 17, 17, 0.14), rgba(17, 17, 17, 0));
}

/* ============================================
   FORM FOOTER
   ============================================ */

.form-footer {
  padding: 28px 32px 32px;
  background: linear-gradient(180deg, rgba(248, 248, 249, 0.78), rgba(255, 255, 255, 0.92));
  border-top: 1px solid rgba(17, 17, 17, 0.06);
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* ============================================
   SUBMIT BUTTON
   ============================================ */

.submit-btn {
  position: relative;
  height: 56px;
  padding: 0 42px;
  background: linear-gradient(135deg, var(--gray-900), var(--gray-800));
  color: var(--white);
  border: none;
  border-radius: 16px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background var(--transition), transform 0.1s ease, box-shadow var(--transition);
  min-width: 240px;
  outline: none;
  box-shadow: 0 16px 26px rgba(17, 17, 17, 0.22);
}

.submit-btn:focus-visible {
  box-shadow: var(--focus-ring);
}

.btn-accent {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--red) 0%, var(--orange) 100%);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.submit-btn:hover .btn-accent {
  transform: scaleX(1);
}

.submit-btn:hover {
  background: linear-gradient(135deg, var(--black), #2a2a2a);
  box-shadow: 0 18px 32px rgba(17, 17, 17, 0.28);
}

.submit-btn:active {
  transform: scale(0.98);
}

.submit-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.submit-btn:disabled:active {
  transform: none;
}

/* Button label */
.btn-label {
  transition: opacity var(--transition);
}

/* Button loader */
.btn-loader {
  display: none;
  align-items: center;
  gap: 5px;
}

.btn-loader span {
  display: inline-block;
  width: 5px;
  height: 5px;
  background: var(--white);
  border-radius: 50%;
  animation: loaderDot 0.9s infinite ease-in-out;
}

.btn-loader span:nth-child(2) { animation-delay: 0.15s; }
.btn-loader span:nth-child(3) { animation-delay: 0.3s; }

@keyframes loaderDot {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

.submit-btn.loading .btn-label {
  display: none;
}

.submit-btn.loading .btn-loader {
  display: flex;
}

/* ============================================
   SUCCESS PANEL
   ============================================ */

.success-panel {
  display: none;
  align-items: center;
  gap: 20px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.84));
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-left: 5px solid var(--red);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  padding: 26px 28px;
  margin-top: 6px;
  animation: slideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.success-panel.visible {
  display: flex;
}

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

.success-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--red), var(--orange));
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 12px 24px rgba(255, 0, 32, 0.24);
}

.success-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.success-text strong {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--black);
}

.success-text span {
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-600);
  line-height: 1.5;
}

.success-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.success-reset {
  height: 40px;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--black);
  border: 1px solid rgba(17, 17, 17, 0.12);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  flex-shrink: 0;
  outline: none;
}

.success-reset:hover {
  background: var(--black);
  border-color: var(--black);
  color: var(--white);
}

.success-reset:focus-visible {
  box-shadow: var(--focus-ring);
}

.success-exit {
  height: 40px;
  padding: 0 20px;
  background: linear-gradient(135deg, var(--gray-900), var(--gray-800));
  color: var(--white);
  border: 1px solid var(--black);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  flex-shrink: 0;
  outline: none;
}

.success-exit:hover {
  background: var(--red);
  border-color: var(--red);
  color: var(--white);
}

.success-exit:focus-visible {
  box-shadow: var(--focus-ring);
}

/* ============================================
   FOOTER
   ============================================ */

.app-footer {
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 500;
  color: var(--gray-400);
  letter-spacing: 0.06em;
  border-top: 1px solid rgba(17, 17, 17, 0.06);
  background: rgba(255, 255, 255, 0.52);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.footer-version {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--gray-400);
}

/* ============================================
   RESPONSIVE — TABLET
   ============================================ */

@media (max-width: 680px) {

  .brand {
    gap: 10px;
  }

  .brand-mark {
    width: 128px;
    height: 28px;
  }

  .header-inner {
    padding: 0 20px;
  }

  .header-time {
    font-size: 15px;
  }

  .brand-sub {
    font-size: 8px;
    letter-spacing: 0.16em;
  }

  .main-content {
    padding: 36px 16px 56px;
  }

  .section-title {
    font-size: 28px;
  }

  .section-head {
    margin-bottom: 24px;
    padding: 24px 22px;
  }

  .section-head-line {
    height: 72px;
  }

  .field-row {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 24px;
  }

  .field-row > .field-group:first-child {
    padding-right: 0;
    border-right: none;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
  }

  .field-row > .field-group:last-child {
    padding-left: 0;
  }

  .conditional-block > .field-group {
    padding: 0 24px;
  }

  .conditional-block > .field-group:last-child {
    padding-bottom: 24px;
  }

  .block-divider {
    padding: 16px 24px 20px;
  }

  .form-footer {
    padding: 22px 24px;
    justify-content: stretch;
  }

  .submit-btn {
    width: 100%;
    min-width: unset;
  }

  .success-panel {
    flex-wrap: wrap;
    gap: 14px;
  }

  .success-actions {
    width: 100%;
    flex-direction: column;
  }

  .success-reset,
  .success-exit {
    width: 100%;
    text-align: center;
  }

  .app-footer {
    padding: 16px 20px;
    font-size: 10px;
  }
}

@media (max-width: 400px) {
  .main-content {
    padding: 24px 12px 48px;
  }

  .section-head {
    padding: 22px 18px;
    gap: 16px;
  }

  .section-title {
    font-size: 20px;
  }

  select,
  input[type="time"],
  input[type="number"] {
    height: 52px;
    font-size: 16px; /* prevent iOS zoom */
  }

  textarea {
    font-size: 16px; /* prevent iOS zoom */
  }
}

/* ============================================
   FOCUS VISIBLE
   ============================================ */

:focus-visible {
  outline: none;
}
