/* Custom CSS Design System - Cafe Captive Portal */

:root {
  /* HSL Tailored Colors */
  --primary: hsl(35, 85%, 55%);         /* Warm golden amber */
  --primary-hover: hsl(35, 90%, 48%);
  --primary-bg-alpha: rgba(255, 179, 0, 0.1);
  
  --dark-bg: hsl(20, 20%, 8%);          /* Very dark warm gray */
  --card-bg: rgba(25, 18, 15, 0.75);    /* Semitransparent coffee brown */
  
  --text-primary: hsl(30, 20%, 95%);     /* Soft white cream */
  --text-secondary: hsl(30, 10%, 75%);   /* Muted warm gray */
  --border-color: rgba(255, 243, 224, 0.12);
  
  --error: hsl(0, 85%, 60%);             /* Warm red */
  --success: hsl(145, 65%, 45%);         /* Rich green */
  --facebook: hsl(220, 46%, 48%);        /* FB Blue */
  --instagram: #E1306C;                  /* Insta Pink/Red */

  /* Dimensions */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --transition-smooth: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
  --font-sans: 'Outfit', sans-serif;
  --font-serif: 'Playfair Display', serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--dark-bg);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
  padding: 16px;
}

/* Background image with blur and dark overlay */
.background-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('/bg.jpg');
  background-size: cover;
  background-position: center;
  filter: brightness(0.3) contrast(1.1) saturate(0.9);
  z-index: -1;
  transform: scale(1.05); /* Avoid white edges from blur */
}

/* Card Container with Glassmorphism */
.portal-container {
  width: 100%;
  max-width: 440px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 
              inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
  transition: var(--transition-smooth);
  animation: fadeInDown 0.6s ease-out;
}

/* Header Styling */
.portal-header {
  padding: 40px 32px 24px;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(180deg, rgba(255, 243, 224, 0.03) 0%, rgba(255, 243, 224, 0) 100%);
}

.logo-wrapper {
  width: 68px;
  height: 68px;
  margin: 0 auto 16px;
  background: var(--primary-bg-alpha);
  border: 1.5px solid var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px var(--primary-bg-alpha);
  animation: float 4s ease-in-out infinite;
  overflow: hidden;
}

.wifi-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.coffee-icon {
  width: 32px;
  height: 32px;
  color: var(--primary);
}

.portal-header h1 {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #FFF;
  margin-bottom: 6px;
}

.subtitle {
  font-size: 0.92rem;
  color: var(--text-secondary);
  font-weight: 300;
}

/* Form Layout */
.portal-body {
  padding: 32px;
}

.form-section {
  margin-bottom: 28px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.step-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--primary);
  color: var(--dark-bg);
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
}

.section-title h2 {
  font-size: 1.05rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
}

.section-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.45;
}

/* Input Fields */
.input-group {
  margin-bottom: 18px;
  position: relative;
}

.input-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
  pointer-events: none;
  transition: var(--transition-smooth);
}

.input-group input {
  width: 100%;
  padding: 14px 14px 14px 44px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #FFF;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition-smooth);
}

.input-group input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.input-group input:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary);
  box-shadow: 0 0 12px rgba(255, 179, 0, 0.15);
}

.input-group input:focus + .input-icon {
  color: var(--primary);
}

/* Error message styling */
.error-msg {
  display: none;
  font-size: 0.78rem;
  color: var(--error);
  margin-top: 6px;
  animation: shake 0.3s ease;
}

.input-group.invalid input {
  border-color: var(--error);
}

.input-group.invalid .error-msg {
  display: block;
}

/* Social Cards */
.social-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.social-card {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-primary);
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.social-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.social-icon-bg {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 14px;
  transition: var(--transition-smooth);
}

.social-svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Custom coloring per network */
.social-card.fb .social-icon-bg {
  background: rgba(24, 119, 242, 0.15);
  color: var(--facebook);
}
.social-card.fb:hover {
  border-color: rgba(24, 119, 242, 0.3);
}

.social-card.insta .social-icon-bg {
  background: rgba(225, 48, 108, 0.15);
  color: var(--instagram);
}
.social-card.insta:hover {
  border-color: rgba(225, 48, 108, 0.3);
}

