/* =========================================================================
 * TMD B2B Login & Registration — Dark Theme
 * Version: 1.0
 * Matches site design: navy/royal blue, geometric, Plus Jakarta Sans + Cairo
 * ========================================================================= */

/* ─── Page Container ─── */
.woocommerce-account .tmd-auth-page {
    min-height: 100vh;
    background: #0a0f1e;
    background-image:
        linear-gradient(rgba(37, 99, 235, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(37, 99, 235, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    position: relative;
}

/* ─── Header / Logo ─── */
.tmd-auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.tmd-auth-header__logo {
    width: 160px;
    height: auto;
    margin-bottom: 0.75rem;
}

.tmd-auth-header__title {
    font-family: 'Plus Jakarta Sans', 'Cairo', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 0.25rem;
    letter-spacing: -0.02em;
}

.tmd-auth-header__subtitle {
    font-family: 'Cairo', 'Plus Jakarta Sans', sans-serif;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
    direction: rtl;
}

/* ─── Two-Panel Container ─── */
.tmd-auth-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    width: 100%;
    max-width: 920px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow:
        0 0 0 1px rgba(37, 99, 235, 0.15),
        0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* ─── Panel Base ─── */
.tmd-auth-panel {
    background: #0f172a;
    padding: 2.5rem;
    position: relative;
}

.tmd-auth-panel--login {
    border-right: 1px solid rgba(37, 99, 235, 0.15);
}

.tmd-auth-panel--register {
    background: linear-gradient(135deg, #0f172a 0%, #111d35 100%);
}

/* ─── Geometric Accent (top-right corner clip) ─── */
.tmd-auth-panel--register::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.2), transparent);
    clip-path: polygon(100% 0, 0 0, 100% 100%);
}

/* ─── Panel Titles ─── */
.tmd-auth-panel__title {
    font-family: 'Plus Jakarta Sans', 'Cairo', sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 0.25rem;
}

.tmd-auth-panel__subtitle {
    font-family: 'Cairo', 'Plus Jakarta Sans', sans-serif;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.4);
    margin: 0 0 1.75rem;
    direction: rtl;
}

/* ─── Form Fields ─── */
.tmd-auth-field {
    margin-bottom: 1.25rem;
}

.tmd-auth-field label,
.tmd-auth-panel .form-row label {
    display: block;
    font-family: 'Plus Jakarta Sans', 'Cairo', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.4rem;
    letter-spacing: 0.02em;
}

.tmd-auth-field label .label-ar {
    float: right;
    font-family: 'Cairo', sans-serif;
    direction: rtl;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 500;
}

.tmd-auth-field input[type="text"],
.tmd-auth-field input[type="email"],
.tmd-auth-field input[type="password"],
.tmd-auth-field input[type="tel"],
.tmd-auth-field select,
.tmd-auth-panel .form-row input[type="text"],
.tmd-auth-panel .form-row input[type="email"],
.tmd-auth-panel .form-row input[type="password"] {
    width: 100%;
    padding: 0.7rem 0.9rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #ffffff;
    font-family: 'Plus Jakarta Sans', 'Cairo', sans-serif;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    box-sizing: border-box;
}

.tmd-auth-field input:focus,
.tmd-auth-panel .form-row input:focus {
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.tmd-auth-field input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

/* Validation states */
.tmd-auth-field input.tmd-invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.tmd-auth-field input.tmd-valid {
    border-color: #22c55e;
}

.tmd-auth-field__error {
    font-size: 0.75rem;
    color: #ef4444;
    margin-top: 0.3rem;
    display: none;
    font-family: 'Cairo', sans-serif;
    direction: rtl;
}

.tmd-auth-field__error.tmd-show {
    display: block;
}

/* ─── Two-column row (first + last name) ─── */
.tmd-auth-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* ─── Buttons ─── */
.tmd-auth-btn {
    width: 100%;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-family: 'Plus Jakarta Sans', 'Cairo', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tmd-auth-btn--primary {
    background: #2563EB;
    color: #ffffff;
}

.tmd-auth-btn--primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

.tmd-auth-btn--primary:active {
    transform: translateY(0);
}

/* Loading state */
.tmd-auth-btn--loading {
    pointer-events: none;
    opacity: 0.7;
    position: relative;
}

.tmd-auth-btn--loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 1rem;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: tmd-spin 0.6s linear infinite;
}

@keyframes tmd-spin {
    to { transform: rotate(360deg); }
}

/* ─── Remember Me ─── */
.tmd-auth-remember {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.tmd-auth-remember input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #2563EB;
    cursor: pointer;
}

.tmd-auth-remember label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    margin-bottom: 0;
}

