:root {
    --primary-color: #0f172a;
    --primary-accent: #2563eb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-light: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
}

body {
    background-color: var(--bg-light);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    padding-bottom: 85px; /* Space for bottom navbar */
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

input, textarea, select {
    user-select: text;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #ffffff;
    padding: 14px 16px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.brand-badge {
    background: rgba(37, 99, 235, 0.25);
    border: 1px solid rgba(37, 99, 235, 0.5);
    color: #60a5fa;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}

/* Offline Banner */
.offline-banner {
    background-color: #fef3c7;
    color: #92400e;
    border-bottom: 1px solid #fde68a;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 12px;
    display: none;
}
.offline-banner.active {
    display: flex;
}

/* Live Autosave Indicator */
.autosave-status {
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    transition: color 0.3s ease;
}
.autosave-status.saving {
    color: var(--warning-color);
}
.autosave-status.saved {
    color: #4ade80;
}

/* Cards & Sections */
.form-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    margin-bottom: 16px;
    overflow: hidden;
}

.form-card-header {
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.form-card-body {
    padding: 16px;
}

/* Guided Photo Upload Box */
.photo-slot {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    background: #f8fafc;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.photo-slot:active {
    background: #e2e8f0;
    border-color: var(--primary-accent);
}

.photo-slot.has-image {
    border: 2px solid #10b981;
    background: #ffffff;
    padding: 4px;
}

.photo-preview {
    width: 100%;
    height: 130px;
    object-fit: cover;
    border-radius: 8px;
}

.btn-remove-photo {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    z-index: 10;
}

.photo-badge-label {
    position: absolute;
    bottom: 6px;
    left: 6px;
    background: rgba(15, 23, 42, 0.85);
    color: #f8fafc;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    max-width: 90%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Multi-photo grid */
.multi-photos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.multi-photo-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    aspect-ratio: 1;
}

.multi-photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Bottom Navigation Bar */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-around;
    padding: 8px 4px 12px 4px;
    z-index: 1050;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
}

.nav-item-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: none;
    border: none;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 600;
    position: relative;
    padding: 4px 0;
    transition: color 0.2s ease;
}

.nav-item-btn i {
    font-size: 1.3rem;
    margin-bottom: 2px;
}

.nav-item-btn.active {
    color: var(--primary-accent);
}

.nav-item-btn.active i {
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

.nav-badge-count {
    position: absolute;
    top: 0;
    right: 25%;
    background: var(--danger-color);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

/* GPS Button */
.btn-gps-capture {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* View Sections */
.tab-view {
    display: none;
}
.tab-view.active {
    display: block;
    animation: fadeIn 0.25s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Debtor Collection Card */
.debtor-card {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
    position: relative;
}
.debtor-card.visited {
    border-left: 5px solid #10b981;
}
.debtor-card.pending {
    border-left: 5px solid #f59e0b;
}