.social-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.social-platform {
  font-size: 0.95rem;
  font-weight: 600;
  color: #FFF;
}

.social-action {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* Status Indicator */
.status-indicator {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.icon-check {
  width: 14px;
  height: 14px;
  stroke: #FFF;
  stroke-width: 3;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transform: scale(0.5);
  transition: var(--transition-smooth);
}

/* Completed Social Action */
.social-card.completed {
  border-color: var(--success);
  background: rgba(76, 175, 80, 0.05);
}

.social-card.completed .status-indicator {
  background: var(--success);
  border-color: var(--success);
}

.social-card.completed .icon-check {
  opacity: 1;
  transform: scale(1);
}

/* Bypass Checkbox Layout */
.checkbox-group {
  margin-top: 14px;
}

.custom-checkbox {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.custom-checkbox input {
  display: none;
}

.checkmark {
  width: 20px;
  height: 20px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  margin-right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
  position: relative;
}

.custom-checkbox:hover .checkmark {
  border-color: var(--primary);
  background: rgba(255, 179, 0, 0.05);
}

.custom-checkbox input:checked + .checkmark {
  background: var(--primary);
  border-color: var(--primary);
}

.checkmark::after {
  content: "";
  position: absolute;
  display: none;
  width: 5px;
  height: 9px;
  border: solid var(--dark-bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  top: 3px;
}

.custom-checkbox input:checked + .checkmark::after {
  display: block;
}

.checkbox-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 400;
  transition: var(--transition-smooth);
}

.custom-checkbox input:checked ~ .checkbox-text {
  color: var(--text-primary);
}

/* Connect Submit Button */
.connect-btn {
  width: 100%;
  padding: 16px;
  background: var(--primary);
  color: var(--dark-bg);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
  position: relative;
  box-shadow: 0 4px 15px rgba(255, 179, 0, 0.2);
}

.connect-btn:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255, 179, 0, 0.35);
}

.connect-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.connect-btn:disabled {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  box-shadow: none;
  cursor: not-allowed;
}

/* Spinner for Loading State */
.spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--dark-bg);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  position: absolute;
}

.connect-btn.loading .btn-text {
  visibility: hidden;
}

.connect-btn.loading .spinner {
  display: block;
}

/* Terms and Disclaimer */
.terms {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 16px;
  line-height: 1.4;
}

/* Success Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 8, 7, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.4s ease;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  text-align: center;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 25px 50px rgba(0,0,0,0.6);
  animation: zoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.success-icon-wrapper {
  margin: 0 auto 24px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content h2 {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: #FFF;
}

.modal-content p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
}

.cafe-details {
  background: rgba(255, 179, 0, 0.05);
  border: 1px solid rgba(255, 179, 0, 0.15);
  padding: 14px;
  border-radius: var(--radius-md);
  margin-bottom: 28px;
}

.wifi-tip {
  color: var(--primary) !important;
  font-size: 0.88rem !important;
  font-weight: 500;
  margin-bottom: 0 !important;
}

.modal-btn {
  width: 100%;
  padding: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: #FFF;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.modal-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

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

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

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

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
  100% { transform: translateY(0px); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Custom Success Checkmark SVG Animation */
.success-checkmark {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: block;
  stroke-width: 2;
  stroke: var(--success);
  stroke-miterlimit: 10;
  box-shadow: inset 0px 0px 0px var(--success);
  animation: fillCircle .4s ease-in-out .4s forwards, scaleUp .3s ease-in-out .9s both;
}

