/* ==========================================
   CJ Mobile App - Common Styles
   ========================================== */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* CSS Variables */
:root {
  --primary: #5B2DDB;
  --primary-dark: #4A1FC7;
  --primary-light: #7B42F6;
  --primary-gradient: linear-gradient(135deg, #5B2DDB 0%, #7B42F6 50%, #9B59F6 100%);
  --bg-color: #FFFFFF;
  --text-color: #222222;
  --text-secondary: #666666;
  --text-placeholder: #B0B0B0;
  --input-bg: #F2F0F7;
  --input-border: #E8E5EF;
  --border-radius: 28px;
  --border-radius-sm: 20px;
  --font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Reset */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

input, button {
  font-family: var(--font-family);
  outline: none;
  border: none;
}

ul, ol {
  list-style: none;
}

/* ==========================================
   Page Container
   ========================================== */
.page-container {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  background-color: var(--bg-color);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ==========================================
   Header - For pages like Forgot Password
   ========================================== */
.page-header {
  position: relative;
  width: 100%;
  z-index: 10;
}

.page-header-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 20px;
  padding-top: calc(env(safe-area-inset-top, 12px) + 16px);
  position: relative;
  z-index: 2;
}

.page-header-bar .back-btn {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  cursor: pointer;
  z-index: 3;
  padding-top: calc(env(safe-area-inset-top, 12px));
}

.page-header-bar .back-btn svg {
  width: 24px;
  height: 24px;
  fill: #FFFFFF;
}

.page-header-bar .header-title {
  font-size: 20px;
  font-weight: 600;
  color: #FFFFFF;
  letter-spacing: 0.3px;
}

.header-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.header-bg-gradient {
  width: 100%;
  height: 100%;
  background: var(--primary-gradient);
}

.header-wave {
  position: relative;
  width: 100%;
  margin-top: -2px;
  z-index: 1;
}

.header-wave img {
  width: 100%;
  display: block;
}

/* ==========================================
   Top Hero Area (Login/Register)
   ========================================== */
.hero-section {
  position: relative;
  width: 100%;
  padding: 0 24px;
  padding-top: 24px;
}

.hero-content {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 8px;
}

.hero-logo {
  width: 64px;
  height: auto;
  flex-shrink: 0;
}

.hero-product-img {
  width: 65%;
  max-width: 280px;
  height: auto;
  object-fit: contain;
  margin-top: -10px;
}

.hero-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-color);
  padding: 0 0 4px 0;
  letter-spacing: 0.5px;
}

/* ==========================================
   Form Styles
   ========================================== */
.form-section {
  padding: 0 24px;
  flex: 1;
}

.form-group {
  margin-bottom: 16px;
}

.form-input {
  width: 100%;
  height: 52px;
  background: var(--input-bg);
  border: 1px solid transparent;
  border-radius: var(--border-radius);
  padding: 0 20px;
  font-size: 14px;
  color: var(--text-color);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input::placeholder {
  color: var(--text-placeholder);
  font-weight: 300;
}

.form-input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(91, 45, 219, 0.1);
}

/* Input with button (verify) */
.input-with-btn {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-btn .form-input {
  padding-right: 110px;
}

.input-with-btn .verify-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  height: 40px;
  padding: 0 24px;
  background: var(--primary);
  color: #FFFFFF;
  border: none;
  border-radius: 22px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
  white-space: nowrap;
}

.input-with-btn .verify-btn:active {
  background: var(--primary-dark);
  transform: translateY(-50%) scale(0.96);
}

/* Input with captcha image */
.input-with-captcha {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-captcha .form-input {
  padding-right: 120px;
}

.input-with-captcha .captcha-img {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  height: 36px;
  width: auto;
  cursor: pointer;
  border-radius: 4px;
}

/* Phone prefix */
.input-with-prefix {
  position: relative;
}

.input-with-prefix .phone-prefix {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-placeholder);
  font-size: 14px;
  font-weight: 400;
  pointer-events: none;
  z-index: 1;
}

.input-with-prefix .form-input {
  padding-left: 60px;
}

