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

html {
    height: 100%;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-image: url('../drawable/pattern_space.aFb4MW9l.svg');
    background-position: center;
    background-attachment: fixed;
    min-height: 100vh;
    position: relative;
}

.gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(180deg, #4facfe 0%, #00f2fe 100%);
    z-index: -1;
    opacity: 0.6;
}

.content-wrapper {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
}

.container {
    position: relative;
    background: rgba(255, 255, 255, 0.88);
    border-radius: 20px;
    padding: 40px 30px 30px;
    max-width: 800px;
    min-width: 506px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    overflow: visible;
}

.container > *:not(.layer-pattern) {
    position: relative;
    z-index: 1;
}

.help-icon {
    position: absolute;
    top: -29px;
    right: -28px;
    width: 32px;
    height: 32px;
    display: flex;
    z-index: 10;
}

.help-icon a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #999;
    transition: all 0.3s;
}

.help-icon a:hover {
    color: #667eea;
}

.back-arrow {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 32px;
    height: 32px;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.back-arrow a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: #999;
    transition: all 0.3s;
    text-decoration: none;
}

.back-arrow a:hover {
    color: #667eea;
    transform: translateX(-2px);
}

.header {
    text-align: center;
    margin-bottom: 30px;
    margin-top: 40px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 25px;
}

.logo-icon {
    width: 50px;
    height: 50px;
    display: block;
}

.logo-text {
    width: 120px;
    height: auto;
    color: #000000;
    display: block;
}

h1 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.phone-input-container {
    position: relative;
    margin-bottom: 15px;
}

.country-selector {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    z-index: 10;
    padding: 5px;
    border-radius: 6px;
    transition: background 0.2s;
}

.country-selector:hover {
    background: rgba(0, 0, 0, 0.05);
}

.flag {
    width: 24px;
    height: 18px;
    object-fit: cover;
    border-radius: 3px;
    display: inline-block;
    vertical-align: middle;
}

.country-code {
    color: #333;
    font-size: 16px;
    font-weight: 500;
}

.dropdown-arrow {
    font-size: 12px;
    color: #999;
    margin-left: 2px;
}

.phone-input {
    width: 100%;
    padding: 15px 15px 15px 110px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 12px;
    background: transparent;
    color: #1a1a1a;
    transition: all 0.3s;
}

.phone-input:focus {
    outline: none;
    color: #000;
    border-color: #667eea;
    background: white;
}

.phone-input::placeholder {
    color: #999;
}

.country-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    margin-top: 5px;
}

.country-dropdown.active {
    display: block;
}

.country-option {
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.country-option:last-child {
    border-bottom: none;
}

.country-option:hover {
    background: #f8f9fa;
}

.country-option.selected {
    background: #e8eaf6;
}

.country-option .flag {
    width: 22px;
    height: 16px;
    margin-right: 12px;
    flex-shrink: 0;
}

.country-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.country-name {
    font-size: 15px;
    color: #333;
}

.info-text {
    font-size: 12px;
    color: #000000;
    line-height: 1.5;
    margin-bottom: 25px;
    text-align: center;
}

.continue-btn, .verify-btn {
    width: 100%;
    padding: 16px;
    background: #9ca3af;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: not-allowed;
    transition: all 0.3s;
    margin-bottom: 20px;
}

.continue-btn.active, .verify-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
}

.continue-btn.active:hover, .verify-btn.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.policy-text {
    font-size: 13px;
    color: #999;
    text-align: center;
    line-height: 1.6;
    padding: 30px;
}

.policy-text a {
    font-size: 13px;
    color: #667eea;
    text-decoration: none;
}

.policy-text a:hover {
    text-decoration: underline;
}

.loading {
    display: none;
    text-align: center;
    margin-top: 20px;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* SMS Code Section */
.sms-code-section {
    text-align: center;
    display: none;
}

.code-input-container {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 30px;
}

.code-input {
    width: 56px;
    height: 64px;
    font-size: 28px;
    font-weight: 600;
    text-align: center;
    border: 2px solid #ddd;
    border-radius: 12px;
    background: #f5f5f5;
    color: #1a1a1a;
    transition: all 0.3s;
}

.code-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    color: #000;
    transform: scale(1.05);
}

.code-input.filled {
    border-color: #667eea;
    background: #e8eaf6;
    color: #1a1a1a;
}

.code-error-message {
    color: #e53935;
    font-size: 14px;
    margin-top: -20px;
    margin-bottom: 20px;
    display: none;
    text-align: center;
    padding: 12px;
}

.code-error-message.show {
    display: block;
}

.resend-text {
    font-size: 14px;
    color: #666;
    margin-bottom: 30px;
}

.resend-text a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.resend-text a:hover {
    text-decoration: underline;
}

#countdown {
    font-weight: 600;
    color: #667eea;
}

.change-number {
    display: inline-block;
    color: #999;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s;
}

.change-number:hover {
    color: #667eea;
}

/* 2FA Password Section */
.twofa-section {
    display: none;
    text-align: center;
}

.twofa-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.twofa-icon svg {
    fill: white;
}

.password-input-wrapper {
    position: relative;
    margin-bottom: 15px;
}

.password-input {
    width: 100%;
    padding: 15px 50px 15px 18px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 12px;
    background: #f5f5f5;
    color: #1a1a1a;
    transition: all 0.3s;
    letter-spacing: 2px;
}

.password-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
}

.password-input::placeholder {
    letter-spacing: 0;
    color: #999;
}

.toggle-password {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    padding: 4px;
    transition: color 0.2s;
}

.toggle-password:hover {
    color: #667eea;
}

.error-message {
    color: #e53935;
    font-size: 13px;
    margin-top: -8px;
    margin-bottom: 12px;
    display: none;
}

/* Success overlay */
.success-overlay {
    display: none;
    text-align: center;
    padding: 20px 0;
}

.success-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    animation: pop 0.4s ease-out;
}

@keyframes pop {
    0% { transform: scale(0); }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.success-title {
    font-size: 22px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}

.success-subtitle {
    font-size: 14px;
    color: #666;
    margin-bottom: 6px;
}

.success-token {
    font-size: 12px;
    color: #999;
    font-family: monospace;
    word-break: break-all;
    background: #f5f5f5;
    padding: 10px;
    border-radius: 8px;
    margin-top: 12px;
}

/* Mobile adjustments */
@media (max-width: 767px) {
    body {
        padding: 0;
    }

    .content-wrapper {
        padding: 20px 15px;
        align-items: flex-start;
        padding-top: 60px;
    }

    .container {
        min-width: 280px;
        max-width: 360px;
        width: 95%;
        padding: 30px 20px 20px;
    }

    .help-icon {
        top: -12px;
        right: -9px;
        width: 28px;
        height: 28px;
    }

    .back-arrow {
        top: 15px;
        left: 15px;
        width: 28px;
        height: 28px;
    }

    .code-input-container {
        gap: 6px;  /* Even smaller gap on mobile */
        padding: 0 15px;  /* More padding on mobile */
    }

    .code-input {
        width: 42px;  /* Smaller on mobile */
        height: 50px;
        font-size: 20px;
    }

    .header {
        margin-bottom: 20px;
    }

    .logo {
        margin-bottom: 20px;
    }

    h1 {
        font-size: 17px;
    }

    .subtitle {
        font-size: 12px;
    }
}

/* Desktop adjustments */
@media (min-width: 768px) {
    .container {
        padding: 40px;
        padding-bottom: 30px;
        max-width: 600px;
    }
}