/* MIDNIGHT GLASSMORPHISM THEME - MAIN STYLES */
:root {
    /* Color Palette - Midnight Institutional */
    --bg-deep: #02040a;
    /* Deepest Navy */
    --bg-glass: rgba(15, 23, 42, 0.6);
    /* Slate 900 @ 60% */
    --bg-glass-hover: rgba(15, 23, 42, 0.8);

    --primary: #6366f1;
    /* Indigo 500 */
    --primary-glow: rgba(99, 102, 241, 0.4);
    --secondary: #8b5cf6;
    /* Violet 500 */

    --accent-success: #10b981;
    /* Emerald */
    --accent-warning: #f59e0b;
    /* Amber */
    --accent-error: #ef4444;
    /* Red */

    --text-main: #ffffff;
    --text-secondary: #94a3b8;
    /* Slate 400 */
    --text-tertiary: #64748b;
    /* Slate 500 */

    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glass-highlight: rgba(255, 255, 255, 0.15);

    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;

    --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--text-tertiary) transparent;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-deep);
    /* Subtle Ambient Gradient Background */
    background-image:
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 40%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* --- UTILITIES --- */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* --- HEADER --- */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    margin-bottom: 3rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-logo {
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.brand-text h1 {
    font-size: 1.4rem;
    color: var(--text-main);
}

.brand-text p {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

/* --- TABS & WIZARD --- */
.tab-nav {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-glass);
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tab-btn.active {
    color: var(--primary);
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.2);
}

.tab-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.tab-pane.active {
    display: block;
}

/* Override existing Phase Container logic inside Tabs */
.phase-container.active-override {
    display: block !important;
}

/* Phase Container Logic (Legacy / Inner) */
.phase-container {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.phase-container.active {
    display: block;
}

/* --- GLASS PANELS --- */
/* The core glassmorphism container */
.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: border-color 0.3s ease;
}

.glass-panel:hover {
    border-color: var(--border-glass-highlight);
}

/* --- FORMS & INPUTS --- */
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

textarea,
input[type="text"] {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.95rem;
    padding: 1rem;
    outline: none;
    transition: all 0.2s;
}

textarea:focus {
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 0 1px var(--primary-glow);
}

/* --- BUTTONS --- */
.btn {
    font-family: var(--font-body);
    font-weight: 600;
    padding: 0.8rem 1.75rem;
    border-radius: 100px;
    /* Pill shape */
    cursor: pointer;
    border: none;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px var(--primary-glow);
    filter: brightness(1.1);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* --- CHIPS --- */
.template-chip {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    padding: 0.5rem 1rem;
    border-radius: 100px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.template-chip:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border-color: var(--border-glass-highlight);
}

/* --- DASHBOARD METRICS --- */
.stats-dashboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

/* --- MISSION LOG (Notification Center Style) --- */
.mission-log-container {
    background: rgba(2, 4, 10, 0.4);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 2rem;
    height: 250px;
    overflow-y: auto;
}

.mission-log-header {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 0.5rem;
}

.log-entry {
    font-family: var(--font-body);
    /* No mono */
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.02);
}

.log-entry.status {
    color: var(--text-secondary);
}

.log-entry::before {
    content: '•';
    color: var(--text-tertiary);
    font-size: 1.2rem;
    line-height: 0;
}

.log-entry.success::before {
    color: var(--accent-success);
}

.log-entry.error::before {
    color: var(--accent-error);
}

/* --- WIDE PROPERTY CARDS (The Main Event) --- */
.property-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    display: grid;
    grid-template-columns: 280px 1fr;
    /* Image | Content */
    overflow: hidden;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.property-card:hover {
    transform: translateY(-2px);
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

.property-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-right: 1px solid var(--border-glass);
}

.card-content {
    padding: 1.5rem 2rem;
    position: relative;
}

/* Header Section */
.prop-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.prop-titles h3 {
    font-size: 1.25rem;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.prop-titles p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Badges & Scores */
.score-badge {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: #e0e7ff;
    padding: 0.4rem 0.8rem;
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.red-flag-badge {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 0.2rem 0.6rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Metrics Grid - Wealth Mgmt Style */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1.5rem;
    padding: 1.25rem 0;
    border-top: 1px solid var(--border-glass);
    border-bottom: 1px solid var(--border-glass);
    margin: 1rem 0 1.5rem 0;
}

.metric-item {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.metric-value {
    font-size: 1.1rem;
    color: var(--text-main);
    font-weight: 600;
}

.metric-sub {
    font-size: 0.75rem;
    color: var(--accent-success);
}

/* Broker's Note */
.insight-box {
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    padding: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-left: 3px solid var(--primary);
}

.insight-box strong {
    color: var(--primary);
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.action-row {
    margin-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Responsive */
@media (max-width: 900px) {
    .property-card {
        grid-template-columns: 1fr;
    }

    .property-image {
        height: 250px;
        border-right: none;
        border-bottom: 1px solid var(--border-glass);
    }

    .stats-dashboard {
        grid-template-columns: 1fr;
    }
}

/* --- EDITABLE TEXT (Rich Text Feel) --- */
.editable-text {
    width: 100%;
    min-height: 200px;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: inherit;
    line-height: 1.6;
    outline: none;
    transition: all 0.3s ease;
    white-space: pre-wrap;
    /* Preserve newlines */
}

.editable-text:focus {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.1);
}

.editable-text strong {
    color: var(--primary);
    font-weight: 700;
}

.editable-text em {
    color: var(--text-tertiary);
    font-style: italic;
}

/* --- STEP TRACKER (kept) --- */
.step-tracker {
    display: flex;
    margin-bottom: 2rem;
    gap: 1rem;
    align-items: center;
}

.step {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
}

.step.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border-color: rgba(99, 102, 241, 0.3);
}

.step.connected {
    color: var(--accent-success);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 2rem 2rem 0 2rem;
}

.close-sidebar {
    padding: 0.5rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- UTILITY CLASSES REFACTORED --- */
.header-sub {
    font-size: 0.9rem;
    color: var(--text-tertiary);
}

.log-status {
    font-size: 0.7rem;
    opacity: 0.7;
    letter-spacing: 0.05em;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
    opacity: 0.5;
}

.alert {
    padding: 1rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    display: none;
    /* Hidden by default */
}

.alert.active {
    display: block;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.input-wrapper textarea {
    min-height: 150px;
    resize: vertical;
}

/* --- JS HELPER classes --- */
.suburb-header {
    margin-top: 3rem;
    font-size: 1.5rem;
    color: var(--text-main);
    margin-bottom: 1.5rem;
}

.card-visual-wrapper {
    position: relative;
    height: 100%;
}

.save-btn-overlay {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 10;
}

.red-flag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.score-badge-wrapper {
    text-align: right;
}

/* --- LOADING OVERLAY --- */
.loading-container {
    position: fixed;
    inset: 0;
    background: rgba(2, 4, 10, 0.9);
    z-index: 2000;
    display: none;
    /* Hidden by default */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

.loading-container.active {
    display: flex;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1.5rem;
}

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

    100% {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.loading-subtext {
    font-size: 0.9rem;
    color: var(--text-tertiary);
}

/* --- SHORTLIST ITEMS --- */
.shortlist-item {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    position: relative;
    border: 1px solid transparent;
}

.shortlist-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-glass-highlight);
}

.shortlist-remove {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 24px;
    height: 24px;
    font-size: 1.2rem;
    line-height: 1;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shortlist-remove:hover {
    color: var(--accent-error);
}

.shortlist-title {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    font-weight: 600;
    color: var(--text-main);
    padding-right: 1.5rem;
    /* Space for remove btn */
}

.shortlist-address {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.shortlist-price {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
    margin-top: 0.25rem;
}

/* --- SUBURB CHIPS --- */
.suburb-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 40px;
    /* Ensure space is reserved */
}

.suburb-chip {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: 100px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.suburb-chip:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary);
}

.suburb-chip .remove {
    font-size: 1.1rem;
    line-height: 1;
    opacity: 0.6;
}

.suburb-chip .remove:hover {
    opacity: 1;
    color: var(--accent-error);
}