/* SigninRoleCard.jsx — sign-in modal role card (Parent | Teacher)
   Two identically-weighted cards inside the sign-in modal. Each one
   carries: role icon + title, short description, an "owner approval"
   pill, two social CTAs (Kakao + Google), and a fine-print note that
   explains the approval requirement. Accent color is the only thing
   that differs between the parent (violet) and teacher (teal) cards.
   Rationale: the closed-approval gate is the central concept users
   need to understand at this step — duplicate the approval pill on
   both cards so it never reads as a special teacher-only restriction. */

const GoogleMark = ({ size = 16 }) => (
  React.createElement('svg', { width: size, height: size, viewBox: '0 0 24 24', 'aria-hidden': 'true' },
    React.createElement('path', { d: 'M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 01-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z', fill: '#4285F4' }),
    React.createElement('path', { d: 'M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z', fill: '#34A853' }),
    React.createElement('path', { d: 'M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18A10.96 10.96 0 001 12c0 1.77.43 3.45 1.18 4.93l3.66-2.84z', fill: '#FBBC05' }),
    React.createElement('path', { d: 'M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z', fill: '#EA4335' })
  )
);

const KakaoMark = ({ size = 16 }) => (
  React.createElement('svg', { width: size, height: size, viewBox: '0 0 24 24', 'aria-hidden': 'true' },
    React.createElement('path', {
      d: 'M12 3C6.48 3 2 6.36 2 10.5c0 2.67 1.74 5.01 4.36 6.36-.14.53-.9 3.41-.93 3.63 0 0-.02.17.09.24.11.06.24.01.24.01.32-.04 3.7-2.44 4.28-2.86.63.09 1.28.13 1.96.13 5.52 0 10-3.36 10-7.5S17.52 3 12 3z',
      fill: '#3C1E1E',
    })
  )
);

const SigninRoleCard = ({
  accent,          // brand accent color (border-tinted, icon, title hairline)
  accentSoft,      // soft accent used for the icon bubble background
  bg,              // card background (subtle gradient)
  title, desc,
  badge,           // small "owner approval required" pill text
  note,            // fine-print note below the buttons
  icon,            // role icon (svg)
  ctaKakao, ctaGoogle,
  onKakao, onGoogle,
  topMargin = 16,
}) => (
  <div style={{
    marginTop: topMargin, padding: 18,
    border: `1px solid ${accent}22`,
    borderRadius: 12,
    background: bg,
  }}>
    {/* Header row: icon + title + approval pill */}
    <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 8 }}>
      <span style={{
        width: 34, height: 34, borderRadius: 10,
        background: accentSoft, color: accent,
        display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
        flexShrink: 0,
      }}>{icon}</span>
      <span style={{
        fontSize: 15, fontWeight: 700, color: '#0B1727',
        letterSpacing: '-0.2px',
      }}>{title}</span>
      <span style={{
        marginLeft: 'auto',
        display: 'inline-flex', alignItems: 'center', gap: 4,
        fontSize: 10.5, fontWeight: 700, letterSpacing: '0.02em',
        color: accent,
        background: accentSoft,
        padding: '4px 8px', borderRadius: 999,
        whiteSpace: 'nowrap',
      }}>
        <svg width="10" height="10" viewBox="0 0 24 24" fill="none"
          stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
          <rect x="3" y="11" width="18" height="11" rx="2"/>
          <path d="M7 11V7a5 5 0 0 1 10 0v4"/>
        </svg>
        {badge}
      </span>
    </div>

    {/* Description */}
    <div style={{
      fontSize: 13, fontWeight: 400, color: '#475569',
      marginBottom: 12, lineHeight: 1.55,
    }}>{desc}</div>

    {/* CTA stack — Kakao first (Korea default), Google second */}
    <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
      <window.Button variant="kakao" size="md" onClick={onKakao}>
        <KakaoMark size={16} />
        <span>{ctaKakao}</span>
      </window.Button>
      <window.Button variant="google" size="md" onClick={onGoogle}>
        <GoogleMark size={16} />
        <span>{ctaGoogle}</span>
      </window.Button>
    </div>

    {/* Approval note */}
    <div style={{
      marginTop: 10, padding: '8px 10px',
      background: 'rgba(15,23,42,0.03)',
      borderRadius: 8,
      fontSize: 11.5, fontWeight: 400, color: '#64748B',
      lineHeight: 1.55,
    }}>{note}</div>
  </div>
);

window.SigninRoleCard = SigninRoleCard;
