/* ===== CSS VARIABLES ===== */
:root {
  --primary-color: #25d366;
  --gradient: linear-gradient(90deg,#43cea2 0%,#185a9d 100%);
  --card-radius: 24px;
  --shadow: 0 8px 32px rgba(60,72,100,0.13), 0 1.5px 8px rgba(60,72,100,0.09);
  --header-bg: #fff;
  --bg: #f7f8fc;
  --title-color: #185a9d;
  --text-color: #23272f;
  --subtitle-color: #586174;
  --success: #20c787;
  --error: #e94242;
  --verify: #ffad1d;
  --card-padding: 40px 34px 34px 34px;
}

/* ===== DARK THEME ===== */
[data-theme="dark"] {
  --header-bg: #23262b;
  --bg: #191b1f;
  --title-color: #59a2e7;
  --text-color: #e4e7ee;
  --subtitle-color: #aeb7c1;
}

/* ===== BASE STYLES ===== */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  font-family: 'Inter', Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: background 0.3s ease;
}

/* ===== HEADER SECTION ===== */
.header-app {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 480px;
  margin: 38px 0 36px 0;
  padding: 20px 32px;
  background: var(--header-bg);
  border-radius: 18px;
  box-shadow: var(--shadow);
  gap: 22px;
  transition: background 0.3s ease;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.logo-app {
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  height: 44px;
  background: var(--primary-color);
  border-radius: 13px;
  box-shadow: 0 2px 10px rgba(37, 211, 102, 0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.logo-app img {
  width: 28px;
  height: 28px;
  display: block;
  object-fit: contain;
}

.header-titles {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-title {
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--text-color);
  line-height: 1.13;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-subtitle {
  font-size: 0.96rem;
  color: var(--subtitle-color);
  font-weight: 400;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.action-btn {
  background: #f6f6f8;
  border: 1.5px solid #edeef0;
  border-radius: 11px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.18rem;
  transition: all 0.18s ease;
  color: #23272f;
  outline: none;
}

[data-theme="dark"] .action-btn {
  color: #e5e6e9;
  background: #23262b;
  border-color: #353944;
}

.action-btn:hover {
  background: #e4f6ed;
  border-color: #d3f5e3;
  transform: translateY(-1px);
}

[data-theme="dark"] .action-btn:hover {
  background: #1c232a;
  border-color: #25d366;
}

/* ===== MAIN CARD ===== */
.main-card {
  background: #fff;
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
  padding: var(--card-padding);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 480px;
  margin: 34px 0;
  transition: background 0.3s ease;
  text-align: center;
  position: relative;
}

[data-theme="dark"] .main-card {
  background: #23262b;
}

.brand-logo {
  border-radius: 16px;
  margin: 0px auto 18px auto;
  padding: 10px 32px 8px 32px;
  min-width: 190px;
  min-height: 74px;
  max-width: 290px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 22px rgba(40, 60, 120, 0.09);
}

.brand-logo img {
  height: 56px;
  margin-right: 8px;
  margin-left: -10px;
}

.main-title {
  color: var(--title-color);
  font-weight: 700;
  font-size: 1.24rem;
  margin-bottom: 18px;
  margin-top: 10px;
  line-height: 1.2;
}

.main-desc {
  color: var(--text-color);
  font-size: 1.08rem;
  margin-bottom: 28px;
  line-height: 1.5;
  font-weight: 400;
}

/* ===== SERVICE SELECTOR ===== */
.service-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin: 20px 0;
  width: 100%;
  max-width: 400px;
}

.service-btn {
  padding: 12px;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: #495057;
}

.service-btn:hover {
  border-color: #43cea2;
  background: #f8f9fa;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(67, 206, 162, 0.15);
}

.service-btn.active {
  border-color: #43cea2;
  background: #e8f5e8;
  color: #185a9d;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(67, 206, 162, 0.25);
}

[data-theme="dark"] .service-btn {
  background: #2c2f36;
  border-color: #495057;
  color: #adb5bd;
}

[data-theme="dark"] .service-btn:hover,
[data-theme="dark"] .service-btn.active {
  background: #1a4c96;
  border-color: #43cea2;
  color: #ffffff;
}

/* ===== MAIN BUTTON ===== */
.main-btn {
  padding: 18px 0;
  width: 85%;
  max-width: 350px;
  font-size: 1.15em;
  font-weight: 700;
  background: var(--gradient);
  color: #fff;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(67,206,162,0.07);
  transition: all 0.19s ease;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.main-btn:hover {
  background: linear-gradient(90deg,#185a9d 0%,#43cea2 100%);
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 25px rgba(67,206,162,0.25);
}

.main-btn .arrow {
  font-size: 1.3em;
  margin-left: 10px;
  transition: margin 0.2s ease;
}

.main-btn:hover .arrow {
  margin-left: 16px;
}

/* ===== LOADING STATE ===== */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #fff;
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===== ALERTS ===== */
.main-alert {
  width: 90%;
  max-width: 350px;
  margin: 0 auto 20px auto;
  border-radius: 12px;
  font-size: 1.14em;
  font-weight: 600;
  padding: 14px 22px;
  box-shadow: 0 2px 10px rgba(40,60,100,0.06);
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  text-align: left;
  min-height: unset;
  animation: slideInDown 0.3s ease;
}

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

.main-alert.success {
  background: rgba(255,255,255,0.97);
  border: 2px solid #20c787;
  color: #14b47e;
}

.main-alert.success::before {
  content: '✅';
  position: absolute;
  left: 16px;
  font-size: 1.4em;
}

.main-alert.error {
  background: #fff7f7;
  border: 2px solid #ffd3d7;
  color: var(--error);
}

.main-alert.error::before {
  content: '❌';
  position: absolute;
  left: 16px;
  font-size: 1.4em;
}

.main-alert.verify {
  background: #fffdf4;
  border: 2px solid #ffe6ad;
  color: var(--verify);
}

.main-alert.verify::before {
  content: '🔎';
  position: absolute;
  left: 16px;
  font-size: 1.4em;
}

.main-alert.none {
  display: none;
}

/* ===== MODAL ===== */
.modal-bg {
  position: fixed;
  z-index: 9999;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-bg.active { 
  display: flex;
  animation: fadeIn 0.3s ease;
}

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

.modal-content {
  background: #fff;
  border-radius: 20px;
  padding: 36px 38px;
  min-width: 320px;
  max-width: 95vw;
  box-shadow: var(--shadow);
  text-align: left;
  color: #233;
  font-size: 1.12em;
  animation: slideInUp 0.3s ease;
}

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

[data-theme="dark"] .modal-content {
  background: #23262b;
  color: #e4e7ee;
}

.modal-content label {
  font-weight: 700;
  color: #1a305d;
  margin-bottom: 7px;
  display: block;
}

[data-theme="dark"] .modal-content label {
  color: #59a2e7;
}

.modal-content input {
  border: 1.7px solid #c2d7ed;
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 1.07em;
  margin-bottom: 20px;
  width: 95%;
  display: block;
  margin-top: 7px;
  background: #fff;
  color: #333;
  transition: border-color 0.2s ease;
}

.modal-content input:focus {
  outline: none;
  border-color: #43cea2;
  box-shadow: 0 0 0 3px rgba(67, 206, 162, 0.1);
}

[data-theme="dark"] .modal-content input {
  background: #191b1f;
  color: #e4e7ee;
  border-color: #353944;
}

.modal-actions {
  margin-top: 10px;
  text-align: right;
}

.modal-actions button {
  background: #185a9d;
  color: #fff;
  padding: 10px 24px;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 600;
  margin-left: 8px;
  transition: all 0.2s ease;
}

.modal-actions button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(24, 90, 157, 0.3);
}

.modal-actions button:first-child {
  background: #6c757d;
}

.modal-actions button:first-child:hover {
  box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

/* ===== SWEETALERT2 CUSTOMIZATION ===== */
.swal2-popup {
  font-family: 'Inter', Arial, sans-serif !important;
  border-radius: 24px !important;
  box-shadow: 0 8px 32px rgba(60,72,100,0.13), 0 1.5px 8px rgba(60,72,100,0.09) !important;
  background: var(--header-bg, #fff) !important;
  padding-bottom: 34px !important;
}

.swal2-title {
  color: var(--title-color, #185a9d) !important;
  font-weight: 700 !important;
  font-size: 1.62rem !important;
  margin-top: 18px;
}

.swal2-html-container {
  color: var(--subtitle-color, #586174) !important;
  font-size: 1.13rem !important;
  margin-top: 6px;
}

.swal2-icon.swal2-error {
  border-color: #e94242 !important;
  color: #e94242 !important;
}

.swal2-icon.swal2-success {
  border-color: #20c787 !important;
  color: #20c787 !important;
}

.swal2-icon {
  margin-top: 22px;
}

.swal2-confirm {
  border-radius: 11px !important;
  font-family: 'Inter', Arial, sans-serif !important;
  font-size: 1.07rem !important;
  background: linear-gradient(90deg, #43cea2 0%, #185a9d 100%) !important;
  color: #fff !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 10px rgba(67,206,162,0.09);
  border: none !important;
  padding: 13px 34px !important;
  margin-top: 8px !important;
  transition: background 0.2s;
}

.swal2-confirm:focus, 
.swal2-confirm:hover {
  background: linear-gradient(90deg, #185a9d 0%, #43cea2 100%) !important;
}

.swal2-confirm:focus { 
  box-shadow: none !important; 
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 700px) {
  .header-app, .main-card { 
    max-width: 98vw; 
  }
  
  .main-card { 
    margin: 14px 0; 
    padding: 19px 4vw 24px 4vw; 
  }
  
  .brand-logo img { 
    height: 39px; 
  }
  
  .brand-logo { 
    min-width: 128px; 
    min-height: 43px; 
    padding: 8px 14px; 
  }
  
  .main-btn { 
    font-size: 1em; 
    padding: 12px 0; 
  }
  
  .service-selector {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  
  .service-btn {
    font-size: 0.8rem;
    padding: 8px;
  }
}

@media (max-width: 480px) {
  .header-app {
    margin: 20px 0 20px 0;
    padding: 15px 20px;
  }
  
  .header-titles {
    gap: 8px;
  }
  
  .app-title {
    font-size: 1rem;
  }
  
  .app-subtitle {
    font-size: 0.85rem;
  }
  
  .main-title {
    font-size: 1.1rem;
  }
  
  .main-desc {
    font-size: 1rem;
  }
  
  .swal2-popup {
    padding: 10px 0 20px 0 !important;
    border-radius: 16px !important;
  }
  
  .swal2-title {
    font-size: 1.14rem !important;
  }
}