/**
 * V4 Frontend Styles
 *
 * Frontend CSS for V4 Elementor + HTML System
 * Provides styling for V4 widgets, HTML preservation, and business data integration.
 *
 * @package InoriWeb_V4_ElementorHTML
 * @version 1.0.0
 */

/* ===== V4 PAGE WRAPPER ===== */
.v4-page-wrapper {
    position: relative;
}

.v4-page-wrapper[data-v4-mode="enhanced"] {
    /* Enhanced mode styling */
}

.v4-page-wrapper[data-v4-mode="strict"] {
    /* Strict preservation mode */
    font-family: inherit !important;
    line-height: inherit !important;
}

/* ===== V4 WIDGET BASE STYLES ===== */
.v4-widget {
    position: relative;
    margin-bottom: 1rem;
}

.v4-widget.v4-preserve-html {
    /* HTML preservation styles */
    font-family: inherit;
    line-height: inherit;
}

.v4-widget.v4-business-data {
    /* Business data integration styles */
}

/* ===== V4 HTML PRESERVATION ===== */
.v4-html-preserved {
    position: relative;
    width: 100%;
}

.v4-html-preserved[data-v4-preserve="true"] {
    /* Strict HTML preservation */
    font-family: inherit !important;
    line-height: inherit !important;
    color: inherit !important;
}

.v4-html-preserved[data-v4-preserve="true"] * {
    box-sizing: border-box;
}

/* ===== V4 BUSINESS INFO WIDGET ===== */
.v4-business-info .business-info {
    padding: 1.5rem;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.v4-business-info .business-name {
    margin: 0 0 1rem 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
}

.v4-business-info .contact-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.v4-business-info .contact-details p {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.v4-business-info .contact-details strong {
    min-width: 60px;
    color: #34495e;
}

.v4-business-info .contact-details a {
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s ease;
}

.v4-business-info .contact-details a:hover {
    color: #2980b9;
    text-decoration: underline;
}

/* Responsive Business Info */
@media (max-width: 768px) {
    .v4-business-info .business-info {
        padding: 1rem;
    }

    .v4-business-info .business-name {
        font-size: 1.25rem;
    }

    .v4-business-info .contact-details p {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
}

/* ===== V4 TEMPLATE VARIABLE WIDGET ===== */
.v4-template-variable {
    display: inline-block;
    position: relative;
}

.v4-template-variable.v4-variable-business_name {
    font-weight: 600;
}

.v4-template-variable.v4-variable-email,
.v4-template-variable.v4-variable-phone {
    font-family: inherit;
}

.v4-template-variable.v4-variable-address {
    line-height: 1.4;
}

.v4-template-variable-link {
    color: inherit;
    text-decoration: none;
    transition: all 0.3s ease;
}

.v4-template-variable-link:hover {
    text-decoration: underline;
}

/* ===== V4 SECTION IDENTIFIER ===== */
.v4-section-identifier {
    padding: 0.5rem;
    margin: 0.5rem 0;
    background: rgba(231, 76, 60, 0.1);
    border-left: 3px solid #e74c3c;
    border-radius: 3px;
    font-size: 0.875rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.v4-section-identifier.v4-editor-only {
    /* Hidden on frontend, visible in editor only */
    display: none;
}

.v4-section-identifier.v4-visibility-hover {
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

.v4-section-identifier.v4-visibility-hover:hover {
    opacity: 1;
}

.v4-section-identifier.v4-visibility-hidden {
    display: none;
}

.v4-section-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.v4-section-id {
    font-family: 'Consolas', 'Monaco', monospace;
    background: rgba(255, 255, 255, 0.7);
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
}

.v4-anchor-point {
    position: absolute;
    top: -60px; /* Offset for fixed headers */
    left: 0;
    visibility: hidden;
}

/* ===== V4 WIDGET ERROR STATES ===== */
.v4-widget-error {
    padding: 1rem;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 4px;
    color: #a00;
    text-align: center;
    font-weight: 500;
}

/* ===== V4 DEBUG INFO ===== */
.v4-debug-info {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.75rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border-left: 3px solid #007cba;
}

/* ===== V4 LOADING STATES ===== */
.v4-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.v4-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: v4-spin 1s linear infinite;
}

@keyframes v4-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== V4 ANIMATIONS ===== */
.v4-fade-in {
    animation: v4-fade-in 0.5s ease-in-out;
}

@keyframes v4-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.v4-slide-in {
    animation: v4-slide-in 0.3s ease-out;
}

@keyframes v4-slide-in {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== V4 UTILITY CLASSES ===== */
.v4-text-center { text-align: center; }
.v4-text-left { text-align: left; }
.v4-text-right { text-align: right; }

.v4-mb-1 { margin-bottom: 0.5rem; }
.v4-mb-2 { margin-bottom: 1rem; }
.v4-mb-3 { margin-bottom: 1.5rem; }

.v4-p-1 { padding: 0.5rem; }
.v4-p-2 { padding: 1rem; }
.v4-p-3 { padding: 1.5rem; }

/* ===== V4 RESPONSIVE UTILITIES ===== */
@media (max-width: 768px) {
    .v4-widget {
        margin-bottom: 0.75rem;
    }

    .v4-section-identifier {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .v4-debug-info {
        font-size: 0.7rem;
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    .v4-widget {
        margin-bottom: 0.5rem;
    }

    .v4-section-identifier {
        padding: 0.25rem;
        font-size: 0.8rem;
    }
}

/* ===== V4 PRINT STYLES ===== */
@media print {
    .v4-section-identifier,
    .v4-debug-info {
        display: none !important;
    }

    .v4-widget {
        break-inside: avoid;
        margin-bottom: 0.5rem;
    }
}