.success-checkmark__circle {
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  stroke-width: 2;
  stroke-miterlimit: 10;
  stroke: var(--success);
  fill: none;
  animation: strokeCircle .6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.success-checkmark__check {
  transform-origin: 50% 50%;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  stroke: var(--success);
  animation: strokeCheck .3s cubic-bezier(0.65, 0, 0.45, 1) .8s forwards;
}

@keyframes strokeCircle {
  100% { stroke-dashoffset: 0; }
}

@keyframes strokeCheck {
  100% { stroke-dashoffset: 0; }
}

@keyframes fillCircle {
  100% { box-shadow: inset 0px 0px 0px 40px rgba(76, 175, 80, 0.1); }
}

@keyframes scaleUp {
  0%, 100% { transform: none; }
  50% { transform: scale3d(1.1, 1.1, 1); }
}

/* ====================== */
/* Welcome Back Section   */
/* ====================== */
.welcome-back-section {
  display: none;
  padding: 32px;
  text-align: center;
  animation: fadeIn 0.5s ease;
}

.welcome-back-section.active {
  display: block;
}

.wb-avatar {
  font-size: 3rem;
  margin-bottom: 16px;
  animation: float 3s ease-in-out infinite;
}

.welcome-back-section h2 {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  color: #FFF;
  margin-bottom: 10px;
}

.welcome-back-section h2 span {
  color: var(--primary);
}

.wb-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}

.wb-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: rgba(76, 175, 80, 0.1);
  border: 1px solid rgba(76, 175, 80, 0.25);
  border-radius: 50px;
  color: var(--success);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 24px;
}

.not-me-link {
  display: block;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  margin-top: 14px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: var(--transition-smooth);
}

.not-me-link:hover {
  color: var(--primary);
}

/* ======================== */
/* Social Tip               */
/* ======================== */
.social-tip {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 14px;
  line-height: 1.5;
  padding: 10px 14px;
  background: rgba(255, 179, 0, 0.05);
  border: 1px solid rgba(255, 179, 0, 0.12);
  border-radius: var(--radius-sm);
}

/* ======================== */
/* Thank You Toast          */
/* ======================== */
.thank-you-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.95), rgba(56, 142, 60, 0.95));
  color: #FFF;
  padding: 14px 28px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  z-index: 200;
  box-shadow: 0 8px 25px rgba(76, 175, 80, 0.3);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.thank-you-toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast-icon {
  font-size: 1.2rem;
}

.toast-text {
  white-space: nowrap;
}

/* ================================= */
/* Already Liked Confirmation Modal  */
/* ================================= */
.already-liked-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 8, 7, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 150;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.4s ease;
}

.already-liked-overlay.active {
  display: flex;
}

.already-liked-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px 28px;
  text-align: center;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 25px 50px rgba(0,0,0,0.6);
  animation: zoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.already-liked-card .liked-emoji {
  font-size: 3.5rem;
  margin-bottom: 16px;
  display: block;
}

.already-liked-card h3 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: #FFF;
  margin-bottom: 10px;
}

.already-liked-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}

.liked-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.liked-actions .btn-confirm {
  width: 100%;
  padding: 14px;
  background: var(--success);
  color: #FFF;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.25);
}

.liked-actions .btn-confirm:hover {
  background: hsl(145, 65%, 38%);
  transform: translateY(-1px);
}

.liked-actions .btn-take-me {
  width: 100%;
  padding: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.liked-actions .btn-take-me:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.liked-actions .btn-cancel {
  width: 100%;
  padding: 10px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.liked-actions .btn-cancel:hover {
  color: var(--error);
}

/* Social card already-liked state */
.social-card.already-liked {
  border-color: var(--success);
  background: rgba(76, 175, 80, 0.08);
}

.social-card.already-liked .social-action {
  color: var(--success);
}

.social-card.already-liked .status-indicator {
  background: var(--success);
  border-color: var(--success);
}

.social-card.already-liked .icon-check {
  opacity: 1;
  transform: scale(1);
}

/* Social deep link tip banner */
.deep-link-tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 10px;
  padding: 12px 14px;
  background: rgba(24, 119, 242, 0.06);
  border: 1px solid rgba(24, 119, 242, 0.15);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.deep-link-tip .tip-icon {
  flex-shrink: 0;
  font-size: 1rem;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .portal-header {
    padding: 28px 20px 18px;
  }
  .portal-body {
    padding: 24px 20px;
  }
  .portal-header h1 {
    font-size: 1.55rem;
  }
  .welcome-back-section {
    padding: 24px 20px;
  }
  .already-liked-card {
    padding: 28px 20px;
  }
}
