/**
 * BharatMistri Custom Styles
 * 
 * Overrides, enhancements and non-Tailwind styles for the plugin.
 * Loaded after Tailwind CSS.
 * 
 * @package BharatMistri
 * @version 1.0.0
 */

/* ==========================================================================
   1. Global / Base
   ========================================================================== */

:root {
    --bm-primary: #4f46e5;     /* indigo-600 */
    --bm-primary-dark: #4338ca; /* indigo-700 */
    --bm-success: #10b981;
    --bm-warning: #f59e0b;
    --bm-danger: #ef4444;
    --bm-gray: #6b7280;
}

html {
    scroll-behavior: smooth;
}

/* Better focus states for accessibility */
*:focus-visible {
    outline: 3px solid var(--bm-primary);
    outline-offset: 2px;
}

/* Remove default focus outline (we use custom above) */
*:focus:not(:focus-visible) {
    outline: none;
}

/* ==========================================================================
   2. Form Elements
   ========================================================================== */

/* Input / Select / Textarea styling consistency */
input[type="text"],
input[type="tel"],
input[type="number"],
input[type="date"],
select,
textarea {
    @apply border-gray-300 rounded-md shadow-sm;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

input:focus,
select:focus,
textarea:focus {
    @apply border-indigo-500 ring-1 ring-indigo-500 ring-opacity-50;
}

/* Visual feedback for valid/invalid states (used by JS) */
input.valid {
    border-color: var(--bm-success) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2310b981'%3E%3Cpath fill-rule='evenodd' d='M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
}

input.invalid {
    border-color: var(--bm-danger) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23ef4444'%3E%3Cpath fill-rule='evenodd' d='M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
}

/* Error message below fields */
.field-error {
    @apply text-red-600 text-sm mt-1;
}

/* ==========================================================================
   3. Buttons & Actions
   ========================================================================== */

.bm-call,
.bm-whatsapp {
    @apply inline-flex items-center justify-center px-6 py-3 rounded-lg font-medium text-white transition shadow-sm;
    min-width: 140px;
}

.bm-call {
    @apply bg-indigo-600 hover:bg-indigo-700;
}

.bm-whatsapp {
    @apply bg-green-600 hover:bg-green-700;
}

.bm-verified {
    @apply inline-flex items-center bg-green-100 text-green-800 px-3 py-1 rounded-full text-sm font-medium;
}

/* Dashboard submenu */
.bm-dashboard nav ul li a {
    padding-bottom: 0.5rem;
    transition: all 0.2s;
}

.bm-dashboard nav ul li a:hover,
.bm-dashboard nav ul li a.font-bold {
    border-bottom: 2px solid #4f46e5;
    color: #4f46e5;
}

/* ==========================================================================
   4. Cards & Lists
   ========================================================================== */

.bm-card,
.bm-match-list .bm-card {
    @apply bg-white border border-gray-200 rounded-xl overflow-hidden shadow-sm transition-all duration-200;
}

.bm-card:hover {
    @apply shadow-md -translate-y-1;
}

/* ==========================================================================
   5. Notices / Messages
   ========================================================================== */

.bm-notice {
    @apply p-4 rounded-lg border-l-4 mb-6;
}

.bm-notice-success {
    @apply bg-green-50 border-green-500 text-green-800;
}

.bm-notice-error {
    @apply bg-red-50 border-red-500 text-red-800;
}

.bm-notice-warning {
    @apply bg-yellow-50 border-yellow-500 text-yellow-800;
}

/* ==========================================================================
   6. Responsive Adjustments
   ========================================================================== */

@media (max-width: 640px) {
    .bm-container {
        @apply px-4 py-8;
    }

    .bm-single-mistri .md\\:w-1\\/3,
    .bm-single-job .md\\:w-1\\/3 {
        @apply w-full;
    }
}

/* ==========================================================================
   7. Print Styles (basic)
   ========================================================================== */

@media print {
    .bm-actions a,
    .no-print {
        display: none !important;
    }

    .bm-container {
        max-width: 100%;
        padding: 0;
    }

    h1, h2, h3 {
        page-break-after: avoid;
    }
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #6366f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* ── Contact Gate Popup ──────────────────────────────────────────────── */
#bm-contact-popup { display: none; position: fixed; inset: 0; z-index: 99999; }
#bm-contact-popup.bm-cp-visible { display: block; }

#bm-contact-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(2px);
    animation: bmCpFadeIn .18s ease;
}

#bm-contact-modal {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 20px;
    padding: 36px 32px 28px;
    width: 90%; max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,.18);
    animation: bmCpSlideIn .22s cubic-bezier(.34,1.56,.64,1);
    outline: none;
}

#bm-contact-close {
    position: absolute; top: 14px; right: 16px;
    background: #f1f5f9; border: none;
    width: 30px; height: 30px; border-radius: 50%;
    font-size: 18px; line-height: 1; cursor: pointer;
    color: #64748b; display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
#bm-contact-close:hover { background: #e2e8f0; color: #0f172a; }

.bm-cp-icon { font-size: 44px; margin-bottom: 12px; line-height: 1; }

#bm-contact-modal h3 {
    font-size: 20px; font-weight: 800;
    color: #0f172a; margin: 0 0 10px;
}

#bm-contact-modal p {
    font-size: 14px; color: #64748b;
    margin: 0 0 22px; line-height: 1.6;
}

.bm-cp-login-btn {
    display: block;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff !important;
    font-size: 15px; font-weight: 700;
    padding: 13px 24px;
    border-radius: 10px;
    text-decoration: none !important;
    transition: opacity .15s, transform .15s;
    margin-bottom: 14px;
}
.bm-cp-login-btn:hover { opacity: .9; transform: translateY(-1px); }

.bm-cp-note {
    font-size: 13px; color: #94a3b8;
}
.bm-cp-note a { color: #4f46e5; font-weight: 600; text-decoration: none; }
.bm-cp-note a:hover { text-decoration: underline; }

@keyframes bmCpFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes bmCpSlideIn {
    from { opacity: 0; transform: translate(-50%, -46%) scale(.96); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
