/**
 * MSHB Properties Grid Styles
 * Matches existing Josefin theme styling
 */

/* Section styling */
.mshb-property-section {
    margin-bottom: 40px;
}

.mshb-section-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
    color: #333;
}

/* Grid layout */
.mshb-property-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 20px;
    position: relative;
}

/* Loading and error states */
.mshb-loading,
.mshb-error,
.mshb-no-properties {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #666;
}

.mshb-error {
    color: #c00;
}

/* Property card */
.property-item {
    display: flex;
    flex-direction: column;
    border: 1px solid #ccc;
    border-radius: 8px;
    overflow: visible !important;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    background: #fff;
}

/* Property thumbnail */
.property-thumb {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    overflow: hidden;
    flex-shrink: 0;
    border-radius: 8px 8px 0 0;
}

.property-thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Overlay badges */
.property-overlay-text {
    position: absolute;
    padding: 5px 10px;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    color: white;
    z-index: 1;
}

/* Status badges - top left */
.status-badge {
    top: 10px;
    left: 0;
}

.status-badge.under-contract {
    background-color: #f0a100;
}

.status-badge.sold {
    background-color: #c00;
}

.status-badge.available {
    background-color: #27ae60;
}

.is-duplex {
    top: 10px;
    right: 0;
    background-color: #1f3060;
}

.new-construction {
    bottom: 10px;
    left: 0;
    right: 0;
    background-color: #2ecc40;
}

.buydown-rate {
    bottom: 40px;
    right: 0;
    background-color: #9b59b6;
}

/* Property details */
.property-details {
    padding: 15px;
    position: relative;
    overflow: visible !important;
    z-index: 10;
}

.property-details h2 {
    font-size: 24px;
    margin-bottom: 10px;
    line-height: 1;
}

.property-details p {
    font-size: 18px;
    margin-bottom: 8px;
    line-height: 1;
}

.propertydetailslink {
    text-decoration: none;
    color: inherit;
}

.propertydetailslink:hover h2 {
    color: #f0a100;
}

/* Cash flow highlight */
.property-details h2.cash-flow {
    font-weight: bold;
    color: #1f3060;
}

/* IRR link */
.property-details .property-irr-link {
    font-size: 24px;
    text-decoration: none;
    color: #f0a100;
}

.property-details .property-irr-link:hover {
    text-decoration: underline;
}

/* Button container */
.button-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 15px 15px;
    overflow: hidden;
}

.irr-button, .moreinfo {
    width: 100%;
    padding: 10px;
    text-align: center;
    background-color: #1f3060;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
}

.property-button {
    width: 100%;
    padding: 10px;
    text-align: center;
    background-color: #f0a100;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
}

.contract-button {
    width: 100%;
    padding: 10px;
    text-align: center;
    background-color: #27ae60;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
}

.copy-to-clipboard {
    width: 100%;
    padding: 3px;
    text-align: center;
    background-color: #f0f0f0;
    color: black;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 12px;
}

.property-button:hover {
    background-color: #1f3060;
}

.irr-button:hover, .moreinfo:hover {
    background-color: #f0a100;
}

/* Tooltip styles */
.tooltip-inline {
    display: inline-block;
    vertical-align: middle;
    margin-left: 5px;
    position: relative;
    z-index: 20;
}

.tooltip-trigger {
    cursor: pointer;
    font-size: 14px;
    padding: 1px 6px;
    background-color: #f0a100;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: inline-block;
    text-align: center;
    line-height: 18px;
    font-weight: bold;
}

.tooltip-content {
    position: absolute;
    width: 350px;
    background-color: #f9f9f9;
    padding: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 9999;
    line-height: 1.6em;
    left: 0;
    top: 100%;
    margin-top: 10px;
    display: none;
    white-space: normal;
    color: #333;
}

.tooltip-content .tooltip-line {
    display: block;
    margin-bottom: 10px;
}

.tooltip-content .tooltip-line:last-child {
    margin-bottom: 0;
}

.tooltip-content::after {
    content: '';
    position: absolute;
    top: -10px;
    left: 10px;
    border-width: 5px;
    border-style: solid;
    border-color: transparent transparent #f9f9f9 transparent;
}

.tooltip-inline.active .tooltip-content {
    display: block;
    z-index: 10000;
}

/* Filter Bar Styles */
.mshb-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.mshb-filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.mshb-filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mshb-filter-group select,
.mshb-filter-group input {
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    min-width: 140px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mshb-filter-group select:hover,
.mshb-filter-group input:hover {
    border-color: #f0a100;
}

.mshb-filter-group select:focus,
.mshb-filter-group input:focus {
    outline: none;
    border-color: #f0a100;
    box-shadow: 0 0 0 3px rgba(240,161,0,0.15);
}

.mshb-filter-actions {
    display: flex;
    gap: 10px;
    margin-left: auto;
    align-items: flex-end;
}

.mshb-filter-apply,
.mshb-filter-clear {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mshb-filter-apply {
    background: #1f3060;
    color: #fff;
}

.mshb-filter-apply:hover {
    background: #f0a100;
}

.mshb-filter-clear {
    background: #e0e0e0;
    color: #333;
}

.mshb-filter-clear:hover {
    background: #ccc;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .tooltip-content {
        width: 280px;
        font-size: 14px;
    }

    .mshb-property-grid {
        grid-template-columns: 1fr;
    }

    .property-details h2 {
        font-size: 20px;
        line-height: 1em;
    }

    .property-details p {
        font-size: 18px;
    }

    .property-overlay-text {
        font-size: 16px;
    }

    .mshb-filter-bar {
        justify-content: center;
    }

    .mshb-filter-actions {
        width: 100%;
        justify-content: center;
        margin-left: 0;
        margin-top: 10px;
    }
}

@media screen and (max-width: 576px) {
    .mshb-filter-group {
        width: 100%;
    }

    .mshb-filter-group select,
    .mshb-filter-group input {
        width: 100%;
    }

    .mshb-filter-apply,
    .mshb-filter-clear {
        flex: 1;
    }
}
