/* ========================================
   SEDEP Saha - Modern UI
   ======================================== */

*, *::before, *::after { box-sizing: border-box; }

body, html {
    margin: 0; padding: 0; height: 100%; width: 100%; overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#map {
    position: absolute; top: 0; bottom: 0; width: 100%; height: 100dvh;
    background-color: #eef2f7;
}

/* ========================================
   Map Markers
   ======================================== */
/* Pin markers are rendered as canvas symbol layer - no CSS needed */

/* ========================================
   Top Bar
   ======================================== */
.top-bar {
    position: absolute; top: 0; left: 0; right: 0;
    padding: 12px 14px; padding-top: calc(12px + env(safe-area-inset-top));
    pointer-events: none; z-index: 10;
    display: flex; justify-content: space-between; align-items: flex-start;
}

.top-pill {
    pointer-events: auto;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.6);
    box-shadow: 0 2px 12px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.top-pill:active { transform: scale(0.96); box-shadow: 0 1px 6px rgba(0,0,0,0.1); }

/* ========================================
   Filter Menu
   ======================================== */
#filter-menu {
    position: absolute; top: calc(60px + env(safe-area-inset-top)); right: 14px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.6);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.04);
    z-index: 15;
    min-width: 240px;
    animation: filterSlideIn 0.2s ease;
}

@keyframes filterSlideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   Bottom Sheet
   ======================================== */
#bottom-sheet {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: #ffffff;
    border-top-left-radius: 20px; border-top-right-radius: 20px;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.10), 0 -2px 8px rgba(0,0,0,0.05);
    transform: translateY(110%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
    will-change: transform; touch-action: none;
    max-height: 85vh; overflow-y: auto;
}
#bottom-sheet.active { transform: translateY(0); }

@media (min-width: 768px) {
    #bottom-sheet {
        left: 50%; transform: translate(-50%, 110%);
        width: 400px; bottom: 20px; border-radius: 20px;
    }
    #bottom-sheet.active { transform: translate(-50%, 0); }
}

