:root {
  --bg-primary: #ffffff;
  --bg-secondary: #EDF5FF;
  --bg-card: #EDF5FF;
  --bg-input: #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #8B9DC3;
  --text-muted: #b8c5d9;
  --accent-color: #1D87FF;
  --accent-hover: #0a6edb;
  --modal-overlay: rgba(100, 116, 139, 0.7);
  --border-color: #e2e8f0;
  --region-bg: #d4e5f7;
  --region-text: #5a7da8;
  --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  --card-radius: 24px;
  --input-radius: 14px;
  --dropdown-bg: #1a1a1a;
  --dropdown-text: #ffffff;
}

[data-theme="dark"] {
  --bg-primary: #001328;
  --bg-secondary: #15273B;
  --bg-card: #15273B;
  --bg-input: #16304D;
  --text-primary: #ffffff;
  --text-secondary: #8B9DC3;
  --text-muted: #5a7da8;
  --accent-color: #1D87FF;
  --accent-hover: #0a6edb;
  --modal-overlay: rgba(0, 10, 25, 0.85);
  --border-color: #1e3a5f;
  --region-bg: #16304D;
  --region-text: #8B9DC3;
  --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  --card-radius: 24px;
  --input-radius: 14px;
  --dropdown-bg: #15273B;
  --dropdown-text: #ffffff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

img {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

.payment-container {
  min-height: 100vh;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 40px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 65px;
  align-items: stretch;
}

.left-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.left-panel {
  width: 482px;
  max-width: 100%;
}

.left-top {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-right: 14px;
}

.theme-btn {
  width: 36px;
  height: 36px;
  background: var(--bg-card);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--accent-color);
  box-shadow: var(--card-shadow);
  transition: background 0.2s;
}

.theme-btn:hover {
  background: var(--border-color);
}

.theme-icon {
  display: none;
}

[data-theme="light"] .theme-icon.moon,
:root:not([data-theme]) .theme-icon.moon {
  display: block;
}

[data-theme="dark"] .theme-icon.sun {
  display: block;
}

[data-theme="light"] .theme-icon.sun,
:root:not([data-theme]) .theme-icon.sun {
  display: none;
}

[data-theme="dark"] .theme-icon.moon {
  display: none;
}

.close-btn {
  width: 36px;
  height: 36px;
  background: var(--bg-card);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: var(--card-shadow);
}

.close-btn:hover { 
  background: var(--border-color); 
}

.close-btn img {
  width: 13px;
  height: 13px;
  display: block;
}

.amount-card { margin-top: 14px; }
.card-form  { margin-top: 20px; }
.pay-btn    { margin-top: 32px; }

.right-section {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

.phone-image {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: right bottom;
  z-index: 1;
  margin: 0;
  padding: 0;
  display: block;
}

.logo {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  height: auto;
  max-width: 70%;
  z-index: 2;
  pointer-events: none;
  bottom: calc(25px + min(673px, 100vh));
}

.logo-light {
  display: block;
}

.logo-dark {
  display: none;
}

[data-theme="dark"] .logo-light {
  display: none;
}

[data-theme="dark"] .logo-dark {
  display: block;
}

.amount-card {
  background: var(--bg-card);
  border-radius: var(--card-radius);
  padding: 20px 24px;
  box-shadow: var(--card-shadow);
}

.amount-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.amount-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
}

.shield-icon { width: 22px; height: 22px; }

.lang-dropdown { position: relative; }

.lang-dropdown-btn {
  background: var(--region-bg);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.lang-dropdown-btn:hover { 
  background: var(--border-color); 
}

.lang-dropdown-btn .dropdown-arrow {
  width: 16px;
  height: 16px;
  transition: transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lang-dropdown-btn .dropdown-arrow img {
  width: 16px;
  height: 16px;
}

.lang-dropdown.open .lang-dropdown-btn .dropdown-arrow { 
  transform: rotate(180deg); 
}

.lang-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--dropdown-bg);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s;
  z-index: 100;
  min-width: 140px;
}

.lang-dropdown.open .lang-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-option {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--dropdown-text);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s;
}

.lang-option:hover { 
  background: rgba(255,255,255,0.1); 
}

.lang-option.active {
  background: var(--accent-color);
  color: #ffffff;
}

.amount-display {
  margin: 12px 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.amount-value {
  font-size: 48px;
  font-weight: 700;
  color: var(--text-primary);
}

.amount-input {
  font-size: 48px;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--bg-input);
  border: none;
  border-radius: 12px;
  padding: 8px 16px;
  width: 180px;
  outline: none;
}

.amount-input:focus { 
  box-shadow: 0 0 0 2px var(--accent-color); 
}

