/* Submit Wish Web Form Styles */

/* Page Container */
.web-form-container {
    max-width: 750px;
    margin: 0 auto;
}

/* Introduction Section - with inline style fallback */
.wish-intro {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    padding: 30px !important;
    border-radius: 12px !important;
    margin-bottom: 30px !important;
    text-align: center !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3) !important;
}

.wish-intro h4 {
    font-size: 26px !important;
    font-weight: 700 !important;
    margin-bottom: 15px !important;
    color: white !important;
}

.wish-intro p {
    font-size: 16px !important;
    opacity: 0.95 !important;
    margin: 0 !important;
    line-height: 1.6 !important;
    color: white !important;
}

/* Web Form Card Styling */
.web-form .web-form-header {
    display: none;
}

.web-form-container .introduction {
    margin-bottom: 0;
}

/* Form Section Styling */
.web-form .section-body,
.web-form .form-group {
    background: #fff;
    border-radius: 8px;
}

/* Form Labels */
.web-form label,
.web-form .control-label {
    font-weight: 600 !important;
    color: #333 !important;
    font-size: 15px !important;
    margin-bottom: 10px !important;
    display: block;
}

/* Form Fields */
.web-form .form-control,
.web-form input[type="text"],
.web-form input[type="email"],
.web-form select,
.web-form textarea {
    border: 2px solid #e0e0e0 !important;
    border-radius: 10px !important;
    padding: 14px 16px !important;
    font-size: 15px !important;
    transition: all 0.3s ease !important;
    background: #fafafa !important;
}

.web-form .form-control:focus,
.web-form input:focus,
.web-form select:focus,
.web-form textarea:focus {
    border-color: #667eea !important;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15) !important;
    background: #fff !important;
    outline: none !important;
}

.web-form textarea {
    min-height: 160px !important;
    resize: vertical !important;
}

.web-form select {
    cursor: pointer !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 8L1 3h10z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 15px center !important;
    padding-right: 40px !important;
}

/* Field Groups */
.web-form .frappe-control {
    margin-bottom: 24px !important;
}

/* Help Text */
.web-form .help-block,
.web-form .text-muted {
    color: #888 !important;
    font-size: 13px !important;
    margin-top: 6px !important;
    font-style: italic;
}

/* Submit Button */
.web-form .btn-primary,
.web-form button[type="submit"],
.web-form .btn-primary-dark {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border: none !important;
    padding: 16px 50px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    border-radius: 10px !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3) !important;
    color: white !important;
    cursor: pointer !important;
    display: inline-block !important;
    margin-top: 20px !important;
}

.web-form .btn-primary:hover,
.web-form button[type="submit"]:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4) !important;
}

.web-form .btn-primary:active,
.web-form button[type="submit"]:active {
    transform: translateY(-1px) !important;
}

/* Success Message */
.wish-success {
    text-align: center !important;
    padding: 50px 30px !important;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%) !important;
    border-radius: 16px !important;
    margin: 20px 0 !important;
}

.wish-success .success-icon {
    width: 90px !important;
    height: 90px !important;
    background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 auto 30px !important;
    font-size: 45px !important;
    color: white !important;
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.35) !important;
    animation: successPop 0.6s ease-out !important;
}

.wish-success h3 {
    color: #2e7d32 !important;
    font-size: 30px !important;
    font-weight: 700 !important;
    margin-bottom: 20px !important;
}

.wish-success p {
    color: #444 !important;
    font-size: 17px !important;
    line-height: 1.7 !important;
    margin-bottom: 12px !important;
}

.wish-success .tracking-info {
    margin-top: 25px !important;
    padding: 18px 25px !important;
    background: white !important;
    border-radius: 10px !important;
    color: #2e7d32 !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08) !important;
}

/* Required Field Indicator */
.web-form .reqd::after,
.web-form .asterisk {
    color: #e53935 !important;
    font-weight: bold !important;
}

/* Card wrapper for the form */
.web-form-wrapper {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 40px;
    margin: 20px auto;
    max-width: 700px;
}

