/**
 * Akhuwat Loan Manager - Frontend Styles
 * Modern glassmorphism design with smooth animations
 */

/* ============ CSS RESET & BASE ============ */
.alm-form-wrapper,
.alm-form-wrapper * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.alm-form-wrapper {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    max-width: 100%;
    width: 100%;
    margin: 40px auto;
    padding: 0;
    color: #1a1a2e;
}

/* ============ FORM CONTAINER ============ */
.alm-form-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.08),
        0 4px 20px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    overflow: hidden;
    animation: almSlideUp 0.6s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.6);
}

@keyframes almSlideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============ HEADER ============ */
.alm-form-header {
    background: linear-gradient(135deg, #0d7a3e 0%, #14a352 40%, #1abb5e 100%);
    padding: 40px 35px 35px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.alm-form-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 60%);
    animation: almShimmer 8s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes almShimmer {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(180deg); }
}

.alm-form-logo {
    margin-bottom: 12px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
    animation: almPulse 2s ease-in-out infinite;
}

.alm-form-logo img {
    height: 70px;
    width: auto;
}

@keyframes almPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.alm-form-title {
    color: #ffffff;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.15);
    position: relative;
}

.alm-form-subtitle {
    color: rgba(255, 255, 255, 0.88);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.6;
    max-width: 450px;
    margin: 0 auto;
    position: relative;
}

/* ============ FORM BODY ============ */
#almApplicationForm {
    padding: 35px;
}

/* ============ FIELD GROUP ============ */
.alm-field-group {
    margin-bottom: 24px;
}

.alm-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}

.alm-label-icon {
    margin-right: 4px;
}

.alm-required {
    color: #e74c3c;
    font-weight: 700;
}

/* ============ INPUTS ============ */
.alm-input {
    width: 100%;
    padding: 14px 18px;
    font-size: 15px;
    font-family: inherit;
    color: #1a1a2e;
    background: #f8fafb;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-appearance: none;
    appearance: none;
}

.alm-input:hover {
    border-color: #cbd5e1;
    background: #fff;
}

.alm-input:focus {
    border-color: #0d7a3e;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(13, 122, 62, 0.1);
}

.alm-input.alm-input-error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 4px rgba(231, 76, 60, 0.1);
}

.alm-input.alm-input-success {
    border-color: #27ae60;
    box-shadow: 0 0 0 4px rgba(39, 174, 96, 0.1);
}

.alm-select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23666'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.alm-hint {
    display: block;
    font-size: 12px;
    color: #94a3b8;
    margin-top: 6px;
}

/* ============ ERROR MESSAGES ============ */
.alm-error {
    font-size: 13px;
    color: #e74c3c;
    margin-top: 6px;
    min-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    font-weight: 500;
}

.alm-error:not(:empty) {
    min-height: 20px;
    animation: almShakeX 0.4s ease;
}

@keyframes almShakeX {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* ============ PHOTO UPLOAD ============ */
.alm-photo-upload {
    text-align: center;
}

.alm-photo-preview {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: 3px dashed #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    background: #f8fafb;
    position: relative;
}

.alm-photo-preview:hover {
    border-color: #0d7a3e;
    border-style: solid;
    transform: scale(1.03);
    box-shadow: 0 8px 25px rgba(13, 122, 62, 0.15);
}

.alm-photo-preview.alm-has-photo {
    border-style: solid;
    border-color: #0d7a3e;
}

.alm-photo-placeholder {
    color: #94a3b8;
    font-size: 28px;
    text-align: center;
    line-height: 1.4;
}

.alm-photo-placeholder small {
    font-size: 11px;
    display: block;
    margin-top: 4px;
}

#almPhotoImg {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.alm-file-input {
    display: none;
}

/* ============ AUTO-FILLED FIELDS ============ */
.alm-auto-fields {
    margin: 28px 0;
    padding: 24px;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border-radius: 16px;
    border: 1px solid #bbf7d0;
    animation: almFadeIn 0.4s ease-out;
}

@keyframes almFadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.alm-auto-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

@media (max-width: 600px) {
    .alm-auto-grid {
        grid-template-columns: 1fr;
    }
}

.alm-auto-item {
    text-align: center;
    padding: 12px;
}

.alm-auto-label {
    display: block;
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
    margin-bottom: 6px;
}

.alm-auto-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #0d7a3e;
    animation: almCountUp 0.4s ease-out;
}

@keyframes almCountUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============ SUBMIT BUTTON ============ */
.alm-submit-group {
    margin-top: 32px;
}

.alm-submit-btn {
    width: 100%;
    padding: 16px 32px;
    font-size: 17px;
    font-weight: 700;
    font-family: inherit;
    color: #ffffff;
    background: linear-gradient(135deg, #0d7a3e 0%, #14a352 50%, #1abb5e 100%);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(13, 122, 62, 0.3);
}

.alm-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(13, 122, 62, 0.4);
}

.alm-submit-btn:active {
    transform: translateY(0);
}

.alm-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.alm-submit-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
    transition: all 0.6s ease;
}