/* ==========================================
   Buttons
   ========================================== */
.btn-primary {
  display: block;
  width: 100%;
  height: 56px;
  background: var(--primary);
  color: #FFFFFF;
  border: none;
  border-radius: var(--border-radius);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 16px rgba(91, 45, 219, 0.35);
}

.btn-primary:active {
  background: var(--primary-dark);
  transform: scale(0.98);
  box-shadow: 0 2px 8px rgba(91, 45, 219, 0.25);
}

/* ==========================================
   Bottom Links
   ========================================== */
.bottom-link {
  text-align: center;
  padding: 16px 24px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.bottom-link a {
  color: var(--primary);
  font-weight: 500;
  text-decoration: underline;
}

.bottom-link-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 24px;
  font-size: 14px;
  color: var(--text-secondary);
}

.bottom-link-row .lock-icon {
  width: 20px;
  height: 20px;
  opacity: 0.5;
}

.bottom-link-row a {
  color: var(--primary);
  font-weight: 500;
  font-style: italic;
  text-decoration: underline;
}

/* ==========================================
   Bottom Decoration
   ========================================== */
.bottom-decoration {
  margin-top: auto;
  position: relative;
  width: 100%;
}

.bottom-icons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 24px;
}

.bottom-icons .icon-item {
  opacity: 0.3;
  display: flex;
  align-items: center;
  gap: 4px;
}

.bottom-icons .icon-item svg {
  width: 28px;
  height: 28px;
  fill: #888888;
}

.bottom-icons .icon-center {
  display: flex;
  align-items: center;
  gap: 16px;
  opacity: 0.3;
}

.bottom-icons .icon-center span {
  font-size: 20px;
  color: #888888;
}

.bottom-wave {
  width: 100%;
  display: block;
}

.bottom-wave img {
  width: 100%;
  display: block;
}

/* ==========================================
   Description Text
   ========================================== */
.description-text {
  padding: 24px 24px 20px;
  font-size: 14px;
  color: var(--text-color);
  line-height: 1.7;
  font-weight: 400;
}

/* ==========================================
   Bottom Tab Bar
   ========================================== */
.bottom-tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: #FFFFFF;
  border-top: 1px solid #F0EDF5;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 8px 0;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
  z-index: 100;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  cursor: pointer;
  flex: 1;
}

.tab-item .tab-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.tab-item .tab-label {
  font-size: 11px;
  color: #999999;
  font-weight: 400;
}

.tab-item.active .tab-label {
  color: var(--primary);
  font-weight: 500;
}

/* Page with tab bar needs bottom padding */
.has-tab-bar {
  padding-bottom: 70px;
}

/* ==========================================
   Inner Page Header (white bg with back arrow)
   ========================================== */
.inner-header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: sticky;
  top: 0;
  z-index: 50;
  background: #FFFFFF;
  padding: 15px 20px 5px 20px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 16px);
  border-bottom: 1px solid #F0EDF5;
}

/* Gray theme styles */
.bg-light-gray {
  background-color: #F2F2F2 !important;
}

.bg-light-gray .inner-header {
  background: transparent;
  border-bottom: none;
}

.bg-light-gray .tab-nav {
  background: transparent;
  border-bottom: none;
}

.bg-light-gray .winner-card,
.bg-light-gray .faq-item,
.bg-light-gray .article-content {
  background: #FFFFFF;
  border: none;
}

.inner-header .back-btn {
  position: absolute;
  left: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  cursor: pointer;
}

.inner-header .back-btn svg {
  width: 22px;
  height: 22px;
}

.inner-header .inner-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-color);
}

/* ==========================================
   Horizontal Tab Navigation
   ========================================== */
.tab-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 20px;
  border-bottom: 1px solid #F0EDF5;
  background: #FFFFFF;
}

.tab-nav-item {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 400;
  cursor: pointer;
  padding-bottom: 6px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
}

.tab-nav-item.active {
  color: var(--primary);
  font-weight: 600;
  border-bottom-color: var(--primary);
}

/* ==========================================
   Winner Card List
   ========================================== */
