/* Import Montserrat font */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

/* Reset and base styles */
.iox-imei-unlock-frontend * {
    box-sizing: border-box;
}

.iox-imei-unlock-frontend {
    font-family: 'Montserrat', sans-serif;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Form container */
.unlock-form-container {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    text-align: center;
}

.unlock-form-container h2 {
    color: #d32f2f;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.form-description {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 30px;
    line-height: 1.6;
}

/* Form styles */
.unlock-form {
    margin-bottom: 40px;
}

.form-group {
    margin-bottom: 25px;
    text-align: left;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.form-group input {
    width: 100%;
    padding: 18px 20px;
    font-size: 1.2rem;
    border: 3px solid #ddd;
    border-radius: 10px;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.3s ease;
    background: #f9f9f9;
}

.form-group input:focus {
    outline: none;
    border-color: #d32f2f;
    background: white;
    box-shadow: 0 0 0 4px rgba(211, 47, 47, 0.1);
    transform: translateY(-2px);
}

.form-group input.valid-imei {
    border-color: #4caf50;
    background: #f1f8e9;
}

.form-group input.invalid-imei {
    border-color: #f44336;
    background: #ffebee;
}

.help-text {
    display: block;
    margin-top: 8px;
    color: #666;
    font-size: 0.9rem;
    font-style: italic;
}

.validation-error {
    color: #f44336;
    font-size: 0.9rem;
    margin-top: 5px;
    display: block;
    font-weight: 500;
}

/* Submit button */
.submit-button {
    background: linear-gradient(135deg, #d32f2f 0%, #b71c1c 100%);
    color: white;
    border: none;
    padding: 18px 40px;
    font-size: 1.2rem;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(211, 47, 47, 0.3);
    position: relative;
    overflow: hidden;
}

.submit-button:hover {
    background: linear-gradient(135deg, #b71c1c 0%, #8e0000 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(211, 47, 47, 0.4);
}

.submit-button:active {
    transform: translateY(-1px);
}

.submit-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.submit-button.loading {
    background: #666;
    cursor: wait;
}

.submit-button.button-hover {
    transform: translateY(-3px) scale(1.02);
}

/* QR Section */
.qr-section {
    background: #f5f5f5;
    padding: 30px;
    border-radius: 10px;
    margin-top: 30px;
    border-left: 4px solid #d32f2f;
}

.qr-section h3 {
    color: #d32f2f;
    margin-bottom: 15px;
    font-weight: 600;
}

.qr-section p {
    color: #666;
    margin-bottom: 20px;
    line-height: 1.5;
}

.qr-code {
    margin: 20px 0;
    padding: 20px;
    background: white;
    border-radius: 8px;
    display: inline-block;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.qr-note {
    font-size: 0.9rem;
    color: #888;
    font-style: italic;
}

#current-url {
    color: #d32f2f;
    font-weight: 600;
    word-break: break-all;
}

/* Modal styles */
.result-modal,
.error-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    border-radius: 15px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    background: #d32f2f;
    color: white;
    padding: 25px 30px;
    border-radius: 15px 15px 0 0;
    position: relative;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 25px;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.modal-close:hover {
    background: rgba(255,255,255,0.2);
}

.modal-body {
    padding: 30px;
}

.result-info {
    margin-bottom: 25px;
}

.imei-result,
.code-result {
    background: #f5f5f5;
    padding: 20px;
    margin: 15px 0;
    border-radius: 8px;
    font-size: 1.1rem;
    border-left: 4px solid #d32f2f;
}

.code-result {
    background: #d32f2f;
    color: white;
    font-weight: bold;
    font-size: 1.3rem;
    text-align: center;
}

.instructions {
    margin: 25px 0;
}

.instructions h4 {
    color: #d32f2f;
    margin-bottom: 15px;
    font-weight: 600;
}

.instructions ol {
    margin-left: 20px;
    line-height: 1.8;
}

.instructions li {
    margin: 10px 0;
    color: #333;
}

.modal-footer {
    padding: 20px 30px 30px;
    text-align: center;
}

.close-modal-btn {
    background: #333;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    transition: all 0.3s ease;
}

.close-modal-btn:hover {
    background: #555;
    transform: translateY(-2px);
}

/* Responsive design */
@media (max-width: 768px) {
    .iox-imei-unlock-frontend {
        padding: 15px;
    }
    
    .unlock-form-container {
        padding: 25px 20px;
    }
    
    .unlock-form-container h2 {
        font-size: 2rem;
    }
    
    .form-group input {
        padding: 15px 18px;
        font-size: 1.1rem;
    }
    
    .submit-button {
        padding: 15px 30px;
        font-size: 1.1rem;
        width: 100%;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .unlock-form-container h2 {
        font-size: 1.8rem;
    }
    
    .form-description {
        font-size: 1rem;
    }
    
    .qr-section {
        padding: 20px;
    }
    
    .qr-code img {
        max-width: 150px;
    }
}

/* Loading animation */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.submit-button.loading {
    animation: pulse 1.5s infinite;
}

/* Success animation */
@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.code-result {
    animation: successPulse 0.5s ease-out;
}

/* Focus animations */
.form-group input:focus {
    animation: focusGlow 0.3s ease-out;
}

@keyframes focusGlow {
    0% { box-shadow: 0 0 0 0 rgba(211, 47, 47, 0.1); }
    100% { box-shadow: 0 0 0 4px rgba(211, 47, 47, 0.1); }
}

/* Mobile IMEI Detection Styles */
.mobile-imei-detection {
    background: #f9f9f9;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 25px;
    border-left: 4px solid #d32f2f;
    text-align: center;
}

.detection-status {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 1.1rem;
}

.detection-status.detecting {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

.detection-status.success {
    background: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.detection-status.error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

#detected-imei-display {
    background: #f5f5f5;
    padding: 20px;
    margin: 20px 0;
    border-radius: 8px;
    font-size: 1.3rem;
    border: 2px solid #d32f2f;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #d32f2f;
}

.use-detected-button {
    background: #4caf50;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    margin: 15px 0;
    transition: all 0.3s ease;
}

.use-detected-button:hover:not(:disabled) {
    background: #388e3c;
    transform: translateY(-2px);
}

.use-detected-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.detection-fallback {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.link-button {
    background: none;
    border: none;
    color: #d32f2f;
    text-decoration: underline;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    padding: 0;
    margin: 0;
}

.link-button:hover {
    color: #b71c1c;
}

/* Hide manual form initially on mobile */
@media (max-width: 768px) {
    .unlock-form {
        display: none;
    }
    
    .unlock-form.show-manual {
        display: block;
    }
}
