/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
}

body {
    display: flex;
    flex-direction: column;
    background-color: #f5f5f5;
}

/* Header and Navigation */
header {
    background: linear-gradient(135deg, #3a3a3a 0%, #555555 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 1rem 2rem;
}

.logo {
    max-height: 60px;
    width: auto;
    display: block;
    margin-bottom: 0.5rem;
}

nav {
    margin-top: 1rem;
}

nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

nav ul li a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    font-size: 0.95rem;
    font-weight: 500;
}

nav ul li a:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

nav ul li a:active {
    background-color: rgba(255, 255, 255, 0.3);
}

nav ul li.admin-link {
    margin-left: auto;
}

nav ul li.admin-link a {
    background-color: rgba(255, 255, 255, 0.15);
    font-weight: 700;
}

nav ul li.admin-link a:hover {
    background-color: rgba(255, 255, 255, 0.25);
}

/* Main Content */
main {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.page-title {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #333;
}

/* Property Grid */
.property-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Property Card */
.property-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
}

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

/* Property Card Link */
.property-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.property-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

.property-info {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.open-house-alert {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.open-house-time {
    font-size: 0.9rem;
    font-weight: 700;
    margin-top: 0.25rem;
    letter-spacing: 0.5px;
}

.property-price {
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.property-address {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.property-location {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
}

.property-details {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.detail-icon {
    font-weight: bold;
    color: #667eea;
}

.property-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.agent-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #667eea;
}

.agent-info {
    flex: 1;
}

.agent-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
}

.office-name {
    font-size: 0.75rem;
    color: #666;
}

.office-logo {
    max-height: 30px;
    width: auto;
}

/* Property Details Page */
.property-office-logo
{
    height: auto;
    max-width: 150px;
    margin-bottom: 1rem;
}

.property-agent-avatar
{
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #667eea;
    margin-bottom: 1rem;
}

.property-page-image
{
    width: 150px;
    height: auto;
    margin: 5px;
    display: inline-block;
}

.property-detail-page {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.property-hero {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.property-gallery {
    display: grid;
    gap: 1rem;
    width: 100%;
}

.gallery-main {
    position: relative;
    width: 100%;
    height: 550px;
    background: #f5f5f5;
    border-radius: 8px;
    overflow: hidden;

    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    transition: opacity 0.2s ease;
}

/* NAV BUTTONS */
.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);

    width: 48px;
    height: 48px;

    border: none;
    border-radius: 50%;

    background: rgba(0,0,0,0.55);
    color: #fff;

    font-size: 28px;
    cursor: pointer;

    z-index: 5;
    transition: background 0.2s ease;
}

.gallery-nav:hover {
    background: rgba(0,0,0,0.8);
}

.gallery-prev {
    left: 15px;
}

.gallery-next {
    right: 15px;
}

.gallery-thumbs {
    display: block;
    gap: 10px;
    margin-top: 15px;

    overflow-x: auto;
    padding-bottom: 5px;
}

.gallery-thumb {
    width: 100px;
    height: 75px;

    object-fit: cover;

    border-radius: 6px;
    cursor: pointer;

    opacity: 0.7;
    border: 3px solid transparent;

    transition: all 0.2s ease;
}

.gallery-thumb:hover {
    opacity: 1;
}

.gallery-thumb img {
    width: 100px;
    height: auto;
    object-fit: cover;
    display: block;
}

.gallery-thumb.active {
    opacity: 1;
    border-color: #0073aa;
}

.gallery-empty {
    min-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    background: #fafafa;
    border: 1px dashed #ccc;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
}

.property-info-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.property-title {
    font-size: 2rem;
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.property-location,
.property-subtitle {
    color: #555;
    margin-bottom: 0.75rem;
}

.property-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.property-metric {
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    padding: 1rem;
}

.property-metric strong {
    display: block;
    margin-bottom: 0.25rem;
    color: #333;
}
.property-price {
    font-size: 1.75rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 0rem;
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    padding: 1rem;
}

.property-price-list {
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.property-map-container {
    border-radius: 16px;
    overflow: hidden;
    background: #f7f7f7;
    border: 1px solid #e6e6e6;
    min-height: 320px;
}

.property-map {
    width: 100%;
    height: 320px;
    border: 0;
}

.property-map-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    color: #666;
    padding: 1.5rem;
    text-align: center;
    background: #fafafa;
}

.property-details-section {
    display: grid;
    gap: 1.5rem;
}

.property-remarks {
    background: #fff;
    border: 1px solid #e9e9e9;
    border-radius: 16px;
    padding: 1.5rem;
    line-height: 1.7;
    white-space: pre-wrap;
}

.property-meta {
    display: grid;
    gap: 0.75rem;
    background: #fff;
    border: 1px solid #e9e9e9;
    border-radius: 16px;
    padding: 1.25rem;
}

.property-meta p {
    color: #444;
}

.open-house-alert {
    background: #fff3f3;
    border: 1px solid #f5c2c2;
    border-radius: 14px;
    padding: 1rem;
    margin: 1rem 0;
    color: #7f1d1d;
}

.open-house-alert strong {
    display: block;
    margin-bottom: 0.35rem;
}

.open-house-time {
    font-weight: 700;
}

.open-house-count {
    margin-top: 0.35rem;
    color: #581818;
}

.property-template-details {
    display: grid;
    gap: 1.25rem;
}

.property-template-details p {
    margin: 0;
    color: #444;
    line-height: 1.6;
}

.property-template-group {
    background: #fff;
    border: 1px solid #e9e9e9;
    border-radius: 16px;
    padding: 1.5rem;
}

.property-template-group h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: #333;
}

.property-template-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f4f4f4;
}

.property-template-row:last-child {
    border-bottom: 0;
}

.property-template-label {
    color: #555;
    font-weight: 600;
}

.property-template-value {
    text-align: right;
    color: #333;
}

.property-template-list-block {
    margin-top: 1rem;
}

.property-template-list-block strong {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
}

.property-template-list-block ul li {
    margin-left: 20px;
}

.property-template-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
    display: grid;
    gap: 0.5rem;
}

.property-template-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid #f4f4f4;
}