.alm-submit-btn:hover::after {
    left: 100%;
}

/* Spinner */
.alm-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: almSpin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes almSpin {
    to { transform: rotate(360deg); }
}

/* ============ FORM NOTE ============ */
.alm-form-note {
    margin-top: 24px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #fff7ed, #ffedd5);
    border-radius: 12px;
    border-left: 4px solid #f59e0b;
    font-size: 13px;
    line-height: 1.7;
    color: #78350f;
}

.alm-form-note a {
    color: #0d7a3e;
    font-weight: 600;
    text-decoration: none;
}

.alm-form-note a:hover {
    text-decoration: underline;
}

/* ============ SUCCESS CONTAINER ============ */
.alm-success-container {
    animation: almSlideUp 0.6s ease-out;
}

.alm-success-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 45px 35px;
    text-align: center;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.08),
        0 4px 20px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.alm-success-icon {
    font-size: 72px;
    margin-bottom: 16px;
    animation: almBounce 1s ease infinite;
}

@keyframes almBounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-15px); }
    60% { transform: translateY(-8px); }
}

.alm-success-title {
    font-size: 26px;
    font-weight: 800;
    color: #0d7a3e;
    margin-bottom: 12px;
}

.alm-success-text {
    font-size: 15px;
    color: #64748b;
    line-height: 1.7;
    margin-bottom: 24px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.alm-success-notice {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-radius: 16px;
    padding: 24px;
    margin: 24px 0;
    text-align: left;
    border: 1px solid #fbbf24;
}

.alm-success-notice h3 {
    color: #92400e;
    font-size: 16px;
    margin-bottom: 10px;
}

.alm-success-notice p {
    color: #78350f;
    font-size: 14px;
    margin-bottom: 12px;
}

.alm-doc-list {
    list-style: none;
    padding: 0;
}

.alm-doc-list li {
    padding: 8px 0;
    color: #78350f;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 1px solid rgba(251, 191, 36, 0.3);
}

.alm-doc-list li:last-child {
    border-bottom: none;
}

/* WhatsApp Button */
.alm-whatsapp-btn {
    display: inline-block;
    padding: 16px 40px;
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: #ffffff !important;
    text-decoration: none !important;
    border-radius: 50px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.35);
    margin: 20px 0;
}

.alm-whatsapp-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(37, 211, 102, 0.45);
    color: #ffffff !important;
}

.alm-success-email-note {
    color: #64748b;
    font-size: 14px;
    margin-top: 16px;
}

.alm-apply-again-btn {
    display: inline-block;
    margin-top: 20px;
    padding: 12px 30px;
    background: transparent;
    color: #64748b;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.alm-apply-again-btn:hover {
    border-color: #0d7a3e;
    color: #0d7a3e;
}

/* ============ GLOBAL ERROR MESSAGE ============ */
.alm-global-error {
    padding: 14px 20px;
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 1px solid #fca5a5;
    border-radius: 12px;
    color: #991b1b;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
    animation: almShakeX 0.5s ease;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .alm-form-wrapper {
        margin: 20px auto;
    }

    .alm-form-container {
        border-radius: 18px;
    }

    .alm-form-header {
        padding: 30px 24px 28px;
    }

    .alm-form-title {
        font-size: 22px;
    }

    .alm-form-subtitle {
        font-size: 13px;
    }

    #almApplicationForm {
        padding: 24px 20px;
    }

    .alm-success-card {
        padding: 30px 20px;
    }

    .alm-success-title {
        font-size: 22px;
    }

    .alm-photo-preview {
        width: 130px;
        height: 130px;
    }
}

/* ============ STATUS CHECK TABS ============ */
.alm-check-tabs {
    display: flex !important;
    gap: 8px !important;
    margin-bottom: 28px !important;
    background: #f1f5f9 !important;
    border-radius: 14px !important;
    padding: 5px !important;
    border: none !important;
    box-shadow: none !important;
}

.alm-check-tab {
    flex: 1 !important;
    padding: 13px 18px !important;
    border: none !important;
    background: transparent !important;
    font-family: inherit !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #64748b !important;
    border-radius: 10px !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    outline: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    line-height: 1.4 !important;
    text-align: center !important;
    box-shadow: none !important;
    margin: 0 !important;
}

.alm-check-tab:hover {
    color: #1a1a2e !important;
    background: rgba(255,255,255,0.5) !important;
}

.alm-check-tab-active,
.alm-check-tab.alm-check-tab-active {
    background: #fff !important;
    color: #1a1a2e !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

/* Force all interactive elements to be clickable */
#almCheckWrapper .alm-check-tabs,
#almCheckWrapper #almCheckFormArea {
    position: relative !important;
    z-index: 5 !important;
}

#almCheckWrapper .alm-check-tab,
#almCheckWrapper .alm-submit-btn,
#almCheckWrapper .alm-input {
    position: relative !important;
    z-index: 10 !important;
    pointer-events: auto !important;
}

/* ============ RESULT CARDS ============ */
.alm-result-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 18px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
    padding: 28px;
    margin-bottom: 20px;
    animation: almSlideUp 0.5s ease-out;
    transition: all 0.3s ease;
}

