/* ============================================================
   GeoProxy Widget CSS Framework
   AI-dostu, tema uyumlu hazir widget bilesenleri
   ============================================================ */

/* --- Generic Loading State (gp-loading class'i ekle, fetch sonrasi kaldir) --- */
.gp-loading {
    animation: gp-loading-pulse 1.4s ease-in-out infinite;
    cursor: wait !important;
    background-color: #f1f3f5 !important;
    background-image: linear-gradient(90deg, transparent, rgba(13,110,253,0.12), transparent) !important;
    background-size: 200% 100% !important;
    background-position: 100% 0;
    color: #6c757d !important;
}
.gp-loading:disabled,
.gp-loading[disabled] {
    opacity: 0.9;
}
@keyframes gp-loading-pulse {
    0%   { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}


/* --- Widget Container --- */
.gp-widget {
    position: absolute;
    background: var(--app-sidebar-bg, #fff);
    border-radius: var(--ctrl-border-radius, 8px);
    box-shadow: var(--ctrl-shadow, 0 2px 8px rgba(0,0,0,.15));
    overflow: hidden;
    z-index: 100;
    min-width: 200px;
    max-width: 95vw;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    color: #333;
}

/* Konum yardimcilari */
.gp-widget-tl { top: 70px; left: 10px; }
.gp-widget-tr { top: 70px; right: 10px; }
.gp-widget-bl { bottom: 30px; left: 10px; }
.gp-widget-br { bottom: 30px; right: 10px; }

/* --- Widget Header --- */
.gp-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--app-primary, #1a73e8);
    color: #fff;
    padding: 8px 12px;
    font-weight: 600;
    font-size: 13px;
    cursor: move;
    user-select: none;
}

.gp-widget-header .gp-widget-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Widget Close Button --- */
.gp-widget-close {
    background: none;
    border: none;
    color: rgba(255,255,255,.8);
    cursor: pointer;
    padding: 0 2px;
    font-size: 16px;
    line-height: 1;
    margin-left: 8px;
}
.gp-widget-close:hover {
    color: #fff;
}

/* --- Widget Body --- */
.gp-widget-body {
    padding: 12px;
    max-height: 60vh;
    overflow-y: auto;
}

/* --- Widget Footer --- */
.gp-widget-footer {
    padding: 8px 12px;
    border-top: 1px solid #eee;
    font-size: 12px;
    color: #888;
    text-align: right;
}

/* --- Hava Durumu Widget (GEOPRX-207) --- */
.gp-weather {
    position: fixed;            /* body'ye sabit: katman paneli/araç çubuğu üzerinde kalır */
    top: 64px;                  /* uygulama başlığının altında */
    right: 56px;                /* sağ üstteki katman (hamburger) butonunu engellemez */
    left: auto;
    min-width: 200px;
    z-index: 1100;              /* harita içi tüm panellerin üstünde */
    padding: 10px 14px 12px;
    touch-action: none;         /* surukle-birak icin */
    cursor: move;
    /* Yarı saydam ARKA PLAN (element opacity'si yerine): yazılar net kalır,
       altındaki harita yazıları metnin içinden sızmaz. */
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(2px);
}
.gp-weather-close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: none;
    color: #98a2b3;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}
.gp-weather-close:hover { color: #475467; }
.gp-weather-il {
    font-weight: 700;
    font-size: 13px;
    margin: 0 18px 6px 0;
    color: var(--app-primary, #1a73e8);
}
.gp-weather-body { display: flex; flex-direction: column; gap: 6px; }
.gp-weather-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    color: #344054;
    white-space: nowrap;
}
.gp-weather-row svg { flex: 0 0 auto; color: var(--app-primary, #1a73e8); }
.gp-weather-row.gp-weather-muted { color: #98a2b3; }

/* --- Stat Card --- */
.gp-stat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 8px;
}

.gp-stat-card .gp-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    background: var(--app-primary, #1a73e8);
    flex-shrink: 0;
}

.gp-stat-card .gp-stat-content {
    flex: 1;
    min-width: 0;
}

.gp-stat-card .gp-stat-value {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    color: #212529;
}

.gp-stat-card .gp-stat-label {
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Data Table --- */
.gp-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.gp-data-table thead th {
    background: #f1f3f5;
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
}

.gp-data-table tbody td {
    padding: 7px 10px;
    border-bottom: 1px solid #eee;
}

.gp-data-table tbody tr:hover {
    background: #f8f9fa;
}

.gp-data-table tbody tr:nth-child(even) {
    background: #fafafa;
}
.gp-data-table tbody tr:nth-child(even):hover {
    background: #f0f0f0;
}

/* --- Legend Panel --- */
.gp-legend {
    padding: 8px 0;
}

.gp-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 13px;
}

.gp-legend-color {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,.1);
    flex-shrink: 0;
}

.gp-legend-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gp-legend-value {
    font-weight: 600;
    color: #555;
    font-size: 12px;
}

/* --- Chart Container --- */
.gp-chart-container {
    position: relative;
    width: 100%;
    min-height: 200px;
}

.gp-chart-container canvas {
    width: 100% !important;
    height: auto !important;
}

/* --- Badge & Pill --- */
.gp-badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    background: var(--app-primary, #1a73e8);
    color: #fff;
    line-height: 1.4;
}

.gp-badge-success { background: #28a745; }
.gp-badge-warning { background: #ffc107; color: #333; }
.gp-badge-danger { background: #dc3545; }
.gp-badge-info { background: #17a2b8; }
.gp-badge-secondary { background: #6c757d; }

.gp-pill {
    display: inline-block;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 50px;
    background: #e9ecef;
    color: #495057;
    line-height: 1.4;
}

/* --- Utility Classes --- */
.gp-text-center { text-align: center; }
.gp-text-right { text-align: right; }
.gp-text-muted { color: #6c757d; }
.gp-text-primary { color: var(--app-primary, #1a73e8); }
.gp-text-success { color: #28a745; }
.gp-text-danger { color: #dc3545; }
.gp-text-sm { font-size: 12px; }
.gp-text-lg { font-size: 18px; }
.gp-text-xl { font-size: 24px; }
.gp-fw-bold { font-weight: 700; }
.gp-mt-1 { margin-top: 4px; }
.gp-mt-2 { margin-top: 8px; }
.gp-mt-3 { margin-top: 16px; }
.gp-mb-1 { margin-bottom: 4px; }
.gp-mb-2 { margin-bottom: 8px; }
.gp-mb-3 { margin-bottom: 16px; }
.gp-p-2 { padding: 8px; }
.gp-p-3 { padding: 16px; }
.gp-gap-2 { gap: 8px; }
.gp-d-flex { display: flex; }
.gp-flex-wrap { flex-wrap: wrap; }
.gp-flex-column { flex-direction: column; }
.gp-align-center { align-items: center; }
.gp-justify-between { justify-content: space-between; }

/* --- Responsive --- */
@media (max-width: 768px) {
    .gp-widget {
        min-width: 160px;
        font-size: 13px;
    }
    .gp-stat-card .gp-stat-value {
        font-size: 18px;
    }
    .gp-widget-body {
        max-height: 50vh;
    }
}
