/**
 * TPC Social Login — Stylesheet
 * Designed to work with Minimog theme and WooCommerce without overriding
 * existing button styles. Uses BEM-style scoped classes.
 */

/* ── Wrapper ──────────────────────────────────────────────────────────────── */

.tpc-sl-wrap {
    margin: 1.5em 0 0.5em;
    width: 100%;
}

/* ── Divider ──────────────────────────────────────────────────────────────── */

.tpc-sl-divider {
    display: flex;
    align-items: center;
    gap: 0.75em;
    margin-bottom: 1em;
    color: #9ca3af;
    font-size: 0.8125rem;
    line-height: 1;
}

.tpc-sl-divider::before,
.tpc-sl-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: #e5e7eb;
}

/* ── Button row ───────────────────────────────────────────────────────────── */

.tpc-sl-buttons {
    display: flex;
    flex-direction: row;
    gap: 0.625em;
    flex-wrap: wrap;
}

/* ── Base button ──────────────────────────────────────────────────────────── */

.tpc-sl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    flex: 1 1 140px;
    min-height: 44px;          /* Touch target */
    padding: 0.5em 1.125em;
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.25;
    cursor: pointer;
    text-decoration: none !important;
    transition: opacity 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
    white-space: nowrap;
    user-select: none;
    -webkit-font-smoothing: antialiased;
}

.tpc-sl-btn:hover:not(:disabled) {
    opacity: 0.88;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    text-decoration: none !important;
}

.tpc-sl-btn:active:not(:disabled) {
    transform: translateY(0);
    opacity: 1;
}

.tpc-sl-btn:focus-visible {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

/* ── Google ───────────────────────────────────────────────────────────────── */

.tpc-sl-btn--google {
    background-color: #ffffff;
    color: #374151 !important;
    border-color: #d1d5db;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.tpc-sl-btn--google svg {
    flex-shrink: 0;
}

/* ── Facebook ─────────────────────────────────────────────────────────────── */

.tpc-sl-btn--facebook {
    background-color: #1877f2;
    color: #ffffff !important;
    border-color: #1877f2;
}

.tpc-sl-btn--facebook svg {
    flex-shrink: 0;
    fill: #ffffff;
}

/* ── Loading state ────────────────────────────────────────────────────────── */

.tpc-sl-btn.tpc-sl-loading {
    opacity: 0.65;
    cursor: not-allowed;
    pointer-events: none;
}

.tpc-sl-btn.tpc-sl-loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: tpcSlSpin 0.65s linear infinite;
    flex-shrink: 0;
}

@keyframes tpcSlSpin {
    to { transform: rotate(360deg); }
}

/* ── Status message ───────────────────────────────────────────────────────── */

.tpc-sl-message {
    margin-top: 0.75em;
    font-size: 0.875rem;
    padding: 0.5em 0.875em;
    border-radius: 4px;
    line-height: 1.4;
}

.tpc-sl-message.tpc-sl-error {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.tpc-sl-message.tpc-sl-info {
    background-color: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

/* ── Inline email collection form (Facebook no-email flow) ────────────────── */

.tpc-sl-email-form {
    margin-top: 0.5em;
    display: flex;
    flex-direction: column;
    gap: 0.625em;
}

.tpc-sl-email-prompt {
    font-size: 0.875rem;
    color: #374151;
    margin: 0 0 0.25em;
    line-height: 1.45;
}

.tpc-sl-email-row {
    display: flex;
    gap: 0.5em;
    flex-wrap: wrap;
}

.tpc-sl-email-input {
    flex: 1 1 180px;
    min-height: 44px;
    padding: 0.5em 0.875em;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s ease;
}

.tpc-sl-email-input:focus {
    border-color: #1877f2;
    box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.15);
}

.tpc-sl-email-submit {
    flex-shrink: 0;
    min-height: 44px;
}

.tpc-sl-email-back {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.8125rem;
    color: #6b7280;
    cursor: pointer;
    text-align: left;
    text-decoration: underline;
}

.tpc-sl-email-back:hover {
    color: #374151;
}

[dir="rtl"] .tpc-sl-email-back {
    text-align: right;
}

[dir="rtl"] .tpc-sl-btn {
    flex-direction: row-reverse;
}

[dir="rtl"] .tpc-sl-divider::before {
    order: 2;
}
[dir="rtl"] .tpc-sl-divider::after {
    order: 0;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media ( max-width: 480px ) {
    .tpc-sl-buttons {
        flex-direction: column;
    }
    .tpc-sl-btn {
        flex: 1 1 100%;
    }
}
