/**
 * Tadawul Popup Form Styles
 * Dark trading theme with orange accents
 */

/* Modal Backdrop */
.tadawul-popup-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 99998;
    animation: tadawulFadeIn 0.3s ease-out;
}

/* Modal Container */
.tadawul-popup-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 50%, #1a1a1a 100%);
    background-size: 200% 200%;
    border: 2px solid rgba(255, 107, 53, 0.3);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    z-index: 99999;
    animation: tadawulSlideIn 0.3s ease-out;
}

/* Close Button */
.tadawul-popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #ffffff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.tadawul-popup-close:hover {
    background: rgba(255, 107, 53, 0.8);
    border-color: rgba(255, 107, 53, 1);
    transform: rotate(90deg);
}

/* Form Container */
.tadawul-form-container {
    padding: 50px 40px 40px;
}

.tadawul-form-title {
    margin: 0 0 10px 0;
    color: #ffffff;
    font-size: 28px;
    font-weight: 700;
    text-align: center;
}

.tadawul-form-subtitle {
    margin: 0 0 30px 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
    text-align: center;
}

/* Form Styles */
.tadawul-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tadawul-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tadawul-form-group label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 500;
}

.tadawul-form-group input {
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #ffffff;
    font-size: 15px;
    transition: all 0.3s ease;
}

.tadawul-form-group input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 107, 53, 0.5);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.tadawul-form-group input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* Submit Button */
.tadawul-submit-btn {
    margin-top: 10px;
    padding: 16px 32px;
    background: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%);
    border: none;
    border-radius: 12px;
    color: #ffffff !important;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
}

.tadawul-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.6);
}

.tadawul-submit-btn:active {
    transform: translateY(0);
}

.tadawul-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Message Container */
.tadawul-form-message {
    margin-top: 15px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    display: none;
}

.tadawul-form-message.success {
    display: block;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.tadawul-form-message.error {
    display: block;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

/* Animations */
@keyframes tadawulFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes tadawulSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -48%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .tadawul-popup-modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .tadawul-form-container {
        padding: 40px 25px 30px;
    }
    
    .tadawul-form-title {
        font-size: 24px;
    }
    
    .tadawul-form-subtitle {
        font-size: 14px;
    }
    
    .tadawul-popup-close {
        top: 15px;
        right: 15px;
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
    
    .tadawul-submit-btn {
        padding: 14px 28px;
        font-size: 16px;
    }
}

/* Scrollbar Styling for Modal */
.tadawul-popup-modal::-webkit-scrollbar {
    width: 8px;
}

.tadawul-popup-modal::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.tadawul-popup-modal::-webkit-scrollbar-thumb {
    background: rgba(255, 107, 53, 0.5);
    border-radius: 10px;
}

.tadawul-popup-modal::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 107, 53, 0.7);
}

/* Thank You Page */
.tadawul-thank-you-page {
    padding: 60px 40px;
    text-align: center;
}

.tadawul-thank-you-icon {
    margin: 0 auto 30px;
    animation: tadawulCheckmarkScale 0.5s ease-out;
}

.tadawul-thank-you-title {
    margin: 0 0 15px 0;
    color: #00D9A5;
    font-size: 32px;
    font-weight: 700;
}

.tadawul-thank-you-message {
    margin: 0 0 10px 0;
    color: #ffffff;
    font-size: 18px;
    font-weight: 500;
}

.tadawul-thank-you-submessage {
    margin: 0 0 35px 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 15px;
    line-height: 1.6;
}

.tadawul-thank-you-btn {
    padding: 14px 40px;
    background: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%);
    border: none;
    border-radius: 12px;
    color: #ffffff !important;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
}

.tadawul-thank-you-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.6);
}

/* Already Registered Page */
.tadawul-already-registered-page {
    padding: 60px 40px;
    text-align: center;
}

.tadawul-already-registered-icon {
    margin: 0 auto 30px;
    animation: tadawulWarningShake 0.5s ease-out;
}

.tadawul-already-registered-title {
    margin: 0 0 15px 0;
    color: #FF6B35;
    font-size: 32px;
    font-weight: 700;
}

