* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: #f5f5f7;
    color: #1d1d1f;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.sign-in-container,
.checkout-container {
    width: 100%;
    max-width: 400px;
    text-align: center;
}

/* Apple Logo */
.apple-logo {
    margin-bottom: 20px;
    color: #1d1d1f;
}

.apple-logo svg {
    width: 80px;
    height: 88px;
}

/* Title */
.sign-in-title {
    font-size: 28px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 32px;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

/* Form */
.sign-in-form,
.checkout-form {
    width: 100%;
}

.input-group {
    margin-bottom: 16px;
}

.input-wrapper {
    position: relative;
    width: 100%;
}

.form-input {
    width: 100%;
    height: 56px;
    padding: 26px 16px 10px 16px;
    border: 1px solid #d2d2d7;
    border-radius: 12px;
    font-size: 17px;
    font-family: inherit;
    background-color: #fff;
    color: #1d1d1f;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
    border-color: #0071e3;
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
}

.form-input:focus + .form-label,
.form-input:not(:placeholder-shown) + .form-label {
    top: 10px;
    font-size: 12px;
    color: #86868b;
}

.form-label {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 17px;
    color: #86868b;
    pointer-events: none;
    transition: all 0.2s ease;
}

/* Password Group Animation */
.password-group {
    animation: slideDown 0.3s ease forwards;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Sign In Button */
.sign-in-button {
    width: 100%;
    height: 48px;
    background-color: #0071e3;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background-color 0.2s ease, opacity 0.2s ease;
    margin-top: 20px;
}

.sign-in-button:hover {
    background-color: #0077ed;
}

.sign-in-button:active {
    background-color: #006edb;
}

.sign-in-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.button-arrow {
    font-size: 18px;
    transition: transform 0.2s ease;
}

.sign-in-button:hover .button-arrow {
    transform: translateX(2px);
}

/* Forgot Link */
.forgot-link {
    display: inline-block;
    margin-top: 20px;
    font-size: 14px;
    color: #0071e3;
    text-decoration: none;
    transition: color 0.2s ease;
}

.forgot-link:hover {
    text-decoration: underline;
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    margin: 28px 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: #d2d2d7;
}

.divider-text {
    padding: 0 16px;
    font-size: 14px;
    color: #86868b;
}

/* Create Account Link */
.create-account-link {
    display: inline-block;
    font-size: 14px;
    color: #0071e3;
    text-decoration: none;
    transition: color 0.2s ease;
}

.create-account-link:hover {
    text-decoration: underline;
}

/* Code Inputs (Step 2) */
.code-instruction {
    font-size: 14px;
    color: #515154;
    margin-bottom: 16px;
    text-align: center;
}

.code-inputs {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 8px;
}

.code-digit {
    width: 44px;
    height: 52px;
    border: 1px solid #d2d2d7;
    border-radius: 10px;
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background-color: #fff;
}

.code-digit:focus {
    border-color: #0071e3;
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
}

/* Inline Error */
.inline-error {
    font-size: 13px;
    color: #ff3b30;
    text-align: center;
    margin-top: 8px;
    animation: slideDown 0.2s ease;
}

/* Error State */
.input-wrapper.error .form-input {
    border-color: #ff3b30;
}

.input-wrapper.error .form-input:focus {
    box-shadow: 0 0 0 4px rgba(255, 59, 48, 0.15);
}

.error-message {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: #ff3b30;
    text-align: left;
    padding-left: 16px;
}

/* ===== CHECKOUT PAGE ===== */
.plan-card {
    background: #fff;
    border: 1px solid #d2d2d7;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 28px;
    text-align: left;
}

.plan-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.plan-icon {
    font-size: 32px;
}

.plan-info h3 {
    font-size: 17px;
    font-weight: 600;
    color: #1d1d1f;
}

.plan-info p {
    font-size: 13px;
    color: #86868b;
    margin-top: 2px;
}

.plan-price {
    text-align: right;
}

.plan-price .price {
    font-size: 22px;
    font-weight: 600;
    color: #1d1d1f;
}

.plan-price .period {
    font-size: 14px;
    color: #86868b;
}

.input-row {
    display: flex;
    gap: 12px;
}

.input-group.half {
    flex: 1;
}

.card-icons {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 4px;
}

.card-icon {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 3px;
    color: #fff;
}

.card-icon.visa {
    width: 60px;
    height: 16px;
}

.card-icon.mc {
    background: #eb001b;
}

.checkout-btn {
    margin-top: 24px;
}

.checkout-note {
    font-size: 12px;
    color: #86868b;
    margin-top: 16px;
    text-align: center;
}

/* ===== 3D SECURE MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: #fff;
    border-radius: 20px;
    padding: 32px 28px;
    width: 90%;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 4px;
}

.modal-subtitle {
    font-size: 14px;
    color: #86868b;
    margin-bottom: 24px;
}

.modal-section {
    margin-bottom: 24px;
}

.modal-instruction {
    font-size: 14px;
    color: #515154;
    margin-bottom: 14px;
}

.sms-code-inputs {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 10px;
}

.sms-digit {
    width: 40px;
    height: 48px;
    border: 1px solid #d2d2d7;
    border-radius: 10px;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background-color: #f5f5f7;
}

.sms-digit:focus {
    border-color: #0071e3;
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
    background-color: #fff;
}

.resend-btn {
    background: none;
    border: none;
    color: #0071e3;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    margin-top: 8px;
}

.resend-btn:hover {
    text-decoration: underline;
}

/* Timer Circle */
.timer-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 16px auto;
}

.timer-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-bg {
    fill: none;
    stroke: #e8e8ed;
    stroke-width: 6;
}

.timer-progress {
    fill: none;
    stroke: #0071e3;
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 326.73;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 28px;
    font-weight: 600;
    color: #1d1d1f;
}

.timer-label {
    font-size: 13px;
    color: #86868b;
    margin-top: 8px;
}

.modal-confirm-btn {
    width: 100%;
    height: 44px;
    background-color: #0071e3;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    margin-top: 8px;
    transition: background-color 0.2s ease;
}

.modal-confirm-btn:hover {
    background-color: #0077ed;
}

.modal-confirm-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.modal-cancel-btn {
    width: 100%;
    height: 44px;
    background: none;
    border: none;
    color: #0071e3;
    font-size: 16px;
    font-family: inherit;
    cursor: pointer;
    margin-top: 8px;
    border-radius: 12px;
    transition: background-color 0.2s ease;
}

.modal-cancel-btn:hover {
    background-color: #f5f5f7;
}

/* Footer */
.footer {
    padding: 20px;
    text-align: center;
    border-top: 1px solid #d2d2d7;
    background-color: #f5f5f7;
}

.footer-content {
    max-width: 980px;
    margin: 0 auto;
}

.footer-links {
    margin-bottom: 8px;
}

.footer-links a {
    font-size: 12px;
    color: #515154;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: #0071e3;
    text-decoration: underline;
}

.footer-separator {
    margin: 0 8px;
    color: #d2d2d7;
    font-size: 12px;
}

.footer-copyright {
    font-size: 12px;
    color: #86868b;
}

/* Responsive */
@media (max-width: 480px) {
    .sign-in-title {
        font-size: 24px;
    }

    .sign-in-container,
    .checkout-container {
        padding: 0 4px;
    }

    .code-digit {
        width: 38px;
        height: 46px;
        font-size: 18px;
    }

    .sms-digit {
        width: 36px;
        height: 44px;
        font-size: 18px;
    }
}