/* ==========================================================================
   Gaff Tracker - Dave & Claude's Irish Property Intelligence
   ========================================================================== */

/* Irish-inspired color palette */
:root {
    --gaff-green: #169B62;
    --gaff-orange: #FF883E;
    --gaff-white: #FFFFFF;
    --gaff-gold: #FFD700;
    --gaff-dark: #1a1a2e;
}

/* Brand Logo */
.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none !important;
    color: inherit !important;
}

.brand-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 2px 4px rgba(22, 155, 98, 0.3));
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--gaff-green) 0%, #20c77a 50%, var(--gaff-orange) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="dark"] .brand-name {
    background: linear-gradient(135deg, #2ecc71 0%, #58d68d 50%, var(--gaff-orange) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Nav styling */
nav {
    border-bottom: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--gaff-green), var(--gaff-white), var(--gaff-orange)) 1;
}

/* Active nav link */
nav a.active {
    color: var(--gaff-green);
    font-weight: 600;
}

/* Loading indicator */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: block;
}

.htmx-request.htmx-indicator {
    display: block;
}

/* Page title styling */
h1 {
    color: var(--gaff-green);
    margin-bottom: 1.5rem;
}

h1::first-letter {
    color: var(--gaff-orange);
}

/* BER Rating colors */
.ber-A { color: #00A651; font-weight: bold; }
.ber-B { color: #8DC63F; font-weight: bold; }
.ber-C { color: #FFF200; font-weight: bold; background: #333; padding: 0 4px; border-radius: 3px; }
.ber-D { color: #FCAF17; font-weight: bold; }
.ber-E { color: #F15A29; font-weight: bold; }
.ber-F { color: #ED1C24; font-weight: bold; }
.ber-G { color: #ED1C24; font-weight: bold; }

/* Price difference colors */
.price-positive { color: #00A651; }
.price-negative { color: #ED1C24; }

/* Property card */
.property-card {
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

.property-card:hover {
    border-color: var(--pico-primary);
}

/* Search results table */
.results-table {
    font-size: 0.9rem;
}

.results-table th {
    cursor: pointer;
}

.results-table th:hover {
    background: var(--pico-muted-border-color);
}

/* Map container */
#map {
    height: 600px;
    width: 100%;
    border-radius: var(--pico-border-radius);
}

/* Stats cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    text-align: center;
    padding: 1.5rem;
    background: var(--pico-card-background-color);
    border-radius: var(--pico-border-radius);
    border: 1px solid var(--pico-muted-border-color);
}

.stat-card .value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--pico-primary);
}

.stat-card .label {
    color: var(--pico-muted-color);
    font-size: 0.9rem;
}

/* Filter form */
.filter-form {
    background: var(--pico-card-background-color);
    padding: 1.5rem;
    border-radius: var(--pico-border-radius);
    margin-bottom: 1.5rem;
}

/* Property detail */
.property-header {
    margin-bottom: 2rem;
}

.property-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.meta-item {
    padding: 1rem;
    background: var(--pico-card-background-color);
    border-radius: var(--pico-border-radius);
}

.meta-item .label {
    color: var(--pico-muted-color);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.meta-item .value {
    font-size: 1.1rem;
    font-weight: 500;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.pagination a {
    padding: 0.5rem 1rem;
}

/* Charts */
.chart-container {
    position: relative;
    height: 400px;
    margin-bottom: 2rem;
}

/* Admin panel */
.admin-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--pico-card-background-color);
    border-radius: var(--pico-border-radius);
}

.scraper-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.status-indicator.running {
    background: #00A651;
    box-shadow: 0 0 8px #00A651;
}
.status-indicator.stopped { background: #ED1C24; }
.status-indicator.paused { background: #FCAF17; }

/* Status page pulse animation */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-indicator.running {
    animation: pulse 2s infinite;
}

/* Status card improvements */
.status-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.status-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Better progress bars */
.progress-bar {
    background: var(--pico-muted-border-color);
    border-radius: 4px;
    height: 8px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease-out;
}

.progress-fill.green { background: linear-gradient(90deg, #00A651, #2ecc71); }
.progress-fill.blue { background: linear-gradient(90deg, #3498db, #5dade2); }
.progress-fill.orange { background: linear-gradient(90deg, #f39c12, #f1c40f); }
.progress-fill.red { background: linear-gradient(90deg, #e74c3c, #ec7063); }

/* Footer styling */
footer {
    margin-top: 2rem;
    padding-bottom: 1.5rem;
}

.footer-content {
    text-align: center;
}

.footer-tagline {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    background: linear-gradient(90deg, var(--gaff-green), var(--gaff-orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.footer-credits {
    display: block;
    color: var(--pico-muted-color);
}

footer small {
    color: var(--pico-muted-color);
}

/* Smooth number transitions */
.stat-value {
    transition: color 0.3s ease;
}

/* Button improvements */
button, [type="submit"] {
    transition: transform 0.1s ease;
}

button:active, [type="submit"]:active {
    transform: scale(0.98);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .results-table {
        font-size: 0.8rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    #map {
        height: 400px;
    }
}

/* ==========================================================================
   Compact Stats Bar
   ========================================================================== */

.stats-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.stats-bar__item {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    cursor: default;
}

.stats-bar__value {
    font-size: 1.1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.stats-bar__label {
    font-size: 0.75rem;
    color: var(--pico-muted-color);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.stats-bar__divider {
    width: 1px;
    height: 1.5rem;
    background: var(--pico-muted-border-color);
}

.stats-bar__item--primary .stats-bar__value { color: var(--gaff-green); }
.stats-bar__item--info .stats-bar__value { color: #3498db; }
.stats-bar__item--success .stats-bar__value { color: var(--gaff-orange); }

@media (max-width: 600px) {
    .stats-bar {
        justify-content: center;
    }
    .stats-bar__divider {
        display: none;
    }
}

/* ==========================================================================
   Compact Filter Form
   ========================================================================== */

.filter-form {
    background: var(--pico-card-background-color);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid var(--pico-muted-border-color);
}

.filter-form .grid {
    margin-bottom: 0.5rem;
}

.filter-form label {
    margin-bottom: 0;
    font-size: 0.8rem;
}

.filter-form input,
.filter-form select {
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
    margin-bottom: 0;
}

.filter-form button {
    padding: 0.5rem 1.5rem;
    margin-top: 0.5rem;
    margin-right: 0.5rem;
}

/* ==========================================================================
   Sortable Table Headers
   ========================================================================== */

.sortable-th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: background 0.15s ease;
}

.sortable-th:hover {
    background: rgba(22, 155, 98, 0.1);
}

.sortable-th .sort-indicator {
    display: inline-block;
    margin-left: 0.3rem;
    opacity: 0.3;
    font-size: 0.7rem;
}

.sortable-th.sort-asc .sort-indicator,
.sortable-th.sort-desc .sort-indicator {
    opacity: 1;
}

.sortable-th.sort-asc .sort-indicator::after { content: "\\25B2"; }
.sortable-th.sort-desc .sort-indicator::after { content: "\\25BC"; }
.sortable-th:not(.sort-asc):not(.sort-desc) .sort-indicator::after { content: "\\25B4\\25BE"; font-size: 0.6rem; }

/* Multi-sort badges */
.sort-order {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    background: var(--gaff-green);
    color: white;
    border-radius: 50%;
    font-size: 0.6rem;
    font-weight: 700;
    margin-left: 0.2rem;
}

/* Results header */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.results-header .results-summary {
    margin: 0;
}

/* Sort hint */
.sort-hint {
    font-size: 0.75rem;
    color: var(--pico-muted-color);
    margin: 0;
    font-style: italic;
    flex-shrink: 0;
}

/* ==========================================================================
   Property Results Table
   ========================================================================== */

.results-summary {
    margin-bottom: 1rem;
    color: var(--pico-muted-color);
}

.results-summary strong {
    color: var(--gaff-green);
}

.property-table-wrapper {
    overflow-x: auto;
    margin-bottom: 1rem;
}

.property-results {
    width: 100%;
    font-size: 0.9rem;
    border-collapse: collapse;
}

.property-results th {
    text-align: left;
    padding: 0.75rem;
    background: var(--pico-card-background-color);
    border-bottom: 2px solid var(--pico-muted-border-color);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--pico-muted-color);
}

.property-results th.numeric {
    text-align: right;
}

.property-results td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--pico-muted-border-color);
    vertical-align: middle;
}

.property-results tbody tr:hover {
    background: rgba(22, 155, 98, 0.05);
}

.property-results td.date {
    white-space: nowrap;
    color: var(--pico-muted-color);
    font-size: 0.85rem;
}

.property-results td.address {
    max-width: 300px;
}

.property-results td.address a {
    color: inherit;
    text-decoration: none;
}

.property-results td.address a:hover {
    color: var(--gaff-green);
    text-decoration: underline;
}

.property-results td.numeric {
    text-align: right;
}

.property-results td.price {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--gaff-green);
}

.property-results td.ber {
    text-align: center;
    font-weight: 600;
}

.property-results td.listing {
    text-align: center;
}

.property-results td.listing a {
    text-decoration: none;
}

.property-results .no-listing {
    color: var(--pico-muted-color);
}

.no-results {
    text-align: center;
    padding: 3rem;
    color: var(--pico-muted-color);
    font-size: 1.1rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.pagination button {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.pagination .page-info {
    color: var(--pico-muted-color);
    font-size: 0.9rem;
}