.alm-result-card:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.alm-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
}

.alm-result-ref {
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 1px;
    font-family: 'Courier New', monospace;
}

.alm-result-name {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    margin-top: 4px;
}

.alm-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.3px;
    animation: almPulse 2s ease-in-out infinite;
}

/* ============ PROGRESS TIMELINE ============ */
.alm-progress-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 24px 0;
    position: relative;
}

.alm-progress-bar::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 24px;
    right: 24px;
    height: 3px;
    background: #e2e8f0;
    transform: translateY(-50%);
    z-index: 0;
}

.alm-progress-fill {
    position: absolute;
    top: 50%;
    left: 24px;
    height: 3px;
    background: linear-gradient(90deg, #10b981, #0d7a3e);
    transform: translateY(-50%);
    z-index: 1;
    transition: width 1s ease-out;
    border-radius: 3px;
}

.alm-progress-step {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    z-index: 2;
    background: #fff;
    border: 3px solid #e2e8f0;
    transition: all 0.5s ease;
    position: relative;
}

.alm-progress-step.active {
    border-color: #10b981;
    background: #d1fae5;
}

.alm-progress-step.current {
    border-color: #f59e0b;
    background: #fef3c7;
    animation: almPulse 1.5s ease-in-out infinite;
}

.alm-progress-step-label {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    font-weight: 600;
    color: #94a3b8;
    white-space: nowrap;
}

/* ============ DETAIL GRID ============ */
.alm-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-top: 20px;
}

.alm-detail-item {
    background: #f8fafb;
    border-radius: 12px;
    padding: 14px;
    border: 1px solid #f1f5f9;
}

.alm-detail-item-label {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 4px;
}

.alm-detail-item-value {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a2e;
}

.alm-detail-item-value.alm-amount {
    color: #0d7a3e;
    font-size: 17px;
}

/* ============ NO RESULTS ============ */
.alm-no-results {
    text-align: center;
    padding: 40px 20px;
    animation: almSlideUp 0.4s ease-out;
}

.alm-no-results-icon {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.7;
}

.alm-no-results h3 {
    color: #1a1a2e;
    font-size: 18px;
    margin-bottom: 8px;
}

.alm-no-results p {
    color: #64748b;
    font-size: 14px;
    line-height: 1.6;
}

/* ============ RESPONSIVE CHECK ============ */
@media (max-width: 600px) {
    .alm-check-tabs {
        flex-direction: column;
    }

    .alm-result-card {
        padding: 18px 14px;
        border-radius: 12px;
    }

    .alm-result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .alm-result-ref {
        font-size: 15px;
    }

    .alm-result-name {
        font-size: 13px;
    }

    .alm-status-badge {
        font-size: 12px;
        padding: 5px 12px;
    }

    .alm-detail-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .alm-detail-item {
        padding: 10px;
    }

    .alm-detail-item-label {
        font-size: 10px;
        letter-spacing: 0.4px;
    }

    .alm-detail-item-value {
        font-size: 13px;
        word-break: break-word;
        overflow-wrap: break-word;
        line-height: 1.4;
    }

    .alm-detail-item-value.alm-amount {
        font-size: 14px;
    }

    .alm-progress-bar {
        margin: 16px 0 24px;
        padding: 0 4px;
    }

    .alm-progress-step {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .alm-progress-step-label {
        font-size: 8px;
        max-width: 50px;
        white-space: normal;
        text-align: center;
        line-height: 1.2;
        word-wrap: break-word;
    }
}

/* ============ RTL SUPPORT FOR URDU ============ */
.alm-form-wrapper[dir="rtl"] {
    font-family: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', 'Urdu Typesetting', serif;
    line-height: 2.0;
}

.alm-form-wrapper[dir="rtl"] .alm-label-icon {
    margin-right: 0;
    margin-left: 4px;
}

.alm-form-wrapper[dir="rtl"] .alm-select {
    background-position: left 16px center;
    padding-right: 18px;
    padding-left: 40px;
}

.alm-form-wrapper[dir="rtl"] .alm-form-note {
    border-left: none;
    border-right: 4px solid #f59e0b;
}

.alm-form-wrapper[dir="rtl"] .alm-success-notice {
    text-align: right;
}

.alm-form-wrapper[dir="rtl"] .alm-spinner {
    margin-right: 0;
    margin-left: 8px;
}

.alm-form-wrapper[dir="rtl"] .alm-input,
.alm-form-wrapper[dir="rtl"] .alm-submit-btn,
.alm-form-wrapper[dir="rtl"] .alm-apply-again-btn {
    font-family: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', 'Urdu Typesetting', serif;
}

/* Status Check RTL */
#almCheckWrapper[dir="rtl"] {
    font-family: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', 'Urdu Typesetting', serif;
    direction: rtl;
    line-height: 2.0;
}

#almCheckWrapper[dir="rtl"] .alm-fees-notice {
    border-left: none;
    border-right: 4px solid;
}
