/* Base Styles for Print and Screen */
@page {
    size: letter;
    margin: 0.5in;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    margin: 0;
    padding: 0;
    background-color: #f9f9f9; /* Visible on screen, overridden for print */
}

.container {
    max-width: 850px;
    margin: 0 auto;
    padding: 20px;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.1); /* Hidden for print */
}

/* Header & Navigation */
.header {
    text-align: center;
    padding: 25px 0; /* Screen padding */
    margin-bottom: 30px; /* Screen margin */
    border-bottom: 3px solid #0056b3;
    position: relative;
}

.header h1 {
    color: #0056b3;
    margin: 0;
    font-size: 32px; /* Screen size */
}

.header p {
    color: #666;
    margin: 8px 0 0;
    font-size: 16px; /* Screen size */
}

.tagline {
    font-style: italic;
    color: #0056b3;
    margin-top: 10px;
    font-size: 18px; /* Screen size */
}

.site-nav {
    text-align: center;
    margin-bottom: 30px;
}

.site-nav a {
    display: inline-block;
    margin: 0 15px;
    color: #0056b3;
    text-decoration: none;
    font-weight: 500;
    font-size: 16px;
    transition: color 0.3s;
}

.site-nav a:hover {
    color: #003d7a;
    text-decoration: underline;
}

/* Main Image */
.main-image {
    width: 100%;
    height: 300px; /* Screen height */
    background-size: cover;
    background-position: center;
    margin-bottom: 20px; /* Screen margin */
    border-radius: 5px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.16); /* Hidden for print */
}

/* Gallery Section */
.gallery {
    margin: 30px 0;
}

.gallery-title {
    color: #0056b3;
    margin-bottom: 15px;
    font-size: 22px;
    border-bottom: 2px solid #eee;
    padding-bottom: 8px;
}

.gallery-container {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.gallery-item {
    flex: 1 0 30%;
    height: 180px; /* Screen height */
    background-size: cover;
    background-position: center;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Hidden for print */
    transition: transform 0.3s ease;
    cursor: pointer;
}

.gallery-item:hover {
    transform: scale(1.03); /* Disabled for print */
}

/* Property Details */
.property-card {
    margin-bottom: 40px; /* Screen margin */
    border: 1px solid #ddd; /* Screen border */
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1); /* Hidden for print */
}

.property-details {
    padding: 25px;
}

.property-name {
    font-size: 24px;
    font-weight: bold;
    color: #0056b3;
    margin: 0 0 15px;
}

.property-address {
    font-size: 18px;
    color: #444;
    margin-bottom: 20px;
    font-weight: 500;
}

.property-highlight {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 25px;
    border-left: 4px solid #0056b3;
}

.property-overview {
    font-size: 16px;
    line-height: 1.7;
    margin-bottom: 25px;
}

/* Uses flexbox below for better wrapping control */
.property-stats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px; /* Screen gap */
    margin-bottom: 30px; /* Screen margin */
}

.stat-block {
    background-color: #f0f4ff;
    padding: 15px; /* Screen padding */
    border-radius: 8px;
    flex: 1 1 30%;
    min-width: 150px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); /* Hidden for print */
}

.stat-label {
    font-weight: bold;
    color: #0056b3;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.2em;
}

.property-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr; /* Screen layout */
    gap: 20px;
    margin-bottom: 25px;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    padding: 20px 0;
}

.property-feature {
    margin-bottom: 12px;
}

.feature-label {
    font-weight: bold;
    color: #555;
    display: block;
    margin-bottom: 3px;
}

.feature-value {
    color: #333;
    font-size: 16px;
}

.property-notes {
    padding: 20px 0;
}

.section-title {
    font-size: 20px;
    color: #0056b3;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #eee;
}

.property-notes ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.property-notes li {
    position: relative;
    padding-left: 25px;
    margin-bottom: 14px;
    line-height: 1.6;
}

.property-notes li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #0056b3;
    font-weight: bold;
}

/* Footer and Contact Styles */
.footer {
    margin-top: 40px; /* Screen margin */
    border-top: 2px solid #0056b3;
    padding-top: 30px; /* Screen padding */
}

.contact-card {
    max-width: 500px;
    margin: 0 auto;
    padding: 25px 30px; /* Screen padding */
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08); /* Hidden for print */
    text-align: center;
}

.contact-name {
    font-size: 22px;
    font-weight: bold;
    color: #0056b3;
    margin-bottom: 8px;
}

.contact-title {
    font-style: italic;
    color: #495057;
    margin-bottom: 20px;
    font-size: 16px;
}

.contact-info {
    line-height: 2;
    color: #495057;
}

.contact-address {
    margin-bottom: 8px;
}

.contact-phone {
    letter-spacing: 0.3px;
    margin-bottom: 8px;
}

.contact-email a {
    color: #0056b3;
    text-decoration: none;
    font-weight: 500;
}

.contact-email a:hover {
    text-decoration: underline; /* Disabled for print */
}

.disclaimer {
    font-size: 12px;
    color: #777;
    text-align: center;
    margin-top: 30px; /* Screen margin */
    padding-top: 15px; /* Screen padding */
    border-top: 1px solid #ddd;
}

/* Image Modal - Hidden for Print */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
}

.modal-content { 
    margin: auto; 
    display: block; 
    max-width: 90%; 
    max-height: 90%; 
    position: absolute; 
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%); 
}

.close { 
    position: absolute; 
    top: 15px; 
    right: 35px; 
    color: #f1f1f1; 
    font-size: 40px; 
    font-weight: bold; 
    transition: 0.3s; 
    cursor: pointer; 
}

.close:hover { 
    color: #bbb; 
}

