/* BNI 애플리케이션 통합 스타일 - 간소화 버전 */

/* 기본 리셋 및 변수 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
  }
  
  :root {
    --bni-red: #cf152d;
    --ios-red: #ff3b30;
    --ios-background: #f2f2f7;
    --ios-border: rgba(0, 0, 0, 0.1);
    --form-height: 44px;
    --border-radius: 10px;
    --header-height: 48px;
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  }
  
  html {
    height: 100%;
  }
  
  body {
    background-color: var(--ios-background);
    color: var(--bni-red);
    font-size: 16px;
    line-height: 1.4;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    padding-top: calc(var(--header-height) + var(--safe-area-top));
    padding-bottom: var(--safe-area-bottom);
  }
  
  body.login-page {
    padding-top: 0;
  }
  
  
  /* 헤더 스타일 */
  .header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(var(--header-height) + var(--safe-area-top));
    background-color: rgba(245, 245, 247, 0.9);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--safe-area-top);
    border-bottom: 1px solid var(--ios-border);
    padding: 0 5px;
  }
  
  .header-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: #333;
    font-weight: 600;
    font-size: 17px;
  }
  
  .back-button {
    display: flex;
    align-items: center;
    padding: 0 15px;
    height: var(--header-height);
    text-decoration: none;
    color: var(--bni-red);
    font-size: 17px;
    width: 80px;
    z-index: 1;
  }
  
  .back-icon {
    margin-right: 2px;
    width: 12px;
    height: 21px;
  }
  
  .header-right-space {
    width: 50px;
    display: flex;
    justify-content: flex-end;
  }
  
  .header-right-space img {
    height: 20px;
    margin-right: 20px;
  }
  
  /* 메인 콘텐츠 영역 */
  .main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding: 20px 16px;
  }
  
  .login-page .main-content {
    padding-top: 60px;
  }
  
  /* 폼 요소 공통 스타일 */
  .form-container {
    width: 100%;
    margin-bottom: 24px;
  }
  
  .input-group {
    margin-bottom: 20px;
    position: relative;
  }
  
  .input-with-icon {
    position: relative;
    width: 100%;
  }
  
  .input-icon, .field-icon {
    position: absolute;
    left: 16px;
    top: 22px;
    transform: translateY(-50%);
    color: var(--bni-red);
    z-index: 1;
  }
  
  .textarea-icon {
    top: 16px;
    transform: none;
  }
  
  .input-with-icon .form-input {
    padding-left: 45px;
  }
  
  .password-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--bni-red);
    cursor: pointer;
    z-index: 1;
  }
  
  /* 입력 필드 스타일 */
  .form-input, .form-textarea, .form-select {
    width: 100%;
    background-color: #FFFFFF;
    border: 1px solid var(--ios-border);
    border-radius: var(--border-radius);
    font-size: 16px;
    color: #333;
    transition: all 0.2s ease;
    outline: none;
    -webkit-appearance: none;
  }
  
  .form-input, .form-select {
    height: var(--form-height);
    padding: 0 45px;
  }
  
  .form-textarea {
    min-height: 100px;
    padding: 12px 45px;
    resize: vertical;
  }
  
  .form-select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M3.5 4.5L6 7L8.5 4.5' stroke='%238E8E93' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/></svg>");
    background-repeat: no-repeat;
    background-position: right 16px center;
    cursor: pointer;
  }
  
  .form-input:focus, .form-textarea:focus, .form-select:focus {
    border-color: var(--bni-red);
    box-shadow: 0 0 0 2px rgba(207, 21, 45, 0.1);
  }
  
  
  /* 오류 메시지 */
  .error-message {
    color: var(--ios-red);
    font-size: 13px;
    margin-top: 6px;
    display: none;
  }
  
  .input-group.error .form-input,
  .input-group.error .form-textarea,
  .input-group.error .form-select {
    border-color: var(--ios-red);
    box-shadow: 0 0 0 2px rgba(255, 59, 48, 0.1);
  }
  
  .input-group.error .error-message {
    display: block;
  }
  
  /* 버튼 스타일 */
  .auth-btn, .submit-btn {
    background-color: var(--bni-red);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    height: var(--form-height);
    width: 100%;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
  }
  
  .auth-btn:hover, .submit-btn:hover {
    background-color: #800000;
  }
  
  .auth-btn:active, .submit-btn:active {
    transform: scale(0.98);
  }
  
  /* 링크 스타일 */
  .alt-link {
    margin-top: 16px;
    color: var(--bni-red);
    text-decoration: none;
    font-size: 15px;
  }
  
  /* 로고 스타일 */
  .logo-container {
    display: flex;
    text-align: center;
  }
  
  .logo img {
    max-width: 120px;
  }
  
  /* 알림 스타일 */
  .notification {
    position: fixed;
    top: calc(var(--header-height) + var(--safe-area-top) + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    padding: 12px 20px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 20px;
    font-size: 15px;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
    text-align: center;
    max-width: 90%;
    backdrop-filter: blur(10px);
  }
  
  .notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  
  /* iOS 스타일 그룹화 */
  .input-group.group-start .form-input,
  .input-group.group-start .form-select,
  .input-group.group-start .form-textarea {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    margin-bottom: -1px;
  }
  
  .input-group.group-middle .form-input,
  .input-group.group-middle .form-select,
  .input-group.group-middle .form-textarea {
    border-radius: 0;
    margin-bottom: -1px;
  }
  
  .input-group.group-end .form-input,
  .input-group.group-end .form-select,
  .input-group.group-end .form-textarea {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }
  
  /* 섹션 제목 스타일 */
  .form-section-title {
    font-size: 14px;
    color: var(--bni-red);
    margin-bottom: 8px;
    padding-left: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  
  .form-section-title:first-child {
    margin-top: 0;
  }
  
  /* 프로필 이미지 스타일 */
  .profile-image-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
  }
  
  .profile-image {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 3px solid white;
  }
  
  .profile-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  
  .profile-image i {
    font-size: 50px;
    color: var(--bni-red);
  }

  /* 명함 이미지 스타일 */
  .card-image-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
  }
  
  .card-image {
    width: 180px;
    height: 120px;
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 1px solid white;
  }
  
  .card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  
  .card-image i {
    font-size: 50px;
    color: var(--bni-red);
  }
  
  #imageUpload {
    display: none;
  }

  #cardImageUpload {
    display: none;
  }
  
  .change-image-btn {
    background-color: #f0f0f0;
    border: none;
    border-radius: 20px;
    padding: 8px 15px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
  }
  
  .change-image-btn i, .delete-image-btn i {
    margin-right: 5px;
    font-size: 14px;
  }
  
  #imagePreview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
  }
  
  /* 이미지 버튼 그룹 */
  .image-buttons {
      display: flex;
      gap: 10px;
      margin-top: 10px;
      width: 100%;
      align-items: center;
      justify-content: space-around;
  }
  
  .delete-image-btn {
    background-color: #f1f1f1;
    color: #333;
    border: none;
    border-radius: 20px;
    padding: 8px 15px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
  }
  
  .delete-image-btn:hover {
    background-color: #ff3b30;
    color: white;
  }
  
  /* 약관 섹션 */
  .terms-section {
    margin-bottom: 20px;
  }
  
  .terms-agreement {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
  }
  
  .terms-agreement input[type="checkbox"] {
    margin-right: 8px;
  }
  
  .master-agreement {
    font-weight: 600;
    margin-bottom: 15px;
  }
  
  .terms-box {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    max-height: 120px;
    overflow-y: auto;
  }
  
  
  /* 카드 스타일 (대시보드) */
  .vertical-card {
    background-color: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
  }
  
  
  .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--ios-border);
  }
  
  .card-logo {
    height: 30px;
  }
  
  .edit-button {
    background-color: transparent;
    border: 1px solid var(--bni-red);
    color: var(--bni-red);
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
  }
  
  .edit-button i {
    margin-right: 5px;
  }
  
  .edit-button:hover {
    background-color: var(--bni-red);
    color: white;
  }
  
  .card-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 15px;
  }
  
  .profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 10px;
  }
  
  .profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  
  .profile-avatar i {
    font-size: 40px;
    color: var(--bni-red);
  }
  
  .card-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #333;
  }
  
  .card-chapter {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
  }
  
  .card-divider {
    height: 1px;
    background-color: var(--ios-border);
    width: 100%;
  }
  
  .card-body {
    padding: 15px;
  }
  
  .card-section {
    margin-bottom: 20px;
  }
  
  .card-section:last-child {
    margin-bottom: 0;
  }
  
  .card-label {
    font-size: 14px;
    color: #777;
    margin-bottom: 5px;
  }
  
  .card-value {
    color: #333;
    font-size: 15px;
    line-height: 1.5;
  }
  
  .contact-icon {
    width: 20px;
    text-align: center;
    margin-right: 6px;
    color: var(--bni-red);
  }
  
  .text-multiline {
    white-space: pre-line;
    font-size: 14px;
    line-height: 1.5;
  }
  
  /* 사이드바 메뉴 */
  .hamburger-icon {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-right: 10px;
  }
  
  .hamburger-icon i {
    font-size: 20px;
    color: var(--bni-red);
  }
  
  .sidebar-menu {
    position: fixed;
    top: 0;
    right: -270px;
    width: 270px;
    height: 100%;
    background-color: #fff;
    z-index: 1100;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    padding-top: calc(var(--safe-area-top) + 10px);
  }
  
  .sidebar-menu.open {
    right: 0;
  }
  
  .menu-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 22px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .menu-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: #333;
    text-decoration: none;
    font-size: 16px;
    border-bottom: 1px solid var(--ios-border);
  }
  
  .menu-item i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
    color: var(--bni-red);
  }
  
  .menu-item:hover {
    background-color: #f5f5f5;
  }
  
  .logout-item {
    color: var(--ios-red);
  }
  
  .logout-item i {
    color: var(--ios-red);
  }
  
  .overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1050;
    display: none;
  }
  
  /* AI 리퍼럴 버튼 */
  .fixed-ai-button {
    position: fixed;
    bottom: calc(20px + var(--safe-area-bottom));
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
  }
  
  .ai-button {
    /* background-color: var(--bni-red); */
    background-color: var(--bni-red);
    color: white;
    border: none;
    border-radius: 24px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(207, 21, 45, 0.3);
    display: flex;
    align-items: center;
  }
  
  .ai-button i {
    margin-right: 8px;
    font-size: 18px;
  }
  
  /* 모달 스타일 */
  .modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1200;
    justify-content: center;
    align-items: center;
  }

  .modal-text {
    padding: 20px;
  }
  
  .modal-content {
    background-color: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 330px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    overflow: hidden;
  }
  
  .modal-title {
    font-size: 18px;
    font-weight: 600;
    padding: 20px 20px 10px;
    color: #333;
  }
  
  .modal-body {
    padding: 10px 20px 20px;
    color: #666;
    font-size: 15px;
  }
  
  .modal-referral {
    background-color: #f9f9f9;
    padding: 12px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 14px;
    max-height: 150px;
    overflow-y: auto;
    white-space: pre-line;
    color: #444;
  }
  
  .modal-buttons {
    display: flex;
    justify-content: space-between;
    padding: 15px 20px 20px;
  }
  
  .modal-button, .modal-btn {
    border: none;
    border-radius: 8px;
    padding: 10px 15px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
  }
  
  .primary-button, .modal-confirm {
    background-color: var(--bni-red);
    color: white;
    margin-left: 10px;
  }
  
  .secondary-button, .modal-cancel {
    background-color: #f1f1f1;
    color: #333;
  }
  
  /* 로딩 모달 */
  .loading-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1300;
    opacity: 0;
    transition: opacity 0.3s;
  }
  
  .loading-modal.active {
    opacity: 1;
  }
  
  .loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(207, 21, 45, 0.2);
    border-top-color: var(--bni-red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
  }
  
  @keyframes spin {
    to {
      transform: rotate(360deg);
    }
  }
  
  .loading-text {
    font-size: 16px;
    color: #333;
    text-align: center;
    max-width: 80%;
  }
  
  /* 비밀번호 변경 토글 */
  .password-toggle-section {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
  }
  
  .toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    margin-right: 10px;
  }
  
  .toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
  }
  
  .toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
  }
  
  .toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
  }
  
  input:checked + .toggle-slider {
    background-color: var(--bni-red);
  }
  
  input:checked + .toggle-slider:before {
    transform: translateX(26px);
  }
  
  .password-fields {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
  }
  
  .password-fields.visible {
    max-height: 300px;
  }
  
  /* AI 리퍼럴 목록 스타일 */
  .referrer-card {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 15px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
  }
  
  .referrer-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 15px;
    background-color: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
  }
  
  .referrer-info {
    flex: 1;
  }
  
  .referrer-name {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 3px;
    color: #333;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
  }
  
  .referrer-chapter {
    font-size: 13px;
    color: #666;
    margin-bottom: 5px;
  }
  
  .referrer-description {
    font-size: 14px;
    color: #333;
    line-height: 1.3;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    border-top: 1px solid #f0f0f0;
    padding-top: 10px;
    margin-top: 2px;
  }
  
  .match-percentage {
    background-color: var(--bni-red);
    color: white;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    margin-left: 8px;
  }
  
  .call-btn, .text-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .call-btn {
    background-color: #4CAF50;
    color: white;
  }
  
  .text-btn {
    background-color: #2196F3;
    color: white;
  }
  
  .button-icon {
    margin-right: 5px;
  }
  
  .error-message.block {
    text-align: center;
    padding: 30px 0;
    color: var(--bni-red);
    display: block;
  }

  .find-container{
    display: flex;
    justify-content: space-around;
  }

  
  .info-toggle-section {  
    display: flex;
    align-items: center;
    margin-bottom: 15px;
  }

  .info-description {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
  }

  .visibility-toggle-section {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
  }

  .visibility-description {
      font-size: 14px;
      color: #666;
      margin-bottom: 20px;
  }
  
  /* 미디어 쿼리 */
  @media (max-width: 480px) {
    .main-content {
      padding: 16px;
    }
    
    .login-page .main-content {
      padding-top: 40px;
    }
    
    .match-percentage {
      margin-left: 10px;
      margin-top: 2px;
    }
    
    .button-group {
      justify-content: center;
    }
  }
  
  /* iOS 안전 영역 지원 */
  @supports (padding: max(0px)) {
    body {
      padding-left: max(1px, env(safe-area-inset-left));
      padding-right: max(1px, env(safe-area-inset-right));
    }
    
    .header {
      padding-left: max(0px, env(safe-area-inset-left));
      padding-right: max(0px, env(safe-area-inset-right));
    }
  }
  /* 간단한 푸터 스타일 */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: white;
    border-top: 1px solid var(--ios-border);
    padding: 15px 0;
    padding-bottom: calc(15px + var(--safe-area-bottom));
    z-index: 900;
    text-align: center;
  }
  
  .footer-copyright {
    color: #999;
    font-size: 12px;
    text-align: center;
  }
  
  /* 로그인 페이지에서 푸터가 있을 때 메인 콘텐츠 영역 조정 */
  .login-page .main-content {
    padding-bottom: 70px;
  }
  
  /* iOS 안전 영역 지원 */
  @supports (padding: max(0px)) {
    .footer {
      padding-left: max(0px, env(safe-area-inset-left));
      padding-right: max(0px, env(safe-area-inset-right));
      padding-bottom: max(15px, env(safe-area-inset-bottom));
    }
  }