/* Animation */
@keyframes successPop {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

/* Responsive */
@media (max-width: 768px) {
    .wish-intro {
        padding: 25px 20px !important;
    }

    .wish-intro h4 {
        font-size: 22px !important;
    }

    .wish-success h3 {
        font-size: 24px !important;
    }

    .web-form .btn-primary,
    .web-form button[type="submit"] {
        width: 100% !important;
        padding: 16px 30px !important;
    }

    .web-form-wrapper {
        padding: 25px 20px;
        margin: 10px;
    }
}

/* Nice placeholder styling */
.web-form ::placeholder {
    color: #aaa !important;
    font-style: italic;
}

/* Focus state for entire form group */
.web-form .frappe-control:focus-within label {
    color: #667eea !important;
}

/* Attachment Section Styling */
.web-form .attachments-container,
.web-form .attachment-section,
.web-form .web-form-attachments {
    margin-top: 25px !important;
    padding: 20px !important;
    background: #f8f9fa !important;
    border-radius: 12px !important;
    border: 2px dashed #e0e0e0 !important;
}

.web-form .attachment-section label,
.web-form .attachments-container label,
.web-form .web-form-attachments label {
    font-weight: 600 !important;
    color: #333 !important;
    font-size: 15px !important;
    margin-bottom: 15px !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.web-form .attachment-section label::before,
.web-form .web-form-attachments label::before {
    content: "📎" !important;
}

/* Dropzone / Upload Area */
.web-form .attach-btn-row,
.web-form .btn-attach {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border: none !important;
    padding: 12px 25px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

.web-form .attach-btn-row:hover,
.web-form .btn-attach:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3) !important;
}

/* File List */
.web-form .attached-file,
.web-form .attachment-row {
    background: white !important;
    padding: 12px 15px !important;
    border-radius: 8px !important;
    margin-top: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
}

.web-form .attached-file a,
.web-form .attachment-row a {
    color: #667eea !important;
    font-weight: 500 !important;
    text-decoration: none !important;
}

.web-form .attached-file a:hover,
.web-form .attachment-row a:hover {
    text-decoration: underline !important;
}

.web-form .remove-attachment,
.web-form .btn-remove {
    color: #e53935 !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    font-size: 16px !important;
    opacity: 0.7 !important;
    transition: opacity 0.2s !important;
}

.web-form .remove-attachment:hover,
.web-form .btn-remove:hover {
    opacity: 1 !important;
}

/* Attachment Help Text */
.web-form .attachments-container .text-muted,
.web-form .attachment-section .help-text {
    font-size: 12px !important;
    color: #888 !important;
    margin-top: 10px !important;
    font-style: italic !important;
}

/* Attach Field Styling */
.web-form [data-fieldtype="Attach"] {
    margin-top: 20px !important;
    padding: 20px !important;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    border-radius: 12px !important;
    border: 2px dashed #667eea !important;
}

.web-form [data-fieldtype="Attach"] .control-input {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 15px !important;
}

.web-form [data-fieldtype="Attach"] .btn-sm,
.web-form [data-fieldtype="Attach"] .btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border: none !important;
    padding: 12px 30px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

.web-form [data-fieldtype="Attach"] .btn-sm:hover,
.web-form [data-fieldtype="Attach"] .btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3) !important;
}

.web-form [data-fieldtype="Attach"] .attached-file {
    background: white !important;
    padding: 10px 15px !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
}

/* ================================================
   RTL Support for Arabic Interface
   ================================================ */

/* Auto-detect RTL from HTML lang attribute */
html[lang="ar"] .web-form,
html[dir="rtl"] .web-form,
[dir="rtl"] .web-form {
    direction: rtl !important;
    text-align: right !important;
}

/* RTL - Form Labels */
html[lang="ar"] .web-form label,
html[dir="rtl"] .web-form label,
[dir="rtl"] .web-form label {
    text-align: right !important;
}

/* RTL - Select dropdown arrow position */
html[lang="ar"] .web-form select,
html[dir="rtl"] .web-form select,
[dir="rtl"] .web-form select {
    background-position: left 15px center !important;
    padding-left: 40px !important;
    padding-right: 16px !important;
    text-align: right !important;
}

/* RTL - Input fields */
html[lang="ar"] .web-form input,
html[lang="ar"] .web-form textarea,
html[dir="rtl"] .web-form input,
html[dir="rtl"] .web-form textarea,
[dir="rtl"] .web-form input,
[dir="rtl"] .web-form textarea {
    text-align: right !important;
    direction: rtl !important;
}

/* RTL - Help text */
html[lang="ar"] .web-form .help-block,
html[lang="ar"] .web-form .text-muted,
html[dir="rtl"] .web-form .help-block,
html[dir="rtl"] .web-form .text-muted,
[dir="rtl"] .web-form .help-block,
[dir="rtl"] .web-form .text-muted {
    text-align: right !important;
}

/* RTL - Buttons alignment */
html[lang="ar"] .web-form .form-group .btn,
html[lang="ar"] .web-form .web-form-footer,
html[dir="rtl"] .web-form .form-group .btn,
html[dir="rtl"] .web-form .web-form-footer,
[dir="rtl"] .web-form .form-group .btn,
[dir="rtl"] .web-form .web-form-footer {
    text-align: right !important;
}

/* Bilingual label styling - make both languages look good */
.web-form label {
    line-height: 1.6 !important;
    unicode-bidi: plaintext !important;
}

/* Enhanced label styling for bilingual text */
.web-form .control-label {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Arabic", "Noto Sans", sans-serif !important;
}

/* Better spacing for Arabic text */
.wish-intro h4,
.wish-success h3 {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Arabic", "Noto Sans", sans-serif !important;
    line-height: 1.8 !important;
}

.wish-intro p,
.wish-success p {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Arabic", "Noto Sans", sans-serif !important;
    line-height: 2 !important;
}

/* Force text direction based on content */
.web-form input,
.web-form textarea,
.web-form select {
    unicode-bidi: plaintext !important;
}

/* Attachment field in RTL */
html[lang="ar"] .web-form [data-fieldtype="Attach"],
html[dir="rtl"] .web-form [data-fieldtype="Attach"],
[dir="rtl"] .web-form [data-fieldtype="Attach"] {
    direction: rtl !important;
}

html[lang="ar"] .web-form [data-fieldtype="Attach"] .attached-file,
html[dir="rtl"] .web-form [data-fieldtype="Attach"] .attached-file,
[dir="rtl"] .web-form [data-fieldtype="Attach"] .attached-file {
    flex-direction: row-reverse !important;
}

/* Auto-direction for mixed content */
.web-form [dir="auto"],
.wish-intro[dir="auto"],
.wish-success[dir="auto"] {
    unicode-bidi: plaintext !important;
}
