/**
 * Frontend CSS for Guest Email Verification
 */

/* Modal Overlay */
.gev-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999999;
}

/* Modal */
.gev-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 1000000;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.gev-modal-header {
    padding: 20px 20px 0;
    border-bottom: 1px solid #e2e2e2;
    position: relative;
}

.gev-modal-header h3 {
    margin: 0 0 15px;
    font-size: 1.2em;
    color: #333;
    padding-right: 40px; /* Make room for close button */
}

/* Close Button */
.gev-close-button {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.gev-close-button:hover {
    color: #333;
    background-color: #f1f1f1;
}

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

/* Email Display */
.gev-email-display {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
    border: 1px solid #e9ecef;
}

.gev-email-display label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    color: #495057;
}

.gev-email-display span {
    display: inline-block;
    font-family: monospace;
    background: #fff;
    padding: 5px 10px;
    border-radius: 3px;
    border: 1px solid #dee2e6;
    margin-right: 10px;
}

.gev-link-button {
    background: none;
    border: none;
    color: #0073aa;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9em;
}

.gev-link-button:hover {
    color: #005177;
}

/* Verification Field */
.gev-verification-field {
    margin-bottom: 20px;
}

.gev-verification-field label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    color: #495057;
}

.gev-verification-field input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ced4da;
    border-radius: 5px;
    font-size: 1.1em;
    text-align: center;
    letter-spacing: 2px;
    font-family: monospace;
    box-sizing: border-box;
}

.gev-verification-field input:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 5px rgba(0, 115, 170, 0.3);
}

/* Actions */
.gev-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.gev-actions .button {
    flex: 1;
    min-width: 120px;
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gev-actions .button:not(.button-primary) {
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #ced4da;
}

.gev-actions .button:not(.button-primary):hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.gev-actions .button.button-primary {
    background: #0073aa;
    color: #fff;
}

.gev-actions .button.button-primary:hover {
    background: #005177;
}

.gev-actions .button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Status Messages */
.gev-status {
    margin-top: 15px;
}

.gev-status #gev-message {
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 10px;
    font-size: 0.95em;
}

.gev-status #gev-message.gev-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.gev-status #gev-message.gev-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.gev-status #gev-timer {
    font-size: 0.9em;
    color: #6c757d;
    text-align: center;
}

/* Locked Email Field */
.gev-locked {
    background-color: #f8f9fa !important;
    color: #6c757d !important;
    cursor: not-allowed !important;
}

/* Checkout Blocking */
.wc-block-components-checkout-place-order-button:disabled,
.wc-block-checkout__actions button:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}

/* Responsive Design */
@media (max-width: 600px) {
    .gev-modal {
        width: 95%;
        margin: 20px;
    }
    
    .gev-modal-body {
        padding: 15px;
    }
    
    .gev-actions {
        flex-direction: column;
    }
    
    .gev-actions .button {
        flex: none;
        width: 100%;
    }
    
    .gev-email-display span {
        display: block;
        margin: 5px 0;
        word-break: break-all;
    }
}

/* Integration with WooCommerce Blocks */
.wc-block-checkout .gev-verification-notice {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 15px;
    border-radius: 5px;
    margin: 15px 0;
}

.wc-block-checkout .gev-verification-notice .notice-title {
    font-weight: bold;
    margin-bottom: 5px;
}

/* Loading States */
.gev-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.gev-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: gev-spin 1s linear infinite;
}

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

/* Animation */
.gev-modal {
    animation: gev-modal-appear 0.3s ease-out;
}

@keyframes gev-modal-appear {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.gev-overlay {
    animation: gev-overlay-appear 0.3s ease-out;
}

@keyframes gev-overlay-appear {
    from { opacity: 0; }
    to { opacity: 1; }
}