/* Home page styles */
.listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
    margin: 30px 0;
}

.listing-card {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    background-color: #fff;
}

.listing-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

.listing-image {
    height: 180px;
    background-size: cover;
    background-position: center;
}

.listing-details {
    padding: 15px;
}

.listing-title {
    color: #0056b3;
    font-size: 18px;
    margin-bottom: 8px;
    font-weight: bold;
}

.listing-location {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
}

.listing-price {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 12px;
}

.view-listing {
    display: inline-block;
    padding: 8px 16px;
    background-color: #0056b3;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    transition: background-color 0.3s;
}

.view-listing:hover {
    background-color: #003d7a;
}

.add-listing-instructions {
    background-color: #f8f9fa;
    border-left: 4px solid #0056b3;
    padding: 15px;
    margin: 30px 0;
    border-radius: 4px;
}

.add-listing-instructions code {
    background-color: #e9ecef;
    padding: 2px 5px;
    border-radius: 3px;
    font-family: monospace;
}

/* Responsive Design - Primarily for Screen */
@media (max-width: 768px) {
    .property-grid { grid-template-columns: 1fr 1fr; }
    .gallery-item { flex: 1 0 45%; }
    .stat-block { flex: 1 1 45%; min-width: 120px;}
    .listings-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

@media (max-width: 600px) {
    .property-grid { grid-template-columns: 1fr; }
    .gallery-item { flex: 1 0 100%; }
    .header h1 { font-size: 24px; }
    .property-name { font-size: 20px; }
    .stat-block { flex: 1 1 100%; min-width: unset;}
    .listings-grid { grid-template-columns: 1fr; }
    .site-nav a { margin: 0 8px; }
}

/* --- Print Specific Styles --- */
@media print {
    body {
        background-color: #fff;
        color: #000; /* Ensure high contrast */
        font-size: 10pt; /* Adjust base font size for print if needed */
    }

    @page {
        /* You can adjust margins specifically for print if needed */
        /* margin: 0.75in; */
    }

    .container {
        box-shadow: none;
        max-width: 100%;
        width: 100%;
        padding: 0;
        margin: 0;
        border: none;
    }

    /* Reduce space for Header and Image */
    .header {
        padding: 10px 0 8px; /* Reduced padding */
        margin-bottom: 10px; /* Reduced margin */
        border-bottom-width: 2px;
        text-align: center;
        /* Ensure it doesn't force break after unless needed */
        page-break-after: auto;
        break-after: auto;
    }

    .header h1 {
        font-size: 22pt; /* Adjust print size */
        color: #000; /* Black for print */
    }

    .header p, .tagline {
        font-size: 11pt; /* Adjust print size */
        margin-top: 4px;
        color: #333;
    }

    .tagline {
        font-size: 12pt;
        margin-top: 6px;
    }

    .site-nav {
        display: none; /* Hide navigation for print */
    }

    .main-image {
        /* height: 250px; */ /* Option: uncomment to slightly reduce height */
        margin-bottom: 10px; /* Reduced margin */
        box-shadow: none;
        border-radius: 0;
        /* Ensure it doesn't force break after unless needed */
        page-break-after: auto;
        break-after: auto;
        /* Prevent image itself breaking (unlikely but safe) */
        page-break-inside: avoid;
        break-inside: avoid;
    }

    /* General Content Block Control */
    .property-card,
    .gallery,
    .footer,
    .contact-card,
    .stat-block, /* Try to keep individual stat blocks together */
    .property-feature, /* Try to keep label/value together */
    .property-notes ul li /* Keep list items whole */
    {
        page-break-inside: avoid; /* Avoid breaking inside these elements */
        break-inside: avoid;
    }

    /* Encourage breaks *between* major sections if needed */
    .property-card,
    .gallery,
    .footer {
        page-break-before: auto; /* Allow breaks before these main sections */
        break-before: auto;
    }

    /* Layout Adjustments for Print */
    .property-card {
        box-shadow: none;
        border: 1px solid #ccc; /* Simple border for print */
        margin-bottom: 20px; /* Reduced margin */
    }

    .property-stats-grid {
        gap: 8px; /* Reduced gap */
        margin-bottom: 15px; /* Reduced margin */
    }

    .stat-block {
        padding: 8px; /* Reduced padding */
        box-shadow: none;
        border: 1px solid #eee; /* Light border */
        background-color: #fdfdfd;
        flex: 1 1 30%; /* Adjust flex basis for print layout */
        min-width: 140px;
    }

    .stat-value { font-size: 1.1em; }

    .property-grid {
        display: block; /* Stack features vertically for simplicity */
        padding: 10px 0;
        margin-bottom: 15px;
        border-top: 1px solid #ccc;
        border-bottom: 1px solid #ccc;
    }

    .property-feature {
        margin-bottom: 5px;
        padding: 3px 0;
        display: flex;
        justify-content: space-between;
        border-bottom: 1px dotted #eee;
    }

    .feature-label {
        font-weight: bold;
        flex: 0 0 40%;
        display: inline;
    }

    .feature-value {
        flex: 0 0 55%;
        display: inline;
    }

    /* Styling adjustments for a more compact print layout */
    .gallery-container {
        gap: 8px;
    }

    .gallery-item {
        flex: 1 0 31%;
        height: 120px; /* Reduced height for print */
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .contact-card {
        box-shadow: none;
        border: 1px solid #ccc;
        background-color: transparent;
        max-width: 100%;
        width: 100%;
        padding: 15px;
    }

    .footer {
        margin-top: 20px;
        padding-top: 15px;
    }

    /* Hide elements not needed for print */
    .modal, .close, .view-listing, .listings-grid, .add-listing-instructions {
        display: none;
    }
}
