/**
 * Real Estate CRM - Public/Frontend Styles
 * Overrides and adjustments for frontend display
 */

/* ==========================================================================
   Frontend Wrapper
   ========================================================================== */

.recrm-frontend-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

/* Remove admin margins */
.recrm-frontend-dashboard.recrm-leads-page {
    margin: 0;
    border-radius: 0;
}

/* Full width on frontend */
.recrm-frontend-dashboard {
    max-width: 100%;
}

/* Agent name styling */
.recrm-agent-name {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: normal;
}

/* Message styles */
.recrm-message {
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.recrm-message.recrm-error {
    border-left: 4px solid #dc3545;
    background: #fff5f5;
    color: #721c24;
}

.recrm-message.recrm-success {
    border-left: 4px solid #28a745;
    background: #f1f9f3;
    color: #155724;
}

.recrm-message.recrm-warning {
    border-left: 4px solid #ffc107;
    background: #fff8e1;
    color: #856404;
}

.recrm-message.recrm-info {
    border-left: 4px solid #17a2b8;
    background: #e7f5f8;
    color: #0c5460;
}

.recrm-message a {
    color: inherit;
    text-decoration: underline;
    font-weight: 600;
}

.recrm-message a:hover {
    text-decoration: none;
}

/* ==========================================================================
   Mobile Responsive Adjustments
   ========================================================================== */

@media screen and (max-width: 782px) {
    .recrm-frontend-wrapper {
        padding: 0;
    }
    
    .recrm-frontend-dashboard.recrm-leads-page {
        padding: 10px;
        border-radius: 0;
    }
    
    .recrm-agent-name {
        display: block;
        font-size: 14px;
        margin-top: 5px;
    }
    
    /* Remove borders from mobile table cards */
    .recrm-frontend-wrapper .recrm-leads-table tr {
        border: none !important;
    }
    
    .recrm-frontend-wrapper .recrm-leads-table td {
        border: none !important;
        border-bottom: none !important;
    }
    
    /* Fix vertical loading text on mobile */
    .recrm-frontend-wrapper .recrm-loading {
        display: block !important;
        width: 100% !important;
        min-width: 100% !important;
        white-space: nowrap !important;
        text-align: center !important;
        padding: 30px 20px !important;
    }
    
    .recrm-frontend-wrapper .recrm-loading-spinner {
        width: 100% !important;
        text-align: center !important;
        white-space: nowrap !important;
    }
    
    /* Keep Change Stage & Share buttons in one row on mobile */
    .recrm-frontend-wrapper .recrm-detail-section-header {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }
    
    /* Keep action buttons (Change Stage & Share) in one row on mobile */
    .recrm-frontend-wrapper .recrm-detail-section-header .recrm-header-actions {
        display: flex !important;
        flex-wrap: nowrap !important;
        flex-shrink: 0;
        gap: 5px !important;
    }
    
    /* Make buttons smaller on mobile to fit in one row */
    .recrm-frontend-wrapper .recrm-detail-section-header .recrm-header-actions .button {
        font-size: 13px !important;
        padding: 6px 10px !important;
        white-space: nowrap !important;
        min-width: auto !important;
    }
    
    /* Adjust dashicons size in mobile buttons */
    .recrm-frontend-wrapper .recrm-detail-section-header .recrm-header-actions .dashicons {
        font-size: 14px !important;
        width: 14px !important;
        height: 14px !important;
        margin-right: 2px !important;
    }
    
    .recrm-frontend-wrapper .recrm-detail-section-header h3 {
        flex: 1 1 auto;
        width: 100%; /* Force h3 to take full width on mobile, buttons go to next line but stay together */
        margin: 0;
    }
    
    .recrm-frontend-wrapper .recrm-detail-section-header .recrm-header-actions {
        width: auto;
        margin-left: 0 !important;
    }
}

/* Extra small screens - even more compact buttons (Frontend) */
@media screen and (max-width: 480px) {
    .recrm-frontend-wrapper .recrm-detail-section-header .recrm-header-actions .button {
        font-size: 12px !important;
        padding: 5px 8px !important;
    }
    
    .recrm-frontend-wrapper .recrm-detail-section-header .recrm-header-actions .dashicons {
        font-size: 13px !important;
        width: 13px !important;
        height: 13px !important;
    }
}

/* ==========================================================================
   Theme Compatibility
   ========================================================================== */

/* Reset theme styles that might conflict */
.recrm-frontend-wrapper * {
    box-sizing: border-box;
}

/* Ensure Dashicons work on frontend */
.recrm-frontend-wrapper .dashicons {
    font-family: dashicons;
}

/* Prevent theme button styles from overriding */
.recrm-frontend-wrapper .button,
.recrm-frontend-wrapper .button-primary,
.recrm-frontend-wrapper .button-secondary {
    display: inline-block;
    text-decoration: none;
    font-size: 13px;
    line-height: 2.15384615;
    min-height: 30px;
    margin: 0;
    padding: 0 10px;
    cursor: pointer;
    border-width: 1px;
    border-style: solid;
    -webkit-appearance: none;
    border-radius: 3px;
    white-space: nowrap;
    box-sizing: border-box;
}

/* Ensure contact action buttons maintain correct padding */
.recrm-frontend-wrapper .recrm-contact-action-btn,
.recrm-frontend-wrapper .recrm-contact-actions .recrm-contact-action-btn,
.recrm-frontend-wrapper .recrm-agent-contact-actions .recrm-contact-action-btn {
    padding: 8px 16px !important; /* Override any theme button styles */
}

/* Extra padding for Telegram and Instagram buttons */
.recrm-frontend-wrapper .recrm-contact-action-btn.recrm-telegram,
.recrm-frontend-wrapper .recrm-contact-action-btn.recrm-instagram {
    padding: 10px 20px !important; /* More space between text and border */
}

/* ==========================================================================
   SHARED Badge Styling (Frontend)
   ========================================================================== */

/* Shared badge in table - proper padding */
.recrm-frontend-wrapper .recrm-contact-details span[style*="SHARED"] {
    padding: 4px 10px !important;
}

/* Shared badge in modal detail - proper padding */
.recrm-frontend-wrapper .recrm-badge-shared,
.recrm-frontend-wrapper .recrm-detail-badge.recrm-badge-shared {
    padding: 8px 14px !important;
    gap: 6px !important;
}

.recrm-frontend-wrapper .recrm-badge-shared .dashicons {
    margin-right: 4px !important;
}



/* ==========================================================================
   Property Error Section - Mobile Responsive
   ========================================================================== */

.recrm-frontend-wrapper .recrm-property-error .recrm-property-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

@media screen and (max-width: 782px) {
    .recrm-frontend-wrapper .recrm-property-error .recrm-property-actions {
        flex-direction: column;
    }
    
    .recrm-frontend-wrapper .recrm-property-error .recrm-property-actions button {
        width: 100% !important;
        justify-content: center !important;
    }
}

/* ============================================================================
   ASSET MANAGEMENT SYSTEM STYLES (Frontend/Shortcode)
   ============================================================================ */

/* Note: Asset styles are inherited from admin-crm.css
   These are additional overrides for frontend display */

.recrm-frontend-wrapper #recrm-assets-container {
    min-height: 200px;
}

.recrm-frontend-wrapper .recrm-assets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.recrm-frontend-wrapper .recrm-asset-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.recrm-frontend-wrapper .recrm-asset-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #667eea;
}

@media screen and (max-width: 782px) {
    .recrm-frontend-wrapper .recrm-assets-grid {
        grid-template-columns: 1fr;
    }
}
