/* Global box sizing for predictable layout */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Prevent horizontal scrolling on mobile */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: #f5f5f5;
    font-family: Arial, sans-serif;
    padding: 24px 16px 48px 16px;
}

h1 {
    margin-bottom: 12px;
    font-size: 3rem;
    color: #222f3e;
    font-family: 'Times New Roman', Times, serif;
    background: linear-gradient(180deg, #3b82f6 0%, #10b981 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 2px 4px 12px rgba(40,40,40,0.13);
    position: relative;
}

.page-note {
    margin-top: 4px;
    text-align: center;
}

.search-bar {
    width: 100%;
    max-width: 500px;
    padding: 14px 18px;
    border: 1px solid #d1d8e0;
    border-radius: 8px;
    font-size: 1.1rem;
    outline: none;
    transition: border 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}

.search-bar:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.top-menu {
    width: 100%;
    max-width: 700px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 16px 16px 16px;
    background: transparent;
    position: relative;
    margin: 0 auto;
}

.site-logo {
    text-decoration: none;
    padding: 8px 20px;
    border-radius: 6px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
}

.logo-image {
    height: 48px;
    width: auto;
    max-width: 144px;
    background: transparent;
}

.site-logo:hover {
    background: rgba(59,130,246,0.08);
    color: #3b82f6;
}

.top-links {
    display: flex;
    align-items: center;
    gap: 8px 12px;
}

/* Mobile menu toggle button */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background: #222f3e;
    border-radius: 3px;
    transition: all 0.3s linear;
    position: relative;
    transform-origin: 1px;
}

.menu-toggle.open span:first-child {
    transform: rotate(45deg);
}

.menu-toggle.open span:nth-child(2) {
    opacity: 0;
    transform: translateX(20px);
}

.menu-toggle.open span:nth-child(3) {
    transform: rotate(-45deg);
}

/* Scope link styling to top-links so the logo is not affected */
.top-links a {
    text-decoration: none;
    color: #222f3e;
    font-size: 1.2rem;
    font-family: Arial, sans-serif;
    padding: 8px 20px;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
}

.top-links a:hover {
    background: rgba(16,185,129,0.08);
    color: #10b981;
}

.search-form {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-btn {
    padding: 12px 16px;
    background: linear-gradient(135deg, #3b82f6 0%, #10b981 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(59,130,246,0.25);
    transition: all 0.3s ease;
    font-weight: 600;
}

.search-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #059669 100%);
    box-shadow: 0 6px 16px rgba(59,130,246,0.35);
    transform: translateY(-1px);
}

.search-btn:active {
    transform: translateY(1px);
}

.estimate-result {
    margin-top: 18px;
    font-size: 1.05rem;
    color: #222f3e;
    text-align: center;
}

.home-value-card {
    width: 100%;
    max-width: 500px;
    margin-top: 20px;
    padding: 16px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    border-top: 3px solid #3b82f6;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.updated-value-card {
    width: 100%;
    max-width: 500px;
    margin-top: 8px;
    padding: 16px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    border-top: 3px solid #10b981;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.value-cards {
    width: 100%;
    max-width: 700px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: stretch;
}

.value-cards .home-value-card,
.value-cards .updated-value-card {
    margin-top: 0;
    margin-bottom: 0;
    height: 100%;
}

.updated-value-card label {
    font-size: 0.95rem;
    color: #4a5568;
    font-weight: 700;
    text-align: center;
    display: block;
}

.label-subtitle {
    font-weight: 500;
    color: #64748b;
    margin-left: 6px;
}

.updated-value-display {
    padding: 12px 14px;
    border: 1px dashed #d1d8e0;
    border-radius: 8px;
    font-size: 1.1rem;
    color: #1f2937;
    background: #f9fafb;
    text-align: center;
}

.property-details {
    width: 100%;
    max-width: 700px;
    margin-top: 8px;
}

.property-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.property-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    border-left: 3px solid #3b82f6;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.3s ease;
}

.property-card:hover {
    border-left-color: #2563eb;
    box-shadow: 0 6px 20px rgba(59,130,246,0.12);
}

.property-card label {
    font-size: 0.95rem;
    color: #4a5568;
    font-weight: 700;
}

.property-card input {
    padding: 12px 14px;
    border: 1px solid #d1d8e0;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border 0.2s, box-shadow 0.2s;
}

.property-card input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.home-value-card label {
    font-size: 0.95rem;
    color: #4a5568;
    font-weight: 700;
    text-align: center;
    display: block;
}

.home-value-input {
    padding: 12px 14px;
    border: 1px solid #d1d8e0;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border 0.2s, box-shadow 0.2s;
}

.home-value-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.renovations-section {
    width: 100%;
    max-width: 700px;
    margin-top: 28px;
    margin-bottom: 64px;
}

.renovations-section h2 {
    margin: 0 0 8px 0;
    font-size: 1.6rem;
    color: #3b82f6;
    font-family: 'Times New Roman', Times, serif;
    font-weight: 600;
    text-align: center;
}

.renovation-disclaimer {
    margin: 0 0 16px 0;
    font-size: 0.9rem;
    color: #6b7280;
    font-style: italic;
    text-align: center;
    line-height: 1.4;
}