.tadawul-already-registered-message {
    margin: 0 0 10px 0;
    color: #ffffff;
    font-size: 18px;
    font-weight: 500;
}

.tadawul-already-registered-submessage {
    margin: 0 0 35px 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 15px;
    line-height: 1.6;
}

.tadawul-already-registered-btn {
    padding: 14px 40px;
    background: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%);
    border: none;
    border-radius: 12px;
    color: #ffffff !important;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
}

.tadawul-already-registered-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.6);
}

/* Animations */
@keyframes tadawulCheckmarkScale {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes tadawulWarningShake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* Mobile Responsive for Thank You Pages */
@media (max-width: 768px) {
    .tadawul-thank-you-page,
    .tadawul-already-registered-page {
        padding: 50px 25px;
    }
    
    .tadawul-thank-you-title,
    .tadawul-already-registered-title {
        font-size: 26px;
    }
    
    .tadawul-thank-you-message,
    .tadawul-already-registered-message {
        font-size: 16px;
    }
    
    .tadawul-thank-you-submessage,
    .tadawul-already-registered-submessage {
        font-size: 14px;
    }
    
    .tadawul-thank-you-icon svg,
    .tadawul-already-registered-icon svg {
        width: 60px;
        height: 60px;
    }
}

/* Phone Container with Country Selector */
.tadawul-phone-container {
    display: flex;
    gap: 10px;
}

/* Country Selector */
.tadawul-country-selector {
    position: relative;
    flex-shrink: 0;
}

.tadawul-country-button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #ffffff;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 110px;
}

.tadawul-country-button:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 107, 53, 0.5);
}

.tadawul-country-button .tadawul-flag {
    font-size: 20px;
    line-height: 1;
}

.tadawul-country-button .tadawul-code {
    font-weight: 500;
    flex: 1;
}

.tadawul-country-button .tadawul-arrow {
    font-size: 10px;
    opacity: 0.6;
    transition: transform 0.3s ease;
}

.tadawul-country-button.active .tadawul-arrow {
    transform: rotate(180deg);
}

/* Country Dropdown */
.tadawul-country-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 320px;
    max-height: 350px;
    background: #2d2d2d;
    border: 1px solid rgba(255, 107, 53, 0.3);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow: hidden;
}

/* Country Search */
.tadawul-country-search {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tadawul-country-search input {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

.tadawul-country-search input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 107, 53, 0.5);
}

.tadawul-country-search input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* Country List */
.tadawul-country-list {
    max-height: 280px;
    overflow-y: auto;
}

/* Country Item */
.tadawul-country-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tadawul-country-item:hover {
    background: rgba(255, 107, 53, 0.1);
}

.tadawul-country-item .tadawul-flag {
    font-size: 24px;
    line-height: 1;
    flex-shrink: 0;
}

.tadawul-country-item .tadawul-country-name {
    flex: 1;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
}

.tadawul-country-item .tadawul-country-code {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    font-weight: 500;
}

/* Country Divider */
.tadawul-country-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 8px 16px;
}

/* Phone Input */
.tadawul-phone-input {
    flex: 1;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #ffffff;
    font-size: 15px;
    transition: all 0.3s ease;
}

.tadawul-phone-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 107, 53, 0.5);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.tadawul-phone-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* Scrollbar for Country List */
.tadawul-country-list::-webkit-scrollbar {
    width: 6px;
}

.tadawul-country-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.tadawul-country-list::-webkit-scrollbar-thumb {
    background: rgba(255, 107, 53, 0.5);
    border-radius: 3px;
}

.tadawul-country-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 107, 53, 0.7);
}

/* Mobile Responsive for Country Selector */
@media (max-width: 768px) {
    .tadawul-phone-container {
        flex-direction: column;
        gap: 12px;
    }
    
    .tadawul-country-selector {
        width: 100%;
    }
    
    .tadawul-country-button {
        width: 100%;
        justify-content: space-between;
    }
    
    .tadawul-country-dropdown {
        width: 100%;
    }
    
    .tadawul-phone-input {
        width: 100%;
    }
}
