/**
 * Plexo Investment Tracker - Frontend Styles
 */

.pit-frontend {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    color: #1e293b;
}

/* Header */
.pit-header {
    text-align: center;
    margin-bottom: 30px;
}

.pit-title {
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 10px 0;
}

.pit-subtitle {
    font-size: 16px;
    color: #64748b;
    margin: 0;
}

/* Stats */
.pit-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.pit-stat {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.pit-stat-number {
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 5px;
}

.pit-stat-label {
    font-size: 12px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Colors */
.pit-up {
    color: #059669 !important;
}

.pit-down {
    color: #dc2626 !important;
}

.pit-separator {
    color: #94a3b8;
    margin: 0 5px;
}

/* Sections */
.pit-section {
    margin-bottom: 30px;
}

.pit-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

.pit-count {
    font-weight: 400;
    color: #64748b;
}

/* Top Gainers */
.pit-gainers-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pit-gainer-card {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 15px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.pit-gainer-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.pit-gainer-rank {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #92400e;
    flex-shrink: 0;
}

.pit-gainer-info {
    flex: 1;
    min-width: 0;
}

.pit-gainer-name {
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pit-gainer-location {
    font-size: 13px;
    color: #64748b;
}

.pit-gainer-change {
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
}

/* Filters */
.pit-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8fafc;
    border-radius: 10px;
}

.pit-filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.pit-filter-group label {
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    text-transform: uppercase;
}

.pit-select {
    padding: 10px 35px 10px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    min-width: 180px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.pit-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pit-btn-filter {
    background: #3b82f6;
    color: #fff;
}

.pit-btn-filter:hover {
    background: #2563eb;
}

.pit-btn-timeline {
    background: #f1f5f9;
    color: #475569;
    padding: 8px 16px;
    font-size: 13px;
}

.pit-btn-timeline:hover {
    background: #e2e8f0;
}

/* Developments List */
.pit-developments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pit-dev-card {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 20px;
    transition: all 0.2s ease;
}

.pit-dev-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.pit-dev-main {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.pit-dev-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.pit-dev-info {
    min-width: 0;
}

.pit-dev-name {
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 3px;
}

.pit-dev-meta {
    font-size: 13px;
    color: #64748b;
}

.pit-dev-prices {
    display: flex;
    gap: 25px;
}

.pit-dev-price-item {
    text-align: right;
}

.pit-dev-price-label {
    font-size: 11px;
    color: #94a3b8;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.pit-dev-price-value {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
}

.pit-dev-change {
    text-align: center;
    min-width: 80px;
}

.pit-change-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 15px;
    font-weight: 700;
}

.pit-change-badge.pit-up {
    background: #dcfce7;
}

.pit-change-badge.pit-down {
    background: #fee2e2;
}

.pit-change-badge.pit-neutral {
    background: #f1f5f9;
    color: #64748b;
    font-size: 12px;
    font-weight: 500;
}

.pit-change-since {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
}

.pit-dev-action {
    flex-shrink: 0;
}

/* Town Analysis */
.pit-town-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.pit-town-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 15px;
}

.pit-town-name {
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 10px;
}

.pit-town-stats {
    display: flex;
    gap: 15px;
}

.pit-town-stat {
    display: flex;
    flex-direction: column;
}

.pit-town-stat-value {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
}

.pit-town-stat-label {
    font-size: 11px;
    color: #94a3b8;
}

/* Modal */
.pit-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
}

.pit-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.pit-modal-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.pit-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 28px;
    color: #fff;
    cursor: pointer;
    z-index: 10;
    line-height: 1;
}

.pit-modal-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e40af 100%);
    padding: 25px 30px;
}

.pit-modal-header h3 {
    margin: 0;
    color: #fff;
    font-size: 20px;
    border: none;
    padding: 0;
}

.pit-modal-body {
    padding: 25px 30px;
    max-height: 60vh;
    overflow-y: auto;
}

/* Timeline in Modal */
.pit-timeline-baseline {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 20px;
    font-size: 14px;
}

.pit-timeline-baseline strong {
    color: #0369a1;
}

.pit-timeline-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.pit-timeline-item {
    display: grid;
    grid-template-columns: 100px 1fr 100px;
    gap: 15px;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f1f5f9;
    position: relative;
}

.pit-timeline-item:last-child {
    border-bottom: none;
}

.pit-timeline-date {
    font-weight: 600;
    color: #475569;
    font-size: 14px;
}

.pit-timeline-data {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pit-timeline-price {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
}

.pit-timeline-price-m2 {
    font-size: 13px;
    color: #64748b;
}

.pit-timeline-pct {
    text-align: right;
}

.pit-timeline-pct-main {
    font-size: 18px;
    font-weight: 700;
}

.pit-timeline-pct-prev {
    font-size: 12px;
    color: #64748b;
}

.pit-loading {
    text-align: center;
    padding: 40px;
    color: #64748b;
}

.pit-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: pit-spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes pit-spin {
    to { transform: rotate(360deg); }
}

/* Footer */
.pit-footer {
    text-align: center;
    padding: 20px;
    color: #94a3b8;
    font-size: 13px;
    border-top: 1px solid #e2e8f0;
    margin-top: 30px;
}

/* Responsive */
@media (max-width: 768px) {
    .pit-frontend {
        padding: 15px;
    }
    
    .pit-title {
        font-size: 22px;
    }
    
    .pit-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .pit-stat-number {
        font-size: 22px;
    }
    
    .pit-filters {
        flex-direction: column;
    }
    
    .pit-filter-group {
        width: 100%;
    }
    
    .pit-select {
        width: 100%;
    }
    
    .pit-dev-card {
        flex-wrap: wrap;
    }
    
    .pit-dev-main {
        width: 100%;
    }
    
    .pit-dev-prices {
        width: 100%;
        justify-content: space-between;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid #f1f5f9;
    }
    
    .pit-dev-change {
        margin-left: auto;
    }
    
    .pit-dev-action {
        width: 100%;
        margin-top: 10px;
    }
    
    .pit-dev-action .pit-btn {
        width: 100%;
    }
    
    .pit-modal-container {
        width: 95%;
        max-height: 90vh;
    }
    
    .pit-timeline-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .pit-timeline-pct {
        text-align: left;
    }
}
