/**
 * Icon Sequence CAPTCHA Modal Styles
 * Mobile-first responsive design
 *
 * @version 2.0 - Modal implementation
 * @date February 1, 2026
 */

/* Modal Overlay */
.captcha-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.captcha-modal.show {
    display: flex;
    opacity: 1;
    align-items: center;
    justify-content: center;
}

/* Modal Content */
.captcha-modal-content {
    background-color: #fff;
    margin: auto;
    border-radius: 12px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.captcha-modal.show .captcha-modal-content {
    transform: scale(1);
}

/* Modal Header */
.captcha-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid #dee2e6;
    background: linear-gradient(135deg, #4a77a4 0%, #5a87b4 100%);
    border-radius: 12px 12px 0 0;
}

.captcha-modal-header h3 {
    margin: 0;
    color: #fff;
    font-size: 20px;
    font-weight: 600;
}

.captcha-close {
    color: #fff;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.captcha-close:hover {
    opacity: 1;
}

/* Modal Body */
.captcha-modal-body {
    padding: 25px;
}

.captcha-instructions {
    text-align: center;
    margin-bottom: 15px;
}

.instruction-text {
    font-size: 15px;
    color: #212529;
    font-weight: 600;
    margin: 0;
    padding: 15px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    line-height: 1.8;
    word-wrap: break-word;
    text-align: center;
}

/* Make emoji icons in instructions BIGGER and more visible */
.captcha-emoji {
    font-size: 32px;
    display: inline-block;
    margin: 0 4px;
    vertical-align: middle;
}

/* Arrow styling */
.captcha-arrow {
    font-size: 20px;
    color: #6c757d;
    margin: 0 6px;
    vertical-align: middle;
}

.icon-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 15px;
}

.icon-item {
    background: white;
    border: 3px solid #dee2e6;
    border-radius: 10px;
    padding: 25px;
    font-size: 48px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    user-select: none;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
}

.icon-item:hover {
    transform: scale(1.05);
    border-color: #adb5bd;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.icon-item:active {
    transform: scale(0.98);
}

.icon-item.clicked {
    border-color: #28a745;
    background: #d4edda;
}

.icon-item.incorrect {
    border-color: #dc3545;
    background: #f8d7da;
    animation: shake 0.3s;
}

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

.icon-item .click-number {
    position: absolute;
    top: 6px;
    right: 6px;
    background: #28a745;
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    font-family: Arial, sans-serif;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Modal Buttons */
.captcha-modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-captcha-reset,
.btn-captcha-submit {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-captcha-reset {
    background: #6c757d;
    color: white;
}

.btn-captcha-reset:hover {
    background: #5a6268;
}

.btn-captcha-submit {
    background: #28a745;
    color: white;
}

.btn-captcha-submit:hover:not(:disabled) {
    background: #218838;
}

.btn-captcha-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-modal-blue {
    flex: 1;
    padding: 12px 20px;
    background: #4a77a4;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-modal-blue:hover:not(:disabled) {
    background: #3d6688;
}

.btn-modal-blue:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Error Message */
.captcha-error {
    display: none;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 10px;
    border-radius: 6px;
    margin-top: 15px;
    font-size: 14px;
    text-align: center;
}

/* Success Modal Styling */
.success-icon {
    width: 80px;
    height: 80px;
    background: #28a745;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: white;
    margin: 0 auto 20px;
    font-weight: bold;
}

.success-message {
    text-align: center;
    font-size: 16px;
    line-height: 1.6;
    color: #212529;
    padding: 0 10px;
}

.success-message strong {
    color: #28a745;
    font-weight: 600;
}

.success-close {
    color: #fff;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.success-close:hover {
    opacity: 1;
}

.success-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-resend {
    flex: 1;
    padding: 12px 20px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-resend:hover:not(:disabled) {
    background: #5a6268;
}

.btn-resend:disabled {
    background: #adb5bd;
    cursor: not-allowed;
    opacity: 0.7;
}

.success-buttons .btn-captcha-submit {
    flex: 1;
    margin: 0;
}

.resend-status {
    margin-top: 15px;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    font-size: 14px;
    display: none;
}

/* Processing Modal Styling */
.processing-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #f3f3f3;
    border-top: 6px solid #4a77a4;
    border-radius: 50%;
    margin: 20px auto;
    animation: spin 1s linear infinite;
}

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

.processing-message {
    text-align: center;
    font-size: 16px;
    color: #212529;
    margin-top: 20px;
    padding: 0 20px;
}

/* Not Confirmed Modal Styling */
.warning-icon {
    width: 80px;
    height: 80px;
    background: #ffc107;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: white;
    margin: 0 auto 20px;
    font-weight: bold;
}

.notconfirmed-message {
    text-align: center;
    font-size: 16px;
    line-height: 1.6;
    color: #212529;
    padding: 0 10px;
}

.notconfirmed-message strong {
    color: #856404;
    font-weight: 600;
}

.notconfirmed-close {
    color: #fff;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.notconfirmed-close:hover {
    opacity: 1;
}

/* Restyle existing #myModalMessage to match new modals */
#myModalMessage.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

#myModalMessage.modal[style*="display: block"] {
    display: flex !important;
}

#myModalMessage .modal-content {
    background-color: #fff;
    margin: auto;
    border-radius: 12px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-height: 90vh;
    overflow-y: auto;
    padding: 0;
    border: none;
    overflow: hidden;
}

