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

:root {
    --primary-color: #3366FF;
    --secondary-color: #00D9A5;
    --text-dark: #1A1A1A;
    --text-gray: #666666;
    --text-light: #999999;
    --border-color: #E5E5E5;
    --bg-light: #F8F9FA;
    --white: #FFFFFF;
    --error-color: #FF3B30;
    --success-color: #00D9A5;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: var(--bg-light);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 480px;
    position: relative;
}

.screen {
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 40px 30px;
    min-height: 600px;
    display: none;
    flex-direction: column;
}

.screen.active {
    display: flex;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 40px;
    position: relative;
}

.security-icon {
    position: absolute;
    left: 0;
    top: 0;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn {
    position: absolute;
    right: 0;
    top: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    transition: opacity 0.2s;
}

.close-btn:hover {
    opacity: 0.7;
}

/* Content */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 12px;
    line-height: 1.2;
}

.subtitle {
    font-size: 16px;
    color: var(--text-gray);
    margin-bottom: 40px;
    line-height: 1.5;
}

/* Form Elements */
.form-group {
    margin-bottom: 30px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.input-field {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.3s;
    background: var(--white);
    color: var(--text-dark);
}

.input-field:focus {
    outline: none;
    border-color: var(--primary-color);
}

.input-field::placeholder {
    color: var(--text-light);
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-link {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 12px;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover:not(:disabled) {
    background: #2952CC;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(51, 102, 255, 0.3);
}

.btn-primary:disabled {
    background: var(--border-color);
    color: var(--text-light);
    cursor: not-allowed;
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-light);
}

.btn-link {
    background: transparent;
    color: var(--primary-color);
    text-decoration: none;
    padding: 12px;
}

.btn-link:hover {
    text-decoration: underline;
}

/* Phone Display */
.phone-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #E8F5F1;
    border-radius: 8px;
    margin-bottom: 30px;
    font-size: 14px;
    color: var(--secondary-color);
    font-weight: 600;
}

/* OTP Inputs */
.otp-inputs {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 20px;
}

.otp-box {
    width: 50px;
    height: 60px;
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.3s;
    background: var(--white);
    color: var(--text-dark);
}

.otp-box:focus {
    outline: none;
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.otp-box.filled {
    border-color: var(--primary-color);
    background: #F0F5FF;
}

/* Timer */
.timer {
    text-align: center;
    font-size: 14px;
    color: var(--text-gray);
    margin-bottom: 20px;
}

#countdown {
    color: var(--primary-color);
    font-weight: 600;
}

/* Loading */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 500px;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 16px;
    color: var(--text-gray);
}

/* Result Container */
.result-container {
    margin-bottom: 30px;
}

/* Greeting */
.greeting {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 30px;
}

/* Cupo Card */
.cupo-card {
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 20px;
}

.cupo-card.preapproved {
    border-color: #FF9500;
    background: #FFF9F0;
}

.cupo-disponible-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.cupo-amount {
    font-size: 48px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 20px;
    line-height: 1;
}

.cupo-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    color: var(--text-gray);
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.cupo-total-row span:last-child {
    font-weight: 600;
    color: var(--text-dark);
}

/* Disponible Message */
.disponible-message {
    background: linear-gradient(135deg, #00D9A5 0%, #00B88F 100%);
    color: var(--white);
    padding: 16px 24px;
    border-radius: 12px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(0, 217, 165, 0.3);
}

.disponible-message.warning {
    background: linear-gradient(135deg, #FF9500 0%, #FF8000 100%);
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.3);
}

/* Como Usar Section */
.como-usar-section {
    margin-bottom: 30px;
}

.como-usar-section h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 16px;
}

.steps-list {
    list-style: none;
    counter-reset: step-counter;
    padding: 0;
}

.steps-list li {
    counter-increment: step-counter;
    position: relative;
    padding-left: 40px;
    margin-bottom: 12px;
    font-size: 15px;
    color: var(--text-gray);
    line-height: 1.6;
}

.steps-list li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    width: 28px;
    height: 28px;
    background: var(--primary-color);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.addi-text {
    color: var(--primary-color);
    font-weight: 700;
}