.winner-list {
  padding: 12px 16px;
}

.winner-card {
  background: #FAFAFA;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
  border: 1px solid #F0EDF5;
}

.winner-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.winner-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: contain;
  background-color: #E6E1F4;
  flex-shrink: 0;
}

.winner-info .winner-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-color);
}

.winner-info .winner-id {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.winner-detail-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 4px;
}

.winner-detail-row .label {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-color);
}

.winner-detail-row .value {
  font-size: 15px;
  color: #0DB04B;
  font-weight: 500;
}

.winner-detail-row .value.green {
  color: #0DB04B;
}

.winner-product {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-color);
  margin-bottom: 4px;
}

.winner-number-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.winner-number-row .label {
  font-size: 13px;
  color: var(--text-secondary);
}

.winner-number-row .number {
  font-size: 15px;
  font-weight: 500;
  color: #0DB04B;
}

/* ==========================================
   FAQ / Help Styles
   ========================================== */
.faq-list {
  padding: 12px 16px;
}

.faq-item {
  background: #FAFAFA;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid #F0EDF5;
}

.faq-question {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.faq-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  flex-shrink: 0;
}

.faq-badge.badge-a {
  background: #DADADA;
  color: #333333;
}

.faq-badge.badge-q {
  background: var(--primary);
  color: #FFFFFF;
}

.faq-question-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-color);
  line-height: 1.5;
  padding-top: 2px;
}

.faq-answer {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.faq-answer-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  padding-top: 2px;
}

/* ==========================================
   Content Article Styles
   ========================================== */
.article-content {
  padding: 20px 20px;
}

.article-content h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-color);
  margin: 20px 0 8px;
}

.article-content h2:first-child {
  margin-top: 0;
}

.article-content h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-color);
  margin: 16px 0 6px;
}

.article-content p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 10px;
}

.article-content .section-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-color);
  margin: 24px 0 10px;
}

/* About page card */
.about-card {
  background: #FFFFFF;
  border-radius: 12px;
  padding: 20px;
  margin: 16px;
  border: none;
}

.about-logo-section {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.about-logo-section .about-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.about-logo-section .about-brand {
  flex: 1;
}

.about-logo-section .about-brand h1 {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-color);
}

.about-logo-section .about-brand h1 span {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-color);
  margin-left: 2px;
}

.about-logo-section .about-brand p {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.about-address {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
}

.about-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.license-img {
  width: 100%;
  border-radius: 8px;
  margin-top: 12px;
}

/* ==========================================
   Responsive Adjustments
   ========================================== */

/* Very small phones (320px - iPhone SE old) */
@media screen and (max-width: 340px) {
  .hero-title {
    font-size: 22px;
  }

  .hero-logo {
    width: 50px;
  }

  .form-input {
    height: 46px;
    font-size: 13px;
  }

  .btn-primary {
    height: 50px;
    font-size: 16px;
  }

  .form-section {
    padding: 0 16px;
  }

  .description-text {
    padding: 16px 16px 12px;
    font-size: 13px;
  }

  .input-with-btn .verify-btn {
    padding: 0 18px;
    font-size: 13px;
  }
}

/* Standard phones (375px - iPhone SE) */
@media screen and (min-width: 341px) and (max-width: 389px) {
  .hero-title {
    font-size: 24px;
  }
}

/* Medium phones (390px - iPhone 12/13/14) */
@media screen and (min-width: 390px) and (max-width: 413px) {
  .hero-title {
    font-size: 26px;
  }
}

/* Large phones (414px+ - iPhone Plus/Pro Max) */
@media screen and (min-width: 414px) {
  .hero-title {
    font-size: 28px;
  }

  .form-input {
    height: 54px;
  }

  .btn-primary {
    height: 58px;
    font-size: 19px;
  }
}

/* Landscape orientation */
@media screen and (orientation: landscape) and (max-height: 500px) {
  .hero-section {
    padding-top: 12px;
  }

  .hero-product-img {
    max-width: 200px;
  }

  .form-group {
    margin-bottom: 10px;
  }
}