.sheet-handle {
    width: 40px; height: 5px;
    background: linear-gradient(135deg, #d1d5db, #9ca3af);
    border-radius: 10px; margin: 8px auto 2px auto;
    cursor: grab; opacity: 0.6;
}

/* ========================================
   Badges
   ======================================== */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 10px; font-weight: 700; letter-spacing: 0.02em;
    padding: 4px 10px; border-radius: 20px;
    border: 1px solid;
}
.badge i { font-size: 9px; }
.badge-male { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; }
.badge-female { background: #fdf2f8; color: #db2777; border-color: #fbcfe8; }
.badge-disabled { background: #f5f3ff; color: #7c3aed; border-color: #ddd6fe; }
.badge-pregnant { background: #fff1f2; color: #e11d48; border-color: #fecdd3; }
.badge-renew { background: #fff7ed; color: #ea580c; border-color: #fed7aa; }
.badge-puan { border-radius: 20px; }
.badge-puan-high { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.badge-puan-mid { background: #fffbeb; color: #d97706; border-color: #fde68a; }
.badge-puan-low { background: #f9fafb; color: #6b7280; border-color: #e5e7eb; }

/* ========================================
   Info Cards & Sections
   ======================================== */
.info-card {
    background: white; border-radius: 14px;
    border: 1px solid #f0f0f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    padding: 14px; margin-bottom: 10px;
}

.section-label {
    font-size: 10px; font-weight: 800; color: #9ca3af;
    text-transform: uppercase; letter-spacing: 0.08em;
    margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
}
.section-label i { font-size: 10px; color: #c0c0c0; }

.address-box {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    padding: 10px 12px; border-radius: 12px;
    border: 1px solid #e8ecf0;
    display: flex; gap: 8px; align-items: flex-start;
}
.address-box i { color: #94a3b8; margin-top: 2px; font-size: 11px; }
.address-box span { font-size: 12px; color: #475569; font-weight: 500; line-height: 1.4; }

/* ========================================
   Phone Button
   ======================================== */
.phone-btn {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 700;
    color: white; background: linear-gradient(135deg, #22c55e, #16a34a);
    padding: 8px 14px; border-radius: 12px;
    text-decoration: none; min-height: 44px;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
    transition: transform 0.1s, box-shadow 0.1s;
}
.phone-btn:active { transform: scale(0.96); box-shadow: 0 1px 4px rgba(34, 197, 94, 0.2); }
.phone-btn i { font-size: 10px; }

.veri-girisi-btn {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; font-weight: 700;
    color: white; background: linear-gradient(135deg, #EAB308, #CA8A04);
    padding: 8px 10px; border-radius: 12px;
    border: none; cursor: pointer; min-height: 44px;
    box-shadow: 0 2px 8px rgba(234, 179, 8, 0.3);
    transition: transform 0.1s, box-shadow 0.1s;
}
.veri-girisi-btn:active { transform: scale(0.96); box-shadow: 0 1px 4px rgba(234, 179, 8, 0.2); }
.veri-girisi-btn i { font-size: 9px; }

.hata-btn {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; font-weight: 700;
    color: white; background: linear-gradient(135deg, #1e293b, #0f172a);
    padding: 8px 10px; border-radius: 12px;
    border: none; cursor: pointer; min-height: 44px;
    box-shadow: 0 2px 8px rgba(30, 41, 59, 0.3);
    transition: transform 0.1s, box-shadow 0.1s;
}
.hata-btn:active { transform: scale(0.96); box-shadow: 0 1px 4px rgba(30, 41, 59, 0.2); }
.hata-btn i { font-size: 9px; }

.phone-btn-sm {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; font-weight: 700;
    color: #16a34a; background: #f0fdf4;
    padding: 6px 12px; border-radius: 10px; border: 1px solid #bbf7d0;
    text-decoration: none; min-height: 44px;
    transition: all 0.15s;
}
.phone-btn-sm:active { background: #dcfce7; transform: scale(0.96); }
.phone-btn-sm i { font-size: 9px; color: #22c55e; }

.veri-girisi-btn-sm {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 10px; font-weight: 700;
    color: #854d0e; background: #fef3c7;
    padding: 6px 10px; border-radius: 10px; border: 1px solid #fde68a;
    cursor: pointer; min-height: 44px;
    transition: all 0.15s;
    white-space: nowrap;
}
.veri-girisi-btn-sm:active { background: #fde68a; transform: scale(0.96); }
.veri-girisi-btn-sm i { font-size: 8px; color: #ca8a04; }

/* ========================================
   Note Input
   ======================================== */
.note-input {
    width: 100%; font-size: 13px; padding: 10px 14px; border-radius: 12px;
    background: #f8fafc; border: 1.5px solid #e2e8f0; color: #1e293b;
    resize: none; outline: none; min-height: 40px;
    font-family: inherit;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.note-input:focus {
    border-color: #818cf8; background: white;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.15);
}
.note-input::placeholder { color: #94a3b8; }

/* ========================================
   Status Buttons
   ======================================== */
.status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.status-btn {
    min-height: 48px; min-width: 44px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; border-radius: 12px; font-weight: 900; font-size: 11px;
    letter-spacing: 0.02em;
    transition: all 0.15s ease;
    border: 1.5px solid; cursor: pointer;
    position: relative; overflow: hidden;
    -webkit-font-smoothing: antialiased;
}
.status-btn:active { transform: scale(0.95); }
.status-btn i { font-size: 18px; }

.status-btn-done { background: #f0fdf4; color: #15803d; border-color: #86efac; }
.status-btn-done:active, .status-btn-done.active { background: #22c55e; color: white; border-color: #22c55e; }

.status-btn-repeat { background: #faf5ff; color: #7e22ce; border-color: #d8b4fe; }
.status-btn-repeat:active, .status-btn-repeat.active { background: #9333ea; color: white; border-color: #9333ea; }

.status-btn-route { background: #eff6ff; color: #1d4ed8; border-color: #93c5fd; }
.status-btn-route:active, .status-btn-route.active { background: #2563eb; color: white; border-color: #2563eb; }

.status-btn-unreachable { background: #fff7ed; color: #c2410c; border-color: #fdba74; }
.status-btn-unreachable:active, .status-btn-unreachable.active { background: #ea580c; color: white; border-color: #ea580c; }

/* ========================================
   Action Buttons (Maps, Yandex, Detay)
   ======================================== */
.action-row { display: flex; gap: 8px; }

.action-btn {
    flex: 1; min-height: 46px; border-radius: 12px;
    font-weight: 800; font-size: 12px; letter-spacing: 0.01em;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    text-decoration: none; cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    border: none;
    -webkit-font-smoothing: antialiased;
}
.action-btn:active { transform: scale(0.96); }
.action-btn i { font-size: 13px; }

.action-btn-maps {
    background: linear-gradient(135deg, #1e293b, #334155);
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.action-btn-yandex {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 2px 8px rgba(239,68,68,0.25);
}
.action-btn-detail {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}

/* ========================================
   Detail View
   ======================================== */
#detail-view {
    position: fixed; inset: 0; background: #f8fafc; z-index: 3000;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex; flex-direction: column; overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
#detail-view.active { transform: translateY(0); }

@media (min-width: 768px) {
    #detail-view {
        inset: auto; left: 50%; top: 50%;
        transform: translate(-50%, -50%) scale(0.92);
        width: 420px; max-height: 88vh; border-radius: 24px;
        opacity: 0; pointer-events: none;
        box-shadow: 0 25px 60px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.05);
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.3s ease;
    }
    #detail-view.active {
        transform: translate(-50%, -50%) scale(1); opacity: 1; pointer-events: auto;
    }
}

.detail-header {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky; top: 0; z-index: 10;
    padding: 14px 16px;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid #f1f5f9;
}

.close-btn {
    width: 36px; height: 36px; min-height: 44px; min-width: 44px;
    display: flex; align-items: center; justify-content: center;
    background: #f1f5f9; border-radius: 50%; border: none;
    color: #64748b; font-size: 16px; cursor: pointer;
    transition: all 0.15s;
}
.close-btn:active { transform: scale(0.9); background: #e2e8f0; }

/* ========================================
   Hane Rows
   ======================================== */
.hane-row {
    display: flex; align-items: center; gap: 12px; padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}
.hane-row:last-child { border-bottom: none; }

.hane-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 14px;
}
.hane-avatar-male { background: #eff6ff; color: #3b82f6; }
.hane-avatar-female { background: #fdf2f8; color: #ec4899; }

.hane-name { font-size: 13px; color: #334155; font-weight: 600; }

/* ========================================
   List View
   ======================================== */
#list-view {
    position: fixed; inset: 0; background: #f8fafc; z-index: 2000;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex; flex-direction: column;
}
#list-view.active { transform: translateY(0); }

@media (min-width: 768px) {
    #list-view {
        left: 50%; top: 50%;
        transform: translate(-50%, -50%) scale(0.92);
        width: 420px; height: 82vh; border-radius: 24px;
        opacity: 0; pointer-events: none;
        box-shadow: 0 25px 60px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.05);
    }
    #list-view.active {
        transform: translate(-50%, -50%) scale(1); opacity: 1; pointer-events: auto;
    }
}

.list-header {
    background: white; padding: 14px 16px;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid #f1f5f9; z-index: 20;
}

.tab-bar {
    display: flex; gap: 4px; padding: 6px; background: #f1f5f9;
    border-radius: 12px; margin: 12px 16px 0;
}

.tab-btn {
    flex: 1; text-align: center; padding: 10px 12px;
    font-weight: 700; font-size: 12px; letter-spacing: 0.02em;
    color: #64748b; border-radius: 10px;
    transition: all 0.2s ease; cursor: pointer;
    min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 6px;
    border: none; background: transparent;
}
.tab-btn.active {
    color: #1e293b; background: white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);
}

/* List Items */
.list-item {
    background: white; padding: 14px; border-radius: 14px;
    border: 1px solid #f0f0f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    display: flex; align-items: center; gap: 12px;
    cursor: pointer; margin-bottom: 8px;
    transition: transform 0.1s, box-shadow 0.1s;
    min-height: 44px;
}
.list-item:active { transform: scale(0.98); box-shadow: 0 1px 2px rgba(0,0,0,0.06); }

.list-avatar {
    width: 42px; height: 42px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 16px; flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.list-status-dot {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 9px; font-weight: 800; letter-spacing: 0.05em;
    padding: 3px 8px; border-radius: 20px;
    white-space: nowrap;
}

/* ========================================
   TC Box
   ======================================== */
.tc-box {
    background: white; border: 1px solid #e5e7eb; border-radius: 12px;
    padding: 14px; font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 13px; color: #374151;
    word-break: break-all; line-height: 1.7;
    user-select: all;
}

/* ========================================
   User Location
   ======================================== */
.user-location-marker {
    width: 18px; height: 18px; border-radius: 50%;
    background: #3b82f6; border: 3px solid white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
    position: relative;
}
.user-pulse {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 50px; height: 50px; border-radius: 50%;
    background: rgba(59, 130, 246, 0.15);
    animation: user-pulse-anim 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    z-index: -1;
}

@keyframes user-pulse-anim {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(1.8); opacity: 0; }
}

/* ========================================
   Utility
   ======================================== */
.truncate-2 {
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
