/* ===== Reset ===== */
* {
  box-sizing: border-box;
  font-family: "ChulabhornLikitText", Tahoma, Geneva, Verdana, sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  line-height: 1.5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0052CC 0%, #1E88E5 50%, #00BCD4 100%);
  overflow: hidden;
}

/* ===== Animations ===== */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 0.3;
  }

  50% {
    opacity: 0.5;
  }
}

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

/* ===== Background Blobs ===== */
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.05;
  pointer-events: none;
  animation: pulse 8s infinite;
}

.blob.yellow {
  width: 400px;
  height: 400px;
  top: 10%;
  left: 5%;
  background: linear-gradient(135deg, #F59E0B, #FBBF24);
}

.blob.orange {
  width: 500px;
  height: 500px;
  bottom: 10%;
  right: 5%;
  background: linear-gradient(135deg, #EA580C, #F97316);
  animation-delay: 2s;
}

/* ===== Card ===== */
.card {
  width: 100%;
  max-width: 360px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  animation: slideUp 0.6s ease-out;
  z-index: 10;
}

/* ===== Header ===== */
.card-header {
  background: linear-gradient(135deg, #0D47A1, #1976D2, #42A5F5);
  padding: 36px 28px 40px;
  text-align: center;
  color: #fff;
}

.card-header h1 {
  font-size: 1.35rem;
  margin: 0 0 6px 0;
  font-weight: 600;
}

.card-header p {
  font-size: 0.85rem;
  margin: 0;
  opacity: 0.9;
}

.ring {
  width: 64px;
  height: 64px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ring-inner {
  width: 48px;
  height: 48px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
}

/* ===== Form ===== */
form {
  padding: 28px 28px 32px;
}

label {
  display: block;
  font-size: 12px;
  margin-bottom: 6px;
  color: #374151;
  font-weight: 500;
}

input {
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  outline: none;
  transition: 0.2s;
}

input::placeholder {
  color: #9ca3af;
}

input:focus {
  border-color: #1976D2;
}

.password-wrapper {
  position: relative;
}

.toggle-password {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #64748b;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-password svg {
  width: 20px;
  height: 20px;
  display: block;
}

.toggle-password:hover {
  color: #1976D2;
}

/* ===== Button ===== */
button.submit {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, #1565C0, #42A5F5);
  border-radius: 8px;
  border: none;
  cursor: pointer;
  margin-top: 8px;
  box-shadow: 0 4px 12px rgba(25, 118, 210, 0.35);
  transition: 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

button.submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(25, 118, 210, 0.5);
}

button.submit:disabled {
  background: #90CAF9;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* ===== Toast Notification ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transform: translateX(120%);
  transition: transform 0.3s ease;
  min-width: 250px;
  max-width: 350px;
}

.toast.show {
  transform: translateX(0);
}

.toast.success {
  background: linear-gradient(135deg, #10b981, #059669);
}

.toast.error {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.toast.warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
}

.toast-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.toast-close:hover {
  opacity: 1;
}

.toast-close svg {
  width: 16px;
  height: 16px;
}


/* ===== Responsive Design ===== */

/* Tablet */
@media (max-width: 768px) {
  .card {
    max-width: 380px;
    margin: 20px;
  }

  .card-header {
    padding: 32px 32px 40px;
  }

  .card-header h1 {
    font-size: 1.6rem;
  }

  form {
    padding: 28px 32px 36px;
  }
}

/* Mobile */
@media (max-width: 480px) {
  body {
    padding: 16px;
  }

  .card {
    max-width: 100%;
    margin: 0;
    border-radius: 16px;
  }

  .card-header {
    padding: 28px 24px 36px;
  }

  .card-header h1 {
    font-size: 1.4rem;
  }

  .card-header p {
    font-size: 0.9rem;
  }

  .ring {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
  }

  .ring-inner {
    width: 48px;
    height: 48px;
  }

  form {
    padding: 24px 24px 32px;
  }

  label {
    font-size: 13px;
  }

  input {
    padding: 12px 14px;
    font-size: 14px;
    border-radius: 10px;
  }

  button.submit {
    padding: 12px;
    font-size: 15px;
    border-radius: 10px;
  }

  .blob {
    display: none;
  }
}

/* Small Mobile */
@media (max-width: 360px) {
  .card-header {
    padding: 24px 20px 32px;
  }

  .card-header h1 {
    font-size: 1.25rem;
  }

  form {
    padding: 20px 20px 28px;
  }

  .ring {
    width: 56px;
    height: 56px;
  }

  .ring-inner {
    width: 42px;
    height: 42px;
  }
}

/* ===== Logged In Section ===== */
.logged-in-section {
  padding: 28px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: linear-gradient(135deg, #f0f7ff, #e8f4fd);
  border-radius: 12px;
  margin-bottom: 16px;
}

.user-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1565C0, #42A5F5);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 600;
  flex-shrink: 0;
}

.user-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.user-name {
  font-size: 16px;
  font-weight: 600;
  color: #1e3a5f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-username {
  font-size: 13px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.service-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #166534;
}

.service-info svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #22c55e;
}

.access-warning {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #92400e;
}

.access-warning svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #f59e0b;
}

.session-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-continue,
.btn-back,
.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-continue {
  background: linear-gradient(135deg, #1565C0, #42A5F5);
  color: white;
  box-shadow: 0 4px 12px rgba(25, 118, 210, 0.35);
}

.btn-continue:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(25, 118, 210, 0.5);
}

.btn-continue svg {
  width: 18px;
  height: 18px;
}

.btn-back {
  background: linear-gradient(135deg, #0d9488, #14b8a6);
  color: white;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.35);
}

.btn-back:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(13, 148, 136, 0.5);
}

.btn-back svg {
  width: 18px;
  height: 18px;
}

.btn-logout {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.btn-logout:hover {
  background: #e2e8f0;
  color: #334155;
}

.btn-logout svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 480px) {
  .logged-in-section {
    padding: 20px;
  }
  
  .user-info {
    padding: 12px;
    gap: 12px;
  }
  
  .user-avatar {
    width: 48px;
    height: 48px;
    font-size: 20px;
  }
  
  .user-name {
    font-size: 14px;
  }
  
  .user-username {
    font-size: 12px;
  }
}