/* Welcome Modal Styles - Using Global Theme Variables */
.homepage-welcome-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    /* Prevent layout shifts */
    box-sizing: border-box;
}

.homepage-welcome-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    padding: 20px 0;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
}

.modal-content-wrapper {
    position: relative;
    z-index: 10000;
    max-width: 500px;
    width: 92%;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    animation: modalSlideIn 0.4s ease-out;
    /* Enable smooth scrolling */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* Custom scrollbar with primary color */
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) #f0f0f0;
    /* Prevent horizontal overflow */
    box-sizing: border-box;
}

.modal-content-wrapper::-webkit-scrollbar {
    width: 8px;
}

.modal-content-wrapper::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 10px;
}

.modal-content-wrapper::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

.modal-content-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-30px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-content {
    background: linear-gradient(135deg, #fff 0%, #f8fdff 100%);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(var(--primary-rgb), 0.25);
    position: relative;
    overflow: hidden;
    /* Prevent content overflow */
    max-width: 100%;
    box-sizing: border-box;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 160px; /* Fixed height that covers header content */
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: 16px 16px 0 0;
    z-index: 0;
}

.modal-body {
    padding: 30px 25px 30px;
    position: relative;
    z-index: 1;
    /* Ensure content doesn't get cut off but prevent overflow */
    overflow: visible;
    max-width: 100%;
    box-sizing: border-box;
}

.modal-header {
    text-align: center;
    margin-bottom: 20px;
    padding: 45px 20px 0 20px; /* Top padding for language switcher, side padding for content */
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

/* Modal Language Switcher Styles */
.modal-language-switcher {
    position: absolute;
    top: 8px;
    right: 50px; /* Position to the left of close button */
    display: flex;
    gap: 8px;
    z-index: 10002;
}

.modal-lang-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.modal-lang-btn:hover {
    background: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.2);
}

.modal-lang-btn:active {
    transform: translateY(0);
}

.modal-lang-btn img {
    width: 24px;
    height: 16px;
    border-radius: 2px;
    object-fit: cover;
}

.modal-lang-btn span {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.modal-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 15px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(var(--primary-rgb), 0.3);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.modal-icon i {
    font-size: 36px;
    color: var(--primary-color);
    animation: iconPulse 2s ease-in-out infinite;
    display: block;
    width: 36px;
    height: 36px;
    line-height: 36px;
    text-align: center;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: white;
    margin: 0 auto 8px auto;
    padding: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
    display: block;
    width: 100%;
}

.modal-subtitle {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.95);
    margin: 0 auto;
    padding: 0;
    font-weight: 500;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
    display: block;
    width: 100%;
}

.modal-subtitle strong {
    color: #FCD34D;
    font-size: 14px;
    font-weight: 700;
    white-space: normal; /* Allow wrapping for long amounts */
    word-break: break-word;
}

.modal-form {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    /* Ensure form content is fully scrollable */
    min-height: auto;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
    font-size: 13px;
}

.form-group label i {
    color: var(--primary-color);
    font-size: 14px;
}

.required {
    color: #EF4444;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    font-family: inherit;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.checkbox-group {
    margin-top: 14px;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    font-weight: 400;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--primary-color);
    flex-shrink: 0;
}

.checkbox-label span {
    font-size: 12px;
    color: #6B7280;
    line-height: 1.4;
}

.modal-message {
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    text-align: center;
    font-weight: 500;
}

.modal-message-success {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #A7F3D0;
}

