/* AgroMind PDF Gate — Frontend Styles v2 */

/* =============================================
   MODAL OVERLAY
   ============================================= */
#aml-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 15, 30, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* Entrance animation */
@keyframes amlSlideIn {
    from { opacity: 0; transform: translateY(-30px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* =============================================
   MODAL CONTENT
   ============================================= */
.aml-content {
    background: #ffffff;
    margin: 8vh auto;
    padding: 0;
    width: 90%;
    max-width: 420px;
    border-radius: 16px;
    text-align: center;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.05);
    overflow: hidden;
    animation: amlSlideIn 0.35s ease-out;
}

/* Accent header bar */
.aml-content::before {
    content: '';
    display: block;
    height: 5px;
    background: linear-gradient(90deg, #0073aa, #00a0d2, #0073aa);
    background-size: 200% 100%;
    animation: amlShimmer 3s ease-in-out infinite;
}

@keyframes amlShimmer {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

/* Modal icon area */
.aml-modal-icon {
    width: 56px;
    height: 56px;
    margin: 28px auto 16px;
    background: linear-gradient(135deg, #0073aa 0%, #00a0d2 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    box-shadow: 0 8px 20px rgba(0, 115, 170, 0.3);
}

/* Modal body padding */
.aml-modal-body {
    padding: 0 32px 32px;
}

/* Close button */
.aml-close {
    position: absolute;
    right: 14px;
    top: 14px;
    cursor: pointer;
    font-size: 22px;
    color: #b0b8c4;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    line-height: 1;
    z-index: 2;
}

.aml-close:hover {
    background: #f1f3f5;
    color: #555;
}

/* Title & description */
#aml-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 6px;
    letter-spacing: -0.3px;
}

#aml-desc {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 24px;
    line-height: 1.5;
}

/* Inputs */
.aml-input {
    width: 100%;
    padding: 13px 16px;
    margin-bottom: 12px;
    border: 1.5px solid #e2e6ec;
    border-radius: 10px;
    font-size: 15px;
    box-sizing: border-box;
    font-family: inherit;
    color: #1a1a2e;
    background: #f8f9fb;
    transition: all 0.2s ease;
    outline: none;
}

.aml-input:focus {
    border-color: #0073aa;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.12);
}

.aml-input::placeholder {
    color: #9ca3af;
}

/* Submit button */
#aml-submit {
    background: linear-gradient(135deg, #0073aa 0%, #005f8d 100%);
    color: #fff;
    padding: 14px;
    border: none;
    cursor: pointer;
    width: 100%;
    font-size: 16px;
    border-radius: 10px;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: 0.3px;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px rgba(0, 115, 170, 0.35);
    margin-top: 4px;
}

#aml-submit:hover {
    background: linear-gradient(135deg, #005f8d 0%, #004a6e 100%);
    box-shadow: 0 6px 20px rgba(0, 115, 170, 0.45);
    transform: translateY(-1px);
}

#aml-submit:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

#aml-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Error message */
#aml-msg {
    color: #dc3545;
    font-size: 13px;
    margin-top: 12px;
    font-weight: 500;
}

/* =============================================
   TOAST NOTIFICATION
   ============================================= */
#aml-toast {
    display: none;
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #1a1a2e 0%, #2d2d44 100%);
    color: #fff;
    padding: 14px 28px;
    border-radius: 12px;
    z-index: 100000;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    letter-spacing: 0.2px;
}

/* =============================================
   GREETING CARD (returning user)
   ============================================= */
.aml-card-box {
    background: linear-gradient(135deg, #ffffff 0%, #f0f7fc 50%, #e8f4fd 100%);
    border: 1px solid rgba(0, 115, 170, 0.12);
    border-left: 4px solid #0073aa;
    padding: 22px 24px;
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(0, 115, 170, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 18px;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    position: relative;
    overflow: hidden;
}

.aml-card-box:hover {
    box-shadow: 0 8px 28px rgba(0, 115, 170, 0.14), 0 2px 6px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

/* Subtle decorative element */
.aml-card-box::after {
    content: '';
    position: absolute;
    right: -20px;
    top: -20px;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgba(0, 115, 170, 0.06) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.aml-card-avatar {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #0073aa 0%, #00a0d2 100%);
    color: #fff;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
    letter-spacing: -0.5px;
}

.aml-card-info {
    flex-grow: 1;
    min-width: 0;
}

.aml-card-info h4 {
    margin: 0 0 4px 0;
    color: #1a1a2e;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.2px;
}

.aml-card-info p {
    margin: 0;
    color: #5a6577;
    font-size: 13.5px;
    line-height: 1.5;
}

.aml-badge {
    background: linear-gradient(135deg, #e0f2fe 0%, #d0ecfb 100%);
    color: #0369a1;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    display: inline-block;
    margin-top: 2px;
    letter-spacing: 0.2px;
    border: 1px solid rgba(3, 105, 161, 0.1);
}

/* =============================================
   JOIN FORM (new visitor widget)
   ============================================= */
.aml-join-box {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    padding: 24px;
    border-radius: 14px;
    margin-bottom: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}

/* Accent top border */
.aml-join-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #0073aa, #00a0d2);
}

.aml-join-box h4 {
    margin: 4px 0 6px 0;
    color: #1a1a2e;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.aml-join-box p {
    font-size: 13.5px;
    color: #6b7280;
    margin-bottom: 18px;
    line-height: 1.5;
}

.aml-join-input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e2e6ec;
    border-radius: 10px;
    margin-bottom: 10px;
    box-sizing: border-box;
    font-size: 14px;
    font-family: inherit;
    color: #1a1a2e;
    background: #f8f9fb;
    transition: all 0.2s ease;
    outline: none;
}

.aml-join-input:focus {
    border-color: #0073aa;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.12);
}

.aml-join-input::placeholder {
    color: #9ca3af;
}

.aml-join-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #0073aa 0%, #005f8d 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px rgba(0, 115, 170, 0.3);
    margin-top: 4px;
}

.aml-join-btn:hover {
    background: linear-gradient(135deg, #005f8d 0%, #004a6e 100%);
    box-shadow: 0 6px 20px rgba(0, 115, 170, 0.4);
    transform: translateY(-1px);
}

.aml-join-btn:active {
    transform: translateY(0);
}

.aml-join-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* =============================================
   MOBILE RESPONSIVE
   ============================================= */
@media (max-width: 480px) {
    .aml-content {
        margin: 5vh 15px;
        width: auto;
    }

    .aml-modal-body {
        padding: 0 24px 28px;
    }

    .aml-modal-icon {
        width: 48px;
        height: 48px;
        font-size: 22px;
        margin: 24px auto 14px;
    }

    #aml-title {
        font-size: 20px;
    }

    .aml-card-box {
        padding: 16px 18px;
        gap: 14px;
    }

    .aml-card-avatar {
        width: 44px;
        height: 44px;
        font-size: 18px;
        border-radius: 12px;
    }

    .aml-card-info h4 {
        font-size: 15px;
    }

    .aml-broadcast {
        padding: 14px 50px 14px 18px;
        font-size: 13px;
    }
}

/* =============================================
   BROADCAST POPUP
   ============================================= */
.aml-broadcast {
    position: fixed;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    z-index: 99998;
    padding: 16px 56px 16px 24px;
    max-width: 680px;
    width: auto;
    min-width: 280px;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
    overflow: hidden;
    box-sizing: border-box;
}

.aml-broadcast.aml-bc-top {
    top: 16px;
    bottom: auto;
    transform: translateX(-50%) translateY(-40px);
}

.aml-broadcast.aml-bc-bottom {
    bottom: 16px;
    top: auto;
    transform: translateX(-50%) translateY(40px);
}

.aml-broadcast.aml-bc-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.aml-broadcast.aml-bc-hiding {
    transform: translateX(-50%) translateY(40px);
    opacity: 0;
}

.aml-broadcast.aml-bc-top.aml-bc-hiding {
    transform: translateX(-50%) translateY(-40px);
    opacity: 0;
}

/* Dismiss button */
.aml-bc-close {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    line-height: 1;
}

.aml-bc-close:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* Auto-dismiss progress bar */
.aml-bc-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    transition: width linear;
}

/* Message content styling */
.aml-broadcast a {
    color: #fff;
    text-decoration: underline;
    font-weight: 600;
}

.aml-broadcast strong {
    font-weight: 700;
}