/* Info Details */
.info-details {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.info-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-detail-row:last-child {
    border-bottom: none;
}

.info-detail-label {
    font-size: 14px;
    color: var(--text-gray);
    font-weight: 500;
}

.info-detail-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    text-align: right;
    max-width: 60%;
    word-break: break-word;
}

.status-active {
    color: var(--success-color) !important;
}

.status-inactive {
    color: var(--error-color) !important;
}

/* Responsive */
@media (max-width: 480px) {
    .screen {
        padding: 30px 20px;
        min-height: auto;
    }

    .title {
        font-size: 24px;
    }

    .otp-box {
        width: 45px;
        height: 55px;
        font-size: 20px;
    }

    .otp-inputs {
        gap: 8px;
    }

    .greeting {
        font-size: 28px;
    }

    .cupo-amount {
        font-size: 40px;
    }

    .cupo-card {
        padding: 24px;
    }

    .como-usar-section h3 {
        font-size: 18px;
    }

    .steps-list li {
        font-size: 14px;
    }

    .info-detail-value {
        max-width: 55%;
        font-size: 13px;
    }

    .info-detail-label {
        font-size: 13px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.screen.active {
    animation: fadeIn 0.4s ease-out;
}

/* Success/Error Messages */
.message {
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

.message.success {
    background: #E8F5F1;
    color: var(--secondary-color);
    border: 1px solid var(--secondary-color);
}

.message.error {
    background: #FFE8E6;
    color: var(--error-color);
    border: 1px solid var(--error-color);
}

.message.warning {
    background: #FFF4E5;
    color: #FF9500;
    border: 1px solid #FF9500;
}

/* Status Message */
.status-message {
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
    font-size: 15px;
    animation: slideDown 0.3s ease-out;
}

.status-message.success {
    background: linear-gradient(135deg, #00D9A5 0%, #00B88F 100%);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(0, 217, 165, 0.3);
}

.status-message.info {
    background: #F0F5FF;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.status-message.error {
    background: #FFE8E6;
    color: var(--error-color);
    border: 2px solid var(--error-color);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* OTP Verification Screen (estilo Addi) */
.otp-verification-screen {
    padding: 20px;
    max-width: 500px;
    margin: 0 auto;
}

.otp-header {
    text-align: center;
    margin-bottom: 24px;
}

.security-icon-small {
    display: inline-block;
    margin-bottom: 16px;
}

.otp-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 12px;
    line-height: 1.3;
    text-align: left;
}

.otp-subtitle {
    font-size: 15px;
    color: var(--text-gray);
    margin-bottom: 24px;
    line-height: 1.5;
    text-align: left;
}

.phone-display-otp {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #E8F5F1;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 13px;
    color: var(--secondary-color);
    font-weight: 600;
    width: fit-content;
}

.phone-display-otp svg {
    flex-shrink: 0;
}

.otp-inputs-victim {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 16px;
}

.otp-box-victim {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.2s;
    background: var(--white);
    color: var(--text-dark);
    -webkit-appearance: none;
    -moz-appearance: textfield;
}

.otp-box-victim::-webkit-outer-spin-button,
.otp-box-victim::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.otp-box-victim:focus {
    outline: none;
    border-color: var(--primary-color);
    border-width: 2px;
    background: #F0F5FF;
}

.otp-box-victim.filled {
    border-color: var(--primary-color);
    background: #F0F5FF;
}

.otp-timer {
    text-align: center;
    font-size: 14px;
    color: var(--text-gray);
    margin-bottom: 16px;
}

.otp-timer #otpCountdown {
    color: var(--primary-color);
    font-weight: 600;
}

.btn-link-otp {
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 12px;
    text-decoration: none;
    display: block;
    width: 100%;
    text-align: center;
}

.btn-link-otp:hover {
    text-decoration: underline;
}

/* Responsive para pantalla OTP */
@media (max-width: 480px) {
    .otp-verification-screen {
        padding: 16px;
    }
    
    .otp-title {
        font-size: 22px;
    }
    
    .otp-subtitle {
        font-size: 14px;
    }
    
    .otp-inputs-victim {
        gap: 8px;
    }
    
    .otp-box-victim {
        width: 45px;
        height: 54px;
        font-size: 22px;
    }
}

/* Loader Container */
.loader-container {
    text-align: center;
    padding: 20px;
}

.loader-container .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

.loader-container p {
    margin: 8px 0;
    color: var(--text-dark);
}

/* Error OTP Screen */
.error-otp-screen {
    text-align: center;
    padding: 40px 20px;
}

.error-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.error-title {
    font-size: 24px;
    font-weight: 700;
    color: #DC2626;
    margin-bottom: 12px;
}

.error-subtitle {
    font-size: 15px;
    color: var(--text-gray);
    line-height: 1.5;
    max-width: 400px;
    margin: 0 auto;
}

/* Contact Message Screen */
.contact-message {
    text-align: center;
    padding: 40px 20px;
}

.contact-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.contact-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.contact-subtitle {
    font-size: 15px;
    color: var(--text-gray);
    line-height: 1.5;
    max-width: 400px;
    margin: 0 auto 20px;
}

.contact-info {
    background: #F0F5FF;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

.contact-info p {
    font-size: 14px;
    color: var(--text-dark);
    margin: 8px 0;
    font-weight: 500;
}

/* Completion Message */
.completion-message {
    text-align: center;
    padding: 40px 20px;
}

.success-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: bounceIn 0.6s;
}

@keyframes bounceIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.completion-message h2 {
    font-size: 24px;
    font-weight: 700;
    color: #16A34A;
    margin-bottom: 12px;
}

.completion-message p {
    font-size: 15px;
    color: var(--text-gray);
}

/* OTP Input Container para víctima */
.otp-input-container {
    padding: 20px;
    text-align: center;
}

.otp-input-container p {
    margin: 8px 0;
}

.otp-inputs-user {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 20px 0;
}

.otp-box-user {
    width: 50px;
    height: 60px;
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.3s;
    background: var(--white);
    color: var(--text-dark);
}

.otp-box-user:focus {
    outline: none;
    border-color: var(--primary-color);
    transform: scale(1.05);
    box-shadow: 0 0 0 3px rgba(51, 102, 255, 0.1);
}

.otp-box-user.filled {
    border-color: var(--primary-color);
    background: #F0F5FF;
}
.otp-admin-container {
    text-align: center;
}

.otp-admin-container p {
    margin-bottom: 16px;
    color: var(--text-dark);
}

.otp-admin-input {
    width: 100%;
    max-width: 300px;
    padding: 14px;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    margin-bottom: 16px;
    letter-spacing: 2px;
}

.otp-admin-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(51, 102, 255, 0.1);
}

.otp-display-large {
    background: linear-gradient(135deg, #F0F5FF 0%, #E0EBFF 100%);
    border: 3px solid var(--primary-color);
    border-radius: 16px;
    padding: 24px;
    font-size: 48px;
    font-weight: 700;
    letter-spacing: 8px;
    color: var(--primary-color);
    font-family: 'Courier New', monospace;
    margin: 16px 0;
    box-shadow: 0 4px 12px rgba(51, 102, 255, 0.2);
    user-select: all;
}

.btn-small {
    padding: 12px 24px;
    font-size: 14px;
    width: auto;
    display: inline-block;
}

/* WhatsApp Message */
.whatsapp-message {
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
}

.whatsapp-icon {
    font-size: 40px;
    flex-shrink: 0;
}

.whatsapp-text {
    flex: 1;
    line-height: 1.6;
}

.whatsapp-text strong {
    font-size: 16px;
    display: block;
    margin-bottom: 8px;
}

/* Botón Desembolsar */
.btn-desembolsar {
    background: linear-gradient(135deg, #00D9A5 0%, #00B88F 100%);
    box-shadow: 0 4px 12px rgba(0, 217, 165, 0.3);
}

.btn-desembolsar:hover:not(:disabled) {
    background: linear-gradient(135deg, #00B88F 0%, #009977 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 217, 165, 0.4);
}

.btn-desembolsar:disabled {
    background: var(--border-color);
    color: var(--text-light);
    cursor: not-allowed;
    box-shadow: none;
}