.modal-message-error {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

.modal-submit-btn {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(var(--primary-rgb), 0.4);
}

.modal-submit-btn:active {
    transform: translateY(0);
}

.modal-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.modal-skip-btn {
    width: 100%;
    padding: 12px;
    background: transparent;
    color: #6B7280;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 8px;
    margin-bottom: 5px;
    transition: all 0.3s ease;
}

.modal-skip-btn:hover {
    color: #374151;
    background: #F3F4F6;
}

/* Language Change Notification */
.modal-lang-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    z-index: 10001;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideDownNotification 0.3s ease-out;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-lang-notification i {
    font-size: 16px;
}

@keyframes slideDownNotification {
    from {
        transform: translateX(-50%) translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .homepage-welcome-modal.show {
        padding: 10px 0;
        align-items: flex-start;
    }
    
    .modal-content-wrapper {
        width: 95%;
        max-height: 85vh;
        margin: 20px auto;
    }
    
    .modal-content-wrapper::-webkit-scrollbar {
        width: 6px;
    }
    
    .modal-body {
        padding: 25px 18px 25px;
    }
    
    .modal-header {
        padding: 40px 15px 0 15px;
        margin-bottom: 18px;
    }
    
    .modal-language-switcher {
        top: 8px;
        right: 45px;
        gap: 6px;
    }
    
    .modal-lang-btn {
        padding: 6px 10px;
        font-size: 12px;
        border-width: 1.5px;
    }
    
    .modal-lang-btn img {
        width: 20px;
        height: 14px;
    }
    
    .modal-lang-btn span {
        font-size: 11px;
    }
    
    .modal-form {
        padding: 16px 16px 20px;
    }
    
    .modal-lang-notification {
        top: 15px;
        padding: 10px 20px;
        font-size: 13px;
        max-width: 90%;
    }
    
    .modal-lang-notification i {
        font-size: 14px;
    }
    
    .modal-title {
        font-size: 16px;
        line-height: 1.35;
        padding: 0;
    }
    
    .modal-subtitle {
        font-size: 12px;
        line-height: 1.35;
    }
    
    .modal-subtitle strong {
        font-size: 13px;
    }
    
    .modal-icon {
        width: 60px;
        height: 60px;
        margin-bottom: 12px;
    }
    
    .modal-icon i {
        font-size: 30px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    .modal-content::before {
        height: 125px;
    }
}

@media (max-width: 480px) {
    .homepage-welcome-modal.show {
        padding: 8px 0;
        align-items: flex-start;
    }
    
    .modal-content-wrapper {
        width: 96%;
        max-height: 82vh;
        margin: 15px auto;
    }
    
    .modal-content-wrapper::-webkit-scrollbar {
        width: 5px;
    }
    
    .modal-body {
        padding: 20px 12px 20px;
    }
    
    .modal-header {
        padding: 35px 12px 0 12px;
        margin-bottom: 15px;
    }
    
    .modal-language-switcher {
        top: 5px;
        right: 40px;
        gap: 4px;
    }
    
    .modal-lang-btn {
        padding: 5px 8px;
        font-size: 11px;
    }
    
    .modal-lang-btn img {
        width: 18px;
        height: 12px;
    }
    
    .modal-lang-btn span {
        font-size: 10px;
    }
    
    .modal-form {
        padding: 14px 14px 18px;
    }
    
    .modal-lang-notification {
        top: 10px;
        padding: 8px 16px;
        font-size: 12px;
        max-width: 92%;
    }
    
    .modal-lang-notification i {
        font-size: 13px;
    }
    
    .modal-title {
        font-size: 15px;
        line-height: 1.3;
        padding: 0;
    }
    
    .modal-subtitle {
        font-size: 12px;
        line-height: 1.35;
    }
    
    .modal-subtitle strong {
        font-size: 12px;
    }
    
    .modal-icon {
        width: 52px;
        height: 52px;
        margin-bottom: 10px;
    }
    
    .modal-icon i {
        font-size: 25px;
    }
    
    .form-group {
        margin-bottom: 10px;
    }
    
    .form-group input,
    .form-group select {
        padding: 9px 10px;
        font-size: 13px;
    }
    
    .modal-content::before {
        height: 110px;
    }
    
    .modal-submit-btn {
        padding: 12px;
        font-size: 14px;
    }
}

/* Landscape phone optimization */
@media (max-height: 600px) and (orientation: landscape) {
    .homepage-welcome-modal.show {
        padding: 5px 0;
        align-items: flex-start;
    }
    
    .modal-content-wrapper {
        max-height: 88vh;
        margin: 10px auto;
    }
    
    .modal-content-wrapper::-webkit-scrollbar {
        width: 4px;
    }
    
    .modal-body {
        padding: 12px 15px 15px;
    }
    
    .modal-header {
        margin-bottom: 8px;
        padding: 30px 10px 0 10px;
    }
    
    .modal-language-switcher {
        top: 5px;
        right: 35px;
        gap: 4px;
    }
    
    .modal-lang-btn {
        padding: 4px 7px;
        font-size: 10px;
    }
    
    .modal-lang-btn img {
        width: 16px;
        height: 11px;
    }
    
    .modal-lang-btn span {
        font-size: 9px;
    }
    
    .modal-icon {
        width: 40px;
        height: 40px;
        margin-bottom: 6px;
    }
    
    .modal-icon i {
        font-size: 20px;
    }
    
    .modal-title {
        font-size: 13px;
        margin-bottom: 4px;
        line-height: 1.3;
        padding: 0;
    }
    
    .modal-subtitle {
        font-size: 11px;
        line-height: 1.3;
    }
    
    .modal-subtitle strong {
        font-size: 11px;
    }
    
    .modal-form {
        padding: 10px 10px 12px;
    }
    
    .form-group {
        margin-bottom: 7px;
    }
    
    .form-group label {
        margin-bottom: 3px;
        font-size: 11px;
    }
    
    .form-group input,
    .form-group select {
        padding: 6px 8px;
        font-size: 12px;
    }
    
    .checkbox-label span {
        font-size: 10px;
    }
    
    .modal-content::before {
        height: 85px;
    }
    
    .modal-submit-btn {
        padding: 9px;
        font-size: 12px;
    }
    
    .modal-skip-btn {
        padding: 7px;
        font-size: 10px;
        margin-top: 4px;
    }
}