/* ─── Links ─── */
.tmd-auth-link {
    display: inline-block;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: #2563EB;
    text-decoration: none;
    transition: color 0.2s;
}

.tmd-auth-link:hover {
    color: #60a5fa;
    text-decoration: underline;
}

/* ─── WhatsApp alternative ─── */
.tmd-auth-whatsapp {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
}

.tmd-auth-whatsapp__text {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    margin: 0 0 0.5rem;
}

.tmd-auth-whatsapp__link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: rgba(37, 211, 102, 0.1);
    border: 1px solid rgba(37, 211, 102, 0.25);
    border-radius: 8px;
    color: #25d366;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.tmd-auth-whatsapp__link:hover {
    background: rgba(37, 211, 102, 0.2);
    color: #25d366;
}

.tmd-auth-whatsapp__link svg {
    width: 18px;
    height: 18px;
}

/* ─── Divider ─── */
.tmd-auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0;
    color: rgba(255, 255, 255, 0.25);
    font-size: 0.8rem;
}

.tmd-auth-divider::before,
.tmd-auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
}

/* ─── Footer ─── */
.tmd-auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.75rem;
    font-family: 'Plus Jakarta Sans', 'Cairo', sans-serif;
}

/* ─── Pending Notice ─── */
.tmd-auth-pending {
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.tmd-auth-pending__icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.tmd-auth-pending__title {
    font-family: 'Cairo', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #eab308;
    margin: 0 0 0.5rem;
    direction: rtl;
}

.tmd-auth-pending__text {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
    line-height: 1.6;
}

/* ─── Success Notice (after registration) ─── */
.tmd-auth-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.tmd-auth-success__title {
    font-family: 'Cairo', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #22c55e;
    margin: 0 0 0.5rem;
    direction: rtl;
}

.tmd-auth-success__text {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
    line-height: 1.6;
}

/* ─── WooCommerce Error Notices Override ─── */
.woocommerce-account .tmd-auth-page .woocommerce-error,
.woocommerce-account .tmd-auth-page .woocommerce-message,
.woocommerce-account .tmd-auth-page .woocommerce-info {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #fca5a5;
    padding: 0.75rem 1rem;
    margin: 0 0 1rem;
    list-style: none;
    font-size: 0.85rem;
}

.woocommerce-account .tmd-auth-page .woocommerce-message {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: #86efac;
}

.woocommerce-account .tmd-auth-page .woocommerce-info {
    background: rgba(37, 99, 235, 0.1);
    border-color: rgba(37, 99, 235, 0.3);
    color: #93c5fd;
}

/* ─── Hide default WC form styling ─── */
.woocommerce-account .tmd-auth-page .woocommerce form.woocommerce-form-login,
.woocommerce-account .tmd-auth-page .woocommerce form.woocommerce-form-register {
    border: none;
    padding: 0;
    margin: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
}

/* Override WC's u-columns wrapper */
.woocommerce-account .tmd-auth-page .u-columns,
.woocommerce-account .tmd-auth-page .col-1,
.woocommerce-account .tmd-auth-page .col-2 {
    display: contents !important;
    width: auto !important;
    float: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Hide WC default headings (we use our own) */
.woocommerce-account .tmd-auth-page .u-columns h2 {
    display: none;
}

/* ─── Honeypot Field (invisible to humans) ─── */
.tmd-hp-field {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
}

/* ─── Required Asterisk ─── */
.tmd-required {
    color: #ef4444;
    margin-left: 2px;
}

/* ─── Tabs for Mobile ─── */
.tmd-auth-tabs {
    display: none;
    width: 100%;
    max-width: 920px;
    margin-bottom: 0;
}

.tmd-auth-tabs__list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    background: #0f172a;
    border-radius: 16px 16px 0 0;
    overflow: hidden;
    border: 1px solid rgba(37, 99, 235, 0.15);
    border-bottom: none;
}

.tmd-auth-tabs__item {
    flex: 1;
    padding: 0.9rem;
    text-align: center;
    font-family: 'Plus Jakarta Sans', 'Cairo', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.tmd-auth-tabs__item--active {
    color: #ffffff;
    border-bottom-color: #2563EB;
    background: rgba(37, 99, 235, 0.08);
}

/* ─── Password Strength ─── */
.tmd-password-strength {
    height: 3px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.08);
    margin-top: 0.4rem;
    overflow: hidden;
}

.tmd-password-strength__bar {
    height: 100%;
    border-radius: 2px;
    width: 0;
    transition: width 0.3s, background 0.3s;
}

.tmd-password-strength__bar[data-strength="1"] {
    width: 25%;
    background: #ef4444;
}

.tmd-password-strength__bar[data-strength="2"] {
    width: 50%;
    background: #eab308;
}

.tmd-password-strength__bar[data-strength="3"] {
    width: 75%;
    background: #22c55e;
}

.tmd-password-strength__bar[data-strength="4"] {
    width: 100%;
    background: #22c55e;
}

/* =========================================================================
 * RESPONSIVE — Mobile (< 768px)
 * ========================================================================= */
@media (max-width: 767px) {
    .tmd-auth-page {
        padding: 1rem 0.75rem;
    }

    .tmd-auth-header {
        margin-bottom: 1rem;
    }

    .tmd-auth-header__logo {
        width: 120px;
    }

    .tmd-auth-header__title {
        font-size: 1.2rem;
    }

    /* Show tabs on mobile */
    .tmd-auth-tabs {
        display: block;
    }

    /* Stack panels vertically, hide inactive */
    .tmd-auth-panels {
        grid-template-columns: 1fr;
        border-radius: 0 0 16px 16px;
    }

    .tmd-auth-panel--login {
        border-right: none;
    }

    /* Tab switching via body class */
    .tmd-auth-panels[data-active="register"] .tmd-auth-panel--login {
        display: none;
    }

    .tmd-auth-panels[data-active="login"] .tmd-auth-panel--register {
        display: none;
    }

    .tmd-auth-panel {
        padding: 1.5rem;
    }

    /* Geometric accent smaller on mobile */
    .tmd-auth-panel--register::before {
        width: 50px;
        height: 50px;
    }

    .tmd-auth-row {
        grid-template-columns: 1fr;
    }
}

/* ─── Small Mobile (< 480px) ─── */
@media (max-width: 479px) {
    .tmd-auth-panel {
        padding: 1.25rem 1rem;
    }

    .tmd-auth-panel__title {
        font-size: 1.1rem;
    }

    .tmd-auth-btn {
        padding: 0.65rem 1rem;
        font-size: 0.85rem;
    }
}

/* =========================================================================
 * ADMIN — Approval Column & Actions
 * ========================================================================= */

/* Admin user list — approval status badge */
.tmd-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.tmd-status-badge--pending {
    background: #fef3c7;
    color: #92400e;
}

.tmd-status-badge--approved {
    background: #d1fae5;
    color: #065f46;
}

/* =========================================================================
 * Print — Hide auth page from print
 * ========================================================================= */
@media print {
    .tmd-auth-page {
        display: none;
    }
}