.renovations-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.renovation-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    border-left: 3px solid #10b981;
    padding: 16px;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.renovation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.renovation-header:active {
    transform: scale(0.98);
}

.renovation-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 0;
    opacity: 0;
    transform: translateY(-10px);
}

.renovation-card:not(.collapsed) .renovation-content {
    opacity: 1;
    transform: translateY(0);
}

.renovation-card:hover {
    border-left-color: #059669;
    box-shadow: 0 6px 20px rgba(16,185,129,0.12);
}

.renovation-toggle {
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: rotate(0deg);
}

.renovation-toggle:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.renovation-card:not(.collapsed) .renovation-toggle {
    transform: rotate(180deg);
}

.renovation-toggle:active {
    transform: scale(0.95);
}

.renovation-title {
    font-weight: 600;
    color: #1f2937;
}

.renovation-title::after {
    content: " (Original)";
    font-size: 0.85em;
    color: #6b7280;
    font-weight: 400;
}

.renovation-card:not(.collapsed) .renovation-title::after {
    content: " (Renovated)";
    color: #10b981;
    font-weight: 500;
}

/* Loading Spinner Styles */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    margin-top: 15px;
}

.spinner-circle {
    width: 40px;
    height: 40px;
    border: 4px solid #e0e7ef;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

.spinner-text {
    color: #6b7280;
    font-size: 0.9rem;
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.renovation-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.renovation-field label {
    font-size: 0.9rem;
    color: #4a5568;
    font-weight: 700;
}

.renovation-field input,
.renovation-field select {
    padding: 10px 12px;
    border: 1px solid #d1d8e0;
    border-radius: 8px;
    font-size: 0.98rem;
    outline: none;
    transition: border 0.2s, box-shadow 0.2s;
}

.renovation-field input:focus,
.renovation-field select:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16,185,129,0.1);
}

.assumption-note {
    font-size: 0.8rem;
    color: #888;
    font-weight: 400;
    font-style: italic;
}

.site-footer {
    width: 100%;
    text-align: center;
    margin-top: 40px;
    color: #64748b;
    font-size: 0.9rem;
}

.update-actions {
    width: 100%;
    max-width: 700px;
    display: flex;
    justify-content: center;
    margin: 20px auto 0 auto;
}

.share-actions {
    width: 100%;
    max-width: 700px;
    display: flex;
    justify-content: center;
    margin: 16px auto 32px auto;
}

.share-btn {
    padding: 10px 16px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16,185,129,0.25);
    transition: all 0.3s ease;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.share-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 6px 16px rgba(16,185,129,0.35);
    transform: translateY(-1px);
}

.share-btn:active {
    transform: translateY(1px);
}

.footer-links {
    margin-bottom: 14px;
}

.footer-links a {
    color: #64748b;
    text-decoration: none;
    margin: 0 8px;
    transition: color 0.2s, text-decoration-color 0.2s;
}

.footer-links a:hover {
    color: #3b82f6;
    text-decoration: underline;
}

.footer-links .dot {
    color: #cbd5e1;
}

/* Remove number input spinners for a cleaner numeric entry */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    h1 {
        font-size: 2.2rem;
        margin-bottom: 8px;
        text-align: center;
    }

    .top-menu {
        padding: 12px 16px 8px 16px;
        flex-wrap: nowrap;
        max-width: none;
    }

    .menu-toggle {
        display: flex;
    }

    .top-links {
        position: fixed;
        left: -100%;
        top: 0;
        flex-direction: column;
        background-color: #ffffff;
        width: 100%;
        height: 100vh;
        text-align: center;
        transition: left 0.3s ease;
        box-shadow: 0 4px 16px rgba(0,0,0,0.15);
        padding-top: 80px;
        z-index: 5;
    }

    .top-links.open {
        left: 0;
    }

    .top-links a {
        font-size: 1.2rem;
        padding: 16px 24px;
        margin: 8px 0;
        border-radius: 8px;
        display: block;
        width: 80%;
        margin-left: auto;
        margin-right: auto;
    }

    .top-links a:hover {
        background: rgba(59,130,246,0.06);
        color: #3b82f6;
    }

    .search-bar {
        max-width: none;
    }

    .search-form {
        max-width: none;
    }
    .home-value-card, .renovations-section { max-width: none; }
    .renovations-grid { grid-template-columns: 1fr; }
    .property-details { max-width: none; }
    .property-grid { grid-template-columns: 1fr; }
    .value-cards { 
        grid-template-columns: 1fr; 
        max-width: none; 
    }
    
    .value-cards .home-value-card,
    .value-cards .updated-value-card {
        width: 100%;
        max-width: none;
    }
}

@media (max-width: 600px) {
    .top-links a {
        font-size: 1.1rem;
        padding: 14px 20px;
    }
}

/* Generic content container for standalone pages */
.content-container {
    width: 100%;
    max-width: 800px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    border-top: 4px solid #3b82f6;
    padding: 20px 18px;
}

.content-container h2 {
    margin-top: 0;
}

.content-container p {
    color: #1e3a5f;
    line-height: 1.6;
}

.content-container p strong {
    color: #3b82f6;
    font-weight: 700;
}