#myModalMessage .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid #dee2e6;
    background: linear-gradient(135deg, #4a77a4 0%, #5a87b4 100%);
    margin: 0;
}

#myModalMessage .modal-header h3 {
    margin: 0;
    color: #fff;
    font-size: 20px;
    font-weight: 600;
}

#myModalMessage .close {
    color: #fff;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    opacity: 0.9;
    transition: opacity 0.2s;
    position: static;
    margin: 0;
}

#myModalMessage .close:hover {
    opacity: 1;
}

#myModalMessage .modal-body {
    padding: 25px;
    margin: 0;
}

#myModalMessage .warning-icon {
    width: 80px;
    height: 80px;
    background: #ffc107;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: white;
    margin: 0 auto 20px;
    font-weight: bold;
}

#myModalMessage .modal-message {
    text-align: center;
    font-size: 16px;
    line-height: 1.6;
    color: #212529;
}

#myModalMessage .modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Tablet and larger (768px+) */
@media (min-width: 768px) {
    .captcha-modal-content {
        width: 450px;
    }

    .captcha-modal-header h3 {
        font-size: 22px;
    }

    .instruction-text {
        font-size: 15px;
        padding: 12px;
    }

    .icon-grid {
        gap: 15px;
    }

    .icon-item {
        padding: 30px;
        font-size: 56px;
        min-height: 100px;
    }

    .icon-item .click-number {
        width: 32px;
        height: 32px;
        font-size: 18px;
        top: 8px;
        right: 8px;
    }
}

/* Mobile (max 480px) */
@media (max-width: 480px) {
    .captcha-modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .captcha-modal-header {
        padding: 15px;
    }

    .captcha-modal-header h3 {
        font-size: 18px;
    }

    .captcha-modal-body {
        padding: 20px;
    }

    .instruction-text {
        font-size: 13px;
        padding: 10px;
    }

    .captcha-emoji {
        font-size: 28px;
    }

    .captcha-arrow {
        font-size: 18px;
    }

    .success-icon {
        width: 70px;
        height: 70px;
        font-size: 42px;
    }

    .success-message {
        font-size: 15px;
    }

    .notconfirmed-message {
        font-size: 15px;
    }

    .success-buttons {
        flex-direction: column;
    }

    .btn-resend,
    .success-buttons .btn-captcha-submit {
        width: 100%;
        padding: 10px 16px;
        font-size: 14px;
    }

    .warning-icon {
        width: 70px;
        height: 70px;
        font-size: 42px;
    }

    .icon-grid {
        gap: 10px;
    }

    .icon-item {
        padding: 20px;
        font-size: 42px;
        min-height: 70px;
        border-width: 2px;
    }

    .icon-item:hover {
        transform: scale(1.02);
    }

    .icon-item .click-number {
        width: 24px;
        height: 24px;
        font-size: 14px;
        top: 4px;
        right: 4px;
    }

    .btn-captcha-reset,
    .btn-captcha-submit {
        padding: 10px 16px;
        font-size: 14px;
    }
}

/* Small mobile (max 375px) */
@media (max-width: 375px) {
    .captcha-modal-header h3 {
        font-size: 16px;
    }

    .captcha-modal-body {
        padding: 15px;
    }

    .instruction-text {
        font-size: 12px;
        padding: 8px;
    }

    .captcha-emoji {
        font-size: 24px;
    }

    .captcha-arrow {
        font-size: 16px;
    }

    .icon-grid {
        gap: 8px;
    }

    .icon-item {
        padding: 15px;
        font-size: 36px;
        min-height: 60px;
    }

    .icon-item .click-number {
        width: 22px;
        height: 22px;
        font-size: 13px;
    }

    .btn-captcha-reset,
    .btn-captcha-submit {
        padding: 8px 12px;
        font-size: 13px;
    }

    .success-icon {
        width: 60px;
        height: 60px;
        font-size: 36px;
    }

    .success-message {
        font-size: 14px;
    }

    .notconfirmed-message {
        font-size: 14px;
    }

    .btn-resend,
    .success-buttons .btn-captcha-submit {
        padding: 8px 12px;
        font-size: 13px;
    }

    .warning-icon {
        width: 60px;
        height: 60px;
        font-size: 36px;
    }
}
