/* =============================================
   SekolahCMS — Floating Contact Widget v3
   Pojok kanan bawah, popup kontak + inline form
   ============================================= */

/* FAB button */
.cw-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9990;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #0055A4, #0077DA);
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 85, 164, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.cw-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 10px 28px rgba(0, 85, 164, 0.45);
}

.cw-fab:active {
  transform: scale(0.95);
}

.cw-fab::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  border: 2px solid #0055A4;
  opacity: 0;
  animation: cw-pulse 2s ease-out infinite;
}

@keyframes cw-pulse {
  0%   { opacity: 0.6; transform: scale(1); }
  100% { opacity: 0;   transform: scale(1.5); }
}

.cw-fab .cw-fab-icon {
  transition: transform 0.3s ease;
  display: inline-block;
}

.cw-fab.cw-open .cw-fab-icon {
  transform: rotate(135deg);
}

.cw-fab.cw-open::before {
  animation: none;
  opacity: 0;
}

/* Popup panel */
.cw-panel {
  position: fixed;
  bottom: 100px;
  right: 24px;
  z-index: 9989;
  width: 340px;
  max-width: calc(100vw - 48px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.25s ease;
}

.cw-panel.cw-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* Header */
.cw-header {
  background: linear-gradient(135deg, #0055A4, #0077DA);
  color: #fff;
  padding: 20px;
  text-align: center;
  position: relative;
}

.cw-header-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 6px;
  line-height: 1.3;
}

.cw-header-subtitle {
  font-size: 0.82rem;
  opacity: 0.92;
  margin: 0;
  line-height: 1.4;
}

/* Views (main / form) */
.cw-view {
  display: none;
}

.cw-view.cw-active {
  display: block;
}

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

.cw-icons {
  padding: 16px;
  background: #f8f9fb;
}

.cw-icons-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.cw-icons-row + .cw-icons-row {
  margin-top: 8px;
}

.cw-icon-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 4px;
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  text-decoration: none;
  color: #555;
  font-size: 0.65rem;
  font-weight: 600;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
  min-height: 64px;
}

.cw-icon-btn:hover {
  border-color: #0055A4;
  color: #0055A4;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 85, 164, 0.12);
}

.cw-icon-btn i {
  font-size: 1.5rem;
  margin-bottom: 2px;
  transition: transform 0.2s ease;
}

/* Brand colors */
.cw-icon-btn[data-type="maps"]      i { color: #DB4437; }
.cw-icon-btn[data-type="email"]     i { color: #EA4335; }
.cw-icon-btn[data-type="form"]      i { color: #0055A4; }
.cw-icon-btn[data-type="whatsapp"]  i { color: #25D366; }
.cw-icon-btn[data-type="instagram"] i { color: #E1306C; }
.cw-icon-btn[data-type="facebook"]  i { color: #1877F2; }
.cw-icon-btn[data-type="youtube"]   i { color: #FF0000; }
.cw-icon-btn[data-type="tiktok"]    i { color: #000;    }

.cw-icon-btn:hover i {
  transform: scale(1.1);
}

/* Footer */
.cw-footer {
  padding: 10px 16px 12px;
  text-align: center;
  background: #f8f9fb;
  border-top: 1px solid #e9ecef;
}

.cw-footer-text {
  font-size: 0.72rem;
  color: #8895a7;
  margin: 0 0 2px;
}

.cw-footer-phone {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  color: #0055A4;
  text-decoration: none;
  font-weight: 700;
  margin: 0;
}

.cw-footer-phone:hover {
  color: #003d76;
  text-decoration: underline;
}

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

.cw-form-body {
  padding: 16px;
  background: #fff;
}

.cw-form-group {
  margin-bottom: 12px;
}

.cw-form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}

.cw-form-group input,
.cw-form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
  background: #fff;
  color: #333;
  transition: border-color 0.2s, box-shadow 0.2s;
  resize: none;
}

.cw-form-group input:focus,
.cw-form-group textarea:focus {
  outline: none;
  border-color: #0055A4;
  box-shadow: 0 0 0 3px rgba(0, 85, 164, 0.12);
}

.cw-form-group textarea {
  min-height: 80px;
  resize: vertical;
}

.cw-form-help {
  display: block;
  font-size: 0.7rem;
  color: #8895a7;
  margin-top: 4px;
}

.cw-form-error {
  display: block;
  font-size: 0.72rem;
  color: #dc3545;
  margin-top: 4px;
  min-height: 16px;
}

.cw-submit-btn {
  width: 100%;
  padding: 10px;
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cw-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 211, 102, 0.35);
}

.cw-submit-btn:active {
  transform: translateY(0);
}

.cw-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: #0055A4;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  margin-bottom: 8px;
  transition: color 0.15s;
}

.cw-back-btn:hover {
  color: #003d76;
}

/* Mobile responsive */
@media (max-width: 480px) {
  .cw-fab {
    bottom: 16px;
    right: 16px;
    width: 54px;
    height: 54px;
    font-size: 1.4rem;
  }

  .cw-panel {
    bottom: 88px;
    right: 16px;
    left: 16px;
    width: auto;
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cw-fab,
  .cw-panel,
  .cw-icon-btn,
  .cw-fab .cw-fab-icon,
  .cw-submit-btn,
  .cw-form-group input,
  .cw-form-group textarea {
    transition: none;
  }
  .cw-fab::before {
    animation: none;
  }
}