:root {
    --bg-color: #0f172a;
    --bg-gradient-start: #0f172a;
    --bg-gradient-end: #1e293b;
    --card-bg: rgba(30, 41, 59, 0.6);
    --card-border: rgba(148, 163, 184, 0.1);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    --accent-hover: #2563eb;
    --error-color: #ef4444;
    --warning-color: #eab308;
    --border-color: #334155;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --header-height: 70px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(236, 72, 153, 0.08), transparent 25%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
}

.app-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--card-border);
    background-color: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
    height: auto;
    min-height: var(--header-height);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Logo class is no longer used in header, but we can keep it or remove it. 
   The new title uses .main-title */

.nav-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 2rem; /* Pill shape */
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.home-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 999px;
    justify-content: center;
    font-size: 1.05rem;
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(148, 163, 184, 0.18);
}

.home-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

/* New class for the enhanced saved list button */
.primary-nav-btn {
    background: var(--accent-gradient);
    border: none;
    padding: 0.75rem 1.4rem;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 3rem; /* Pill shape */
    box-shadow: 0 8px 20px -4px rgba(59, 130, 246, 0.5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
    overflow: hidden;
}

/* Shine effect */
.primary-nav-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: 0.5s;
}

.primary-nav-btn:hover::before {
    left: 100%;
}

.primary-nav-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px -5px rgba(59, 130, 246, 0.6);
    filter: brightness(1.1);
    border-color: transparent;
}

.primary-nav-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px -3px rgba(59, 130, 246, 0.5);
}

#saved-count {
    background: white;
    color: var(--accent-color);
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    font-weight: 800;
    margin-left: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    min-width: 2rem;
    text-align: center;
}

#main-content {
    flex: 1;
    padding: 2rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.view {
    display: none;
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dashboard */
.hero {
    text-align: center;
    margin-bottom: 3rem;
    padding: 3rem 1rem;
    position: relative;
}

/* Replaced .hero h1 with .main-title */
.main-title {
    font-size: clamp(2rem, 4vw, 3rem); /* Smaller than previous 4rem */
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(to bottom right, #fff 30%, #94a3b8 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.1;
    cursor: pointer;
    display: inline-block;
    transition: opacity 0.2s;
}

.main-title:hover {
    opacity: 0.9;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.tool-card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 1.5rem;
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.tool-card:hover {
    transform: translateY(-5px);
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
}

.tool-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
}

.tool-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.tool-card p {
    color: var(--text-secondary);
}

/* Tool View */
.tool-header {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Center the title specifically on the Property Search view */
#property-search .tool-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    justify-content: initial;
    flex-wrap: initial;
}

#property-search .tool-header h2 {
    grid-column: 2;
    justify-self: center;
    margin: 0;
    text-align: center;
}

#property-search #back-btn-property-search {
    grid-column: 1;
    justify-self: start;
}

@media (max-width: 520px) {
    #property-search .tool-header {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        row-gap: 0.75rem;
        column-gap: 0;
    }

    #property-search #back-btn-property-search {
        grid-column: 1;
        grid-row: 1;
        justify-self: start;
    }

    #property-search .tool-header h2 {
        grid-column: 1;
        grid-row: 2;
        justify-self: center;
        width: 100%;
        text-align: center;
    }
}

.back-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 0.75rem;
    transition: all 0.2s;
}

.back-btn:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.1);
}

.search-container {
    max-width: 600px;
    margin: 0 auto 3rem;
}

.input-group {
    display: flex;
    gap: 0.75rem;
    background: rgba(30, 41, 59, 0.8);
    padding: 0.5rem;
    border-radius: 1rem;
    border: 1px solid var(--card-border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

#address-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 1rem;
    width: 100%;
}

#address-input:focus {
    outline: none;
}

#search-btn {
    padding: 0.75rem 1.5rem;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

#search-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* Results */
.results-container {
    display: grid;
    gap: 1.5rem;
}

.result-card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: transform 0.2s;
    position: relative;
}

.result-card h4 {
    color: var(--accent-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--card-border);
}

.result-row:last-child {
    border-bottom: none;
}

.label {
    color: var(--text-secondary);
    font-weight: 500;
    flex: 1;
}

.value-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 2;
    justify-content: flex-end;
}

.value {
    font-weight: 600;
    text-align: right;
    word-break: break-word;
}

.result-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.result-link:hover {
    border-color: var(--accent-color);
}

.copy-icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.4rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.copy-icon-btn:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.1);
}

/* Utility classes for JS generated content */
.card-error {
    border-color: var(--error-color) !important;
    background-color: rgba(239, 68, 68, 0.05) !important;
}

.text-error {
    color: var(--error-color) !important;
}

.card-action-top-right {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

.save-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--accent-color);
    font-size: 0.9rem;
    background: rgba(59, 130, 246, 0.1);
    padding: 0.4rem 0.8rem;
    border-radius: 2rem;
    transition: background 0.2s;
}

.save-checkbox-label:hover {
    background: rgba(59, 130, 246, 0.2);
}

/* Loading */
#loading-indicator {
    text-align: center;
    padding: 3rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(59, 130, 246, 0.1);
    border-top: 3px solid var(--accent-color);
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

.app-footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--card-border);
    margin-top: auto;
    font-size: 0.9rem;
}

/* Split Lot Styling */
.split-lot-group {
    border: 1px solid var(--warning-color);
    background-color: rgba(234, 179, 8, 0.05);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.split-lot-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--warning-color);
    font-weight: 700;
    font-size: 1.1rem;
}

.split-lot-header svg {
    width: 1.5rem;
    height: 1.5rem;
}

/* Mobile Responsive Adjustments */
@media (max-width: 640px) {
    .header-content {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: space-between;
        gap: 0.75rem;
        padding: 0.25rem 0;
    }

    .home-btn {
        order: 1;
        width: 56px;
        height: 56px;
        font-size: 1.2rem;
    }

    .primary-nav-btn {
        order: 2;
        width: auto;
        padding: 0.85rem 1.15rem;
        font-size: 1rem;
        border-radius: 999px;
        margin-left: auto;
    }

    .result-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .value-wrapper {
        width: 100%;
        justify-content: flex-start;
    }
    
    .value {
        text-align: left;
    }

    .input-group {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
    }

    #search-btn {
        width: 100%;
    }
    
    .card-action-top-right {
        position: static;
        margin-bottom: 1rem;
        display: flex;
        justify-content: flex-end;
    }

    .tool-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