.amount-input::-webkit-outer-spin-button,
.amount-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.amount-input[type=number] { -moz-appearance: textfield; }

.amount-currency {
  font-size: 20px;
  font-weight: 500;
  color: var(--text-primary);
}

.amount-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.payment-id {
  font-size: 13px;
  color: #848484;
  display: flex;
  align-items: center;
  gap: 6px;
}

.copy-icon { 
  cursor: pointer; 
  opacity: 0.7;
  transition: opacity 0.2s;
}

.copy-icon:hover {
  opacity: 1;
}

.timer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.time-icon { width: 18px; height: 18px; }

.card-form {
  background: var(--bg-card);
  border-radius: var(--card-radius);
  padding: 20px 20px 0px 20px;
  box-shadow: var(--card-shadow);
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.card-input {
  background: var(--bg-input);
  border: none;
  border-radius: var(--input-radius);
  padding: 14px 16px;
  font-size: 15px;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.card-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(29, 135, 255, 0.3);
}

.card-input::placeholder { color: var(--text-muted); }

.row { margin-left: -8px; margin-right: -8px; }
.row > .col-6 { padding-left: 8px; padding-right: 8px; }

.visa-logo {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.visa-logo img { height: 80px; }

.pay-btn {
  width: 100%;
  background: #1D87FF;
  color: #ffffff;
  border: none;
  border-radius: 16px;
  padding: 18px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.pay-btn:hover { background: #0a6edb; }
.pay-btn:disabled { background: #1a3a5c; cursor: not-allowed; }

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--modal-overlay);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.active { display: flex; }

.sms-modal {
  background: var(--bg-primary);
  border-radius: var(--card-radius);
  padding: 28px;
  width: 400px;
  box-shadow: var(--card-shadow);
}

.sms-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.sms-header span {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.sms-close-btn {
  width: 32px;
  height: 32px;
  background: var(--accent-color);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.sms-close-btn img {
  width: 11px;
  height: 11px;
  display: block;
  filter: brightness(0) invert(1);
}

.sms-input {
  width: 100%;
  background: var(--bg-card);
  border: none;
  border-radius: var(--input-radius);
  padding: 20px;
  font-size: 28px;
  text-align: center;
  letter-spacing: 16px;
  color: #ffffff;
  margin-bottom: 20px;
}

.sms-input:focus { outline: none; }
.sms-input::placeholder { color: var(--text-muted); }

.confirm-btn {
  width: 100%;
  background: #1D87FF;
  color: #ffffff;
  border: none;
  border-radius: 16px;
  padding: 18px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.confirm-btn:hover { background: #0a6edb; }

.loading-modal {
  background: var(--bg-primary);
  border-radius: var(--card-radius);
  padding: 40px 60px;
  text-align: center;
  box-shadow: var(--card-shadow);
}

.loading-modal p { color: var(--text-primary); }

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--bg-card);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

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

.result-modal {
  background: var(--bg-primary);
  border-radius: var(--card-radius);
  padding: 40px;
  width: 400px;
  text-align: center;
  position: relative;
  box-shadow: var(--card-shadow);
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  background: var(--accent-color);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.modal-close-btn img {
  width: 11px;
  height: 11px;
  display: block;
  filter: brightness(0) invert(1);
}

.result-icon { width: 80px; height: 80px; margin-bottom: 24px; }

.result-modal h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 28px;
}

@media (max-width: 1100px) {
  .payment-container {
    grid-template-columns: 1fr;
    padding: 20px;
    row-gap: 24px;
  }

  .left-section {
    min-height: auto;
    justify-content: center;
  }

  .left-panel {
    width: 100%;
    max-width: 482px;
  }

  .right-section {
    min-height: 420px;
  }

  .logo {
    max-width: 70%;
  }

  .phone-image {
    width: 100%;
    max-height: calc(100% - 56px);
    object-fit: contain;
    object-position: right bottom;
  }
}

@media (max-width: 768px) {
  .payment-container {
    grid-template-columns: 1fr;
    padding: 16px;
    row-gap: 0;
    min-height: auto;
  }

  .right-section {
    display: none;
  }

  .left-section {
    min-height: auto;
    justify-content: flex-start;
    align-items: stretch;
    padding-top: 20px;
    padding-bottom: 20px;
  }

  .left-panel {
    width: 100%;
    max-width: 482px;
    min-height: auto;
    display: flex;
    flex-direction: column;
  }

  .left-top {
    padding-top: 0;
  }

  .amount-card {
    margin-top: 20px;
  }

  .card-form {
    margin-top: 16px;
  }

  .pay-btn {
    margin-top: 24px;
    margin-bottom: 0;
  }
}
