/**
 * Land Listings Pro - Frontend Styles
 * 
 * Color inheritance: This plugin automatically detects and uses 
 * the active theme's color scheme when available.
 * 
 * Supported theme variables:
 * - LM365 Modern: --lm-primary, --lm-primary-dark
 * - LM365 Classic: --primary, --primary-dark
 * - Custom themes: Define --lm365-primary, --lm365-primary-dark
 */

/* Hide Google Maps alpha/development warning banner */
.dismissButton,
div[style*="background-color: rgb(255, 255, 255)"][style*="color: rgb(0, 0, 0)"][style*="font-family: Roboto"] {
    display: none !important;
}

/* More specific selector for Google Maps warning */
.gm-style > div > div:first-child > div:first-child[style*="z-index: 1"] {
    display: none !important;
}

/* Anti-spam verification field - visually hidden but accessible */
.llp-form-verify {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Base Variables - Inherits from theme or uses defaults */
:root {
    /* Default colors (WordPress blue) - will be overridden by theme */
    --llp-primary: #2271b1;
    --llp-primary-dark: #135e96;
    --llp-primary-light: #72aee6;
    --llp-success: #198754;
    --llp-danger: #dc3545;
    --llp-text: #1d2327;
    --llp-text-light: #646970;
    --llp-border: #ddd;
    --llp-bg: #f6f7f7;
    --llp-white: #fff;
}

/* Theme Color Detection - Automatically use theme colors when available */

/* LM365 Modern Theme (blue scheme) */
body.lm365-modern-theme .llp-button-primary,
body.lm365-modern-theme .lm365-btn-primary,
body.lm365-modern-theme [class*="llp-"] .btn-primary {
    --llp-primary: var(--lm-primary, #2271b1);
    --llp-primary-dark: var(--lm-primary-dark, #135e96);
}

/* LM365 Classic Theme (red scheme) */
body.lm365-classic-theme .llp-button-primary,
body.lm365-classic-theme .lm365-btn-primary,
body.lm365-classic-theme [class*="llp-"] .btn-primary {
    --llp-primary: var(--primary, #d32f2f);
    --llp-primary-dark: var(--primary-dark, #b71c1c);
}

/* Universal fallback - check for any theme-defined primary color */
:root {
    --llp-primary: var(--lm365-primary, var(--lm-primary, var(--primary, #2271b1)));
    --llp-primary-dark: var(--lm365-primary-dark, var(--lm-primary-dark, var(--primary-dark, #135e96)));
}

/* Common Button Styles */
.llp-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    line-height: 1;
}

.llp-button-primary {
    background: var(--llp-primary);
    color: var(--llp-white);
}

.llp-button-primary:hover {
    background: var(--llp-primary-dark);
    color: var(--llp-white);
}

.llp-button-secondary {
    background: transparent;
    color: var(--llp-primary);
    border: 2px solid var(--llp-primary);
}

.llp-button-secondary:hover {
    background: var(--llp-primary);
    color: var(--llp-white);
}

.llp-button-success {
    background: var(--llp-success);
    color: var(--llp-white);
}

.llp-button-success:hover {
    background: #157347;
    color: var(--llp-white);
}

.llp-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Form Styles */
.llp-form-group {
    margin-bottom: 15px;
}

.llp-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 14px;
    color: var(--llp-text);
}

.llp-form-group label .required {
    color: var(--llp-danger);
}

.llp-form-group input,
.llp-form-group select,
.llp-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid var(--llp-border);
    border-radius: 5px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--llp-white);
}

.llp-form-group input:focus,
.llp-form-group select:focus,
.llp-form-group textarea:focus {
    outline: none;
    border-color: var(--llp-primary);
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.15);
}

.llp-form-group input[type="color"] {
    width: 60px;
    height: 40px;
    padding: 3px;
    cursor: pointer;
}

/* Messages */
.llp-message {
    padding: 12px 16px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.llp-message-success {
    background: #d1e7dd;
    color: #0f5132;
    border: 1px solid #badbcc;
}

.llp-message-error {
    background: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
}

.llp-message-info {
    background: #cff4fc;
    color: #055160;
    border: 1px solid #b6effb;
}

/* Loading Spinner */
.llp-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--llp-border);
    border-top-color: var(--llp-primary);
    border-radius: 50%;
    animation: llp-spin 0.8s linear infinite;
}

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

/* Slick Slider Customization */
.slick-prev,
.slick-next {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9) !important;
    border-radius: 50%;
    z-index: 10;
}

.slick-prev {
    left: 15px;
}

.slick-next {
    right: 15px;
}

.slick-prev:before,
.slick-next:before {
    color: var(--llp-text) !important;
    font-size: 20px;
}

.slick-dots {
    bottom: 15px;
}

.slick-dots li button:before {
    font-size: 10px;
    color: var(--llp-white);
    opacity: 0.7;
}

.slick-dots li.slick-active button:before {
    color: var(--llp-white);
    opacity: 1;
}

/* Magnific Popup Customization */
.mfp-bg {
    background: #000;
    opacity: 0.9;
}

.mfp-counter {
    color: var(--llp-white);
}

/* Leaflet Map Customization */
.leaflet-container {
    font-family: inherit;
}

/* Responsive Utilities */
@media (max-width: 768px) {
    .llp-hide-mobile {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .llp-hide-desktop {
        display: none !important;
    }
}

/* ==========================================================================
   FAQ Page - Sticky Navigation Tabs
   ========================================================================== */

/* FAQ Tabs Container - Sticky below header */
/* Target both our custom class AND generic WordPress button groups on FAQ pages */
.lm365-faq-tabs-wrapper,
.page-template-default.page-id-faq .wp-block-buttons,
body[class*="faq"] .wp-block-buttons.is-content-justification-center,
.faq .wp-block-buttons.is-content-justification-center,
.page-slug-faq .wp-block-buttons.is-content-justification-center {
    position: sticky !important;
    top: 80px !important; /* Default for most theme headers */
    z-index: 999 !important;
    background: #ffffff !important;
    padding: 15px 20px !important;
    margin: 0 0 30px 0 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: top 0.3s ease;
}

/* WordPress admin bar adjustment */
.admin-bar .lm365-faq-tabs-wrapper,
.admin-bar[class*="faq"] .wp-block-buttons.is-content-justification-center,
.admin-bar .page-slug-faq .wp-block-buttons.is-content-justification-center {
    top: 112px !important; /* 80px header + 32px admin bar */
}

@media screen and (max-width: 782px) {
    .admin-bar .lm365-faq-tabs-wrapper,
    .admin-bar[class*="faq"] .wp-block-buttons.is-content-justification-center {
        top: 126px !important; /* 80px header + 46px mobile admin bar */
    }
}

/* LM365 Classic Theme specific - has taller header */
body.flavor-flavor-classic .lm365-faq-tabs-wrapper,
body.flavor-flavor-classic[class*="faq"] .wp-block-buttons.is-content-justification-center {
    top: 80px !important;
}

.admin-bar.flavor-flavor-classic .lm365-faq-tabs-wrapper,
.admin-bar.flavor-flavor-classic[class*="faq"] .wp-block-buttons.is-content-justification-center {
    top: 112px !important;
}

/* FAQ Tabs Buttons */
.lm365-faq-tabs {
    gap: 10px !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
}

.lm365-faq-tabs .wp-block-button__link {
    padding: 10px 20px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border-radius: 25px !important;
    transition: all 0.2s ease !important;
    text-decoration: none !important;
}

.lm365-faq-tabs .wp-block-button.is-style-outline .wp-block-button__link {
    border: 2px solid currentColor !important;
    background: transparent !important;
}

.lm365-faq-tabs .wp-block-button.is-style-outline .wp-block-button__link:hover {
    background: var(--llp-primary, #2271b1) !important;
    color: #ffffff !important;
    border-color: var(--llp-primary, #2271b1) !important;
}

/* FAQ Sections */
.lm365-faq-section {
    scroll-margin-top: 100px; /* Offset for sticky header */
    padding-top: 20px;
}

/* Smooth scrolling for anchor links */
html {
    scroll-behavior: smooth;
}

/* FAQ Section highlight boxes */
.lm365-faq-section .has-pale-cyan-blue-background-color,
.lm365-faq-section .has-luminous-vivid-amber-background-color {
    border-left: 4px solid var(--llp-primary, #2271b1);
}

.lm365-faq-section .has-luminous-vivid-amber-background-color {
    border-left-color: #fcb900;
}

/* Mobile adjustments */
@media (max-width: 600px) {
    .lm365-faq-tabs-wrapper {
        padding: 10px 15px !important;
    }
    
    .lm365-faq-tabs {
        gap: 8px !important;
    }
    
    .lm365-faq-tabs .wp-block-button__link {
        padding: 8px 15px !important;
        font-size: 12px !important;
    }
    
    .lm365-faq-section {
        scroll-margin-top: 80px;
    }
}

/* ========================================
   FULL-WIDTH MAP PAGE OVERRIDES
   Forces the map layout to be full-width regardless of theme
   ======================================== */

/* Make the map page break out of theme containers */
.llp-map-page {
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

/* Hide theme's page header/title when map is present */
body:has(.llp-map-page) .page-header,
body:has(.llp-map-page) .entry-header,
body:has(.llp-map-page) .page-title-wrapper,
body:has(.llp-map-page) .breadcrumbs,
body:has(.llp-map-page) article > header {
    display: none !important;
}

/* Remove theme container padding/margin when map is present */
body:has(.llp-map-page) .content-area,
body:has(.llp-map-page) .site-content,
body:has(.llp-map-page) .content-main,
body:has(.llp-map-page) .entry-content,
body:has(.llp-map-page) main,
body:has(.llp-map-page) article {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* For themes that don't support :has(), add a body class via JS */
body.llp-fullwidth-map .page-header,
body.llp-fullwidth-map .entry-header,
body.llp-fullwidth-map .page-title-wrapper,
body.llp-fullwidth-map .breadcrumbs {
    display: none !important;
}

body.llp-fullwidth-map .content-area,
body.llp-fullwidth-map .site-content,
body.llp-fullwidth-map .content-main,
body.llp-fullwidth-map .entry-content,
body.llp-fullwidth-map main,
body.llp-fullwidth-map article {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}
