/* ==========================================================================
   Messenger Links — Frontend Styles (RTL-first)
   ========================================================================== */

.ml-frontend-wrap { padding: 30px 0; min-height: 50vh; }
.ml-container { max-width: 900px; margin: 0 auto; padding: 0 16px; }

/* --- Header --- */
.ml-header { text-align: center; margin-bottom: 28px; }
.ml-page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--ml-text-primary, #1a1a2e);
    margin: 0;
    padding-bottom: 12px;
    border-bottom: 3px solid var(--ml-accent, #4f46e5);
    display: inline-block;
}

/* --- Grid --- */
.ml-messengers-grid {
    display: grid;
    gap: 16px;
}
.ml-mode-grid .ml-messengers-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.ml-mode-minimal .ml-messengers-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}
.ml-mode-tabbed .ml-messengers-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

/* --- Tabs --- */
.ml-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    justify-content: center;
    flex-wrap: wrap;
}
.ml-tab-btn {
    padding: 8px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 24px;
    background: #fff;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all .15s;
}
.ml-tab-btn:hover { border-color: #6366f1; color: #6366f1; }
.ml-tab-btn.active {
    background: #6366f1;
    color: #fff;
    border-color: #6366f1;
}

/* ====================================================================
   CARD — Grid mode
   ==================================================================== */
.ml-messenger-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 24px 16px 20px;
    text-align: center;
    transition: transform .2s ease, box-shadow .2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.ml-messenger-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(0,0,0,.1);
}

/* --- Icon --- */
.ml-messenger-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
}
.ml-messenger-icon img { width: 100%; height: 100%; object-fit: contain; }
.ml-icon-fallback { color: #9ca3af; }
.ml-no-logo .ml-messenger-icon {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #e0e7ff, #ede9fe);
    color: #6366f1;
}

/* --- Name --- */
.ml-messenger-name {
    font-size: 15px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 12px;
}

/* --- Link Buttons --- */
.ml-links-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ml-link-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all .15s ease;
}
.ml-link-btn svg { flex-shrink: 0; }
.ml-chat-btn    { background: #ede9fe; color: #5b21b6; }
.ml-chat-btn:hover    { background: #5b21b6; color: #fff; }
.ml-group-btn   { background: #dbeafe; color: #1e40af; }
.ml-group-btn:hover   { background: #1e40af; color: #fff; }
.ml-channel-btn { background: #d1fae5; color: #065f46; }
.ml-channel-btn:hover { background: #065f46; color: #fff; }

/* ====================================================================
   MINIMAL mode
   ==================================================================== */
.ml-mode-minimal .ml-minimal-card {
    padding: 14px 10px 12px;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.ml-mode-minimal .ml-minimal-card .ml-messenger-icon {
    width: 44px;
    height: 44px;
    margin-bottom: 8px;
    border-radius: 12px;
}
.ml-mode-minimal .ml-minimal-card .ml-messenger-name {
    font-size: 12px;
    margin-bottom: 8px;
}
.ml-minimal-links {
    display: flex;
    gap: 4px;
    justify-content: center;
    flex-wrap: wrap;
}
/* دکمه‌های مینیمال با متن */
.ml-minimal-btn-text {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 7px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    text-decoration: none;
    transition: all .15s;
    line-height: 1.4;
}
.ml-minimal-btn-text svg { flex-shrink: 0; }
.ml-minimal-btn-text.ml-chat-btn    { background: #ede9fe; color: #5b21b6; }
.ml-minimal-btn-text.ml-chat-btn:hover    { background: #5b21b6; color: #fff; }
.ml-minimal-btn-text.ml-group-btn   { background: #dbeafe; color: #1e40af; }
.ml-minimal-btn-text.ml-group-btn:hover   { background: #1e40af; color: #fff; }
.ml-minimal-btn-text.ml-channel-btn { background: #d1fae5; color: #065f46; }
.ml-minimal-btn-text.ml-channel-btn:hover { background: #065f46; color: #fff; }

/* ====================================================================
   TABBED mode
   ==================================================================== */
.ml-mode-tabbed .ml-tabbed-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ====================================================================
   Phone Cards (SMS / Call)
   ==================================================================== */
.ml-phone-card {
    border-color: #bfdbfe;
    background: linear-gradient(135deg, #eff6ff, #f0f9ff);
}
.ml-phone-card:hover {
    border-color: #93c5fd;
}
.ml-phone-link {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.ml-phone-number {
    font-size: 12px;
    color: #6b7280;
    margin: 0;
    direction: ltr;
    text-align: left;
    letter-spacing: .3px;
}
.ml-icon-sms {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe) !important;
    color: #1e40af !important;
}
.ml-icon-call {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0) !important;
    color: #065f46 !important;
}

/* Minimal phone cards */
.ml-mode-minimal .ml-phone-card {
    padding: 14px 10px 12px;
}
.ml-mode-minimal .ml-phone-card .ml-messenger-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
}
.ml-mode-minimal .ml-phone-card .ml-messenger-name {
    font-size: 12px;
}

/* ====================================================================
   Empty
   ==================================================================== */
.ml-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
    font-size: 16px;
}

/* ====================================================================
   Responsive
   ==================================================================== */
@media (max-width: 600px) {
    .ml-container { padding: 0 10px; }
    .ml-page-title { font-size: 20px; }

    .ml-mode-grid .ml-messengers-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .ml-mode-minimal .ml-messengers-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    .ml-mode-tabbed .ml-messengers-grid {
        grid-template-columns: 1fr;
    }

    .ml-messenger-card { padding: 16px 12px 14px; border-radius: 14px; }
    .ml-messenger-icon { width: 52px; height: 52px; }
    .ml-messenger-name { font-size: 13px; }

    .ml-minimal-card .ml-messenger-icon { width: 38px; height: 38px; }
    .ml-minimal-card .ml-messenger-name { font-size: 11px; margin-bottom: 6px; }


    .ml-tab-btn { padding: 6px 14px; font-size: 13px; }
}

@media (max-width: 360px) {
    .ml-mode-minimal .ml-messengers-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}