.property-template-list li:last-child {
    border-bottom: 0;
}

.property-template-list-block strong {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
}

.property-agent-block {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: #fff;
    border: 1px solid #e9e9e9;
    border-radius: 16px;
    padding: 1rem;
}

.property-agent-avatar {
    width: 70px;
    height: 70px;
    margin-bottom: 0;
}

.agent-meta {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.agent-meta strong {
    font-size: 1rem;
}

@media (max-width: 1024px) {
    .property-hero {
        grid-template-columns: 1fr;
    }

    .property-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .property-hero {
        gap: 1.25rem;
    }

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

    .property-map {
        height: 260px;
    }

    .gallery-main {
        height: 350px;
    }

    .gallery-thumb {
        width: 80px;
        height: 60px;
    }

    .gallery-nav {
        width: 40px;
        height: 40px;
        font-size: 22px;
    }
}

/* No Results Message */
.no-results {
    text-align: center;
    padding: 3rem 2rem;
    color: #666;
    font-size: 1.1rem;
}

/* Responsive Design */
/* Tablet: 2 columns */
@media (max-width: 1024px) {
    .property-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    main {
        padding: 1.5rem;
    }

    nav ul {
        gap: 0.25rem;
    }

    nav ul li a {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
}

/* Mobile: 1 column */
@media (max-width: 768px) {
    .property-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    main {
        padding: 1rem;
    }

    .page-title {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }

    header {
        padding: 1rem;
    }

    .logo {
        max-height: 50px;
    }

    nav ul {
        flex-direction: column;
    }

    nav ul li {
        width: 100%;
    }

    nav ul li a {
        width: 100%;
        display: block;
        text-align: center;
    }

    .property-card {
        border-radius: 4px;
    }

    .property-image {
        height: 200px;
    }

    .property-info {
        padding: 1rem;
    }

    .property-details {
        font-size: 0.8rem;
    }
}

/* Small Mobile: Extra small screens */
@media (max-width: 480px) {
    header {
        padding: 0.75rem;
    }

    .logo {
        max-height: 45px;
    }

    main {
        padding: 0.75rem;
    }

    .page-title {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }

    nav ul li a {
        padding: 0.35rem 0.6rem;
        font-size: 0.75rem;
    }

    .property-info {
        padding: 0.75rem;
    }

    .property-price {
        font-size: 1.25rem;
    }

    .property-address {
        font-size: 0.9rem;
    }
}

/* Search Filters */
.search-filters {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.filter-title {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.filter-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.basic-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    align-items: flex-end;
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
}

.filter-group input,
.filter-group select {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-group input::placeholder {
    color: #999;
}

/* Advanced Filters Toggle */
.filter-toggle {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

.toggle-advanced-btn {
    background: none;
    border: none;
    color: #667eea;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.toggle-advanced-btn:hover {
    background: rgba(102, 126, 234, 0.05);
}

.toggle-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}

.toggle-advanced-btn.active .toggle-icon {
    transform: rotate(0);
}

/* Advanced Filters Section */
.advanced-filters {
    animation: slideDown 0.3s ease;
    border-top: 1px solid #e0e0e0;
    padding-top: 1.5rem;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}

.filter-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: flex-start;
    margin-top: 1rem;
}

.btn-search,
.btn-reset {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-search {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-search:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-search:active {
    transform: translateY(0);
}

.btn-reset {
    background: #e0e0e0;
    color: #333;
}

.btn-reset:hover {
    background: #d0d0d0;
}

.results-header {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.results-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.results-count {
    font-size: 1rem;
    color: #666;
    font-weight: 500;
}

.results-pages {
    font-size: 0.9rem;
    color: #999;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 0.65rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.pagination-btn:hover:not(.disabled) {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination-btn.disabled {
    color: #ccc;
    border-color: #e0e0e0;
    cursor: not-allowed;
}

.pagination-numbers {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.page-number {
    min-width: 36px;
    padding: 0.5rem;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.page-number:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.page-number.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
    cursor: default;
}

.pagination-dots {
    color: #999;
    font-weight: 600;
    padding: 0 0.25rem;
}

/* Responsive Design for Filters */
@media (max-width: 1024px) {
    .search-filters {
        padding: 1.5rem;
    }

    .basic-filters,
    .filter-row {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }

    .filter-buttons {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .search-filters {
        padding: 1rem;
    }

    .filter-title {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }

    .basic-filters,
    .filter-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .filter-buttons {
        grid-column: auto;
        flex-direction: column;
        width: 100%;
    }

    .btn-search,
    .btn-reset {
        width: 100%;
    }

    .toggle-advanced-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Agency Directory */
.agency-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.agency-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

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

.agency-logo-container {
    background: #f9f9f9;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    border-bottom: 1px solid #e0e0e0;
}

.agency-logo {
    max-height: 100px;
    max-width: 100%;
    width: auto;
    object-fit: contain;
}

.agency-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.agency-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.agency-info {
    flex: 1;
    margin-bottom: 1.5rem;
}

.agency-address {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.agency-phone {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.75rem;
}

.agency-property-count {
    font-size: 1rem;
    color: #667eea;
    font-weight: 600;
    margin-top: 1rem;
}

.btn-view-properties {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    align-self: flex-start;
}

.btn-view-properties:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-view-properties:active {
    transform: translateY(0);
}

/* Responsive Design for Agencies */
@media (max-width: 1024px) {
    .agency-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .agency-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .agency-card {
        border-radius: 4px;
    }

    .agency-name {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }

    .agency-content {
        padding: 1rem;
    }
}

/* Footer */
footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: auto;
}
