/* Test Hole Tagger - Dark Sleek Mobile PWA */
:root {
    --bg: #0a0a0f;
    --bg2: #12121a;
    --bg3: #1a1a2e;
    --bg4: #242440;
    --accent: #00d4aa;
    --accent2: #00b4d8;
    --text: #e8e8f0;
    --text2: #a0a0b8;
    --text3: #666680;
    --danger: #ff4466;
    --warning: #ffaa33;
    --success: #00d4aa;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --gradient: linear-gradient(135deg, var(--accent), var(--accent2));
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 4px; }

/* App Shell */
#app {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
}

.screen {
    display: none;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}
.screen.active {
    display: flex;
}
#reportFrame, #gisViewerMap { flex: 1; min-height: 0; }

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg2);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
    min-height: 60px;
}
.header h1 {
    font-size: 18px;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.header-back {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    margin: -8px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.header-action {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 12px;
    margin: -8px -12px;
}

/* Scrollable Content */
.content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
}

/* Auth Screens */
.auth-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100%;
    padding: 40px 24px;
}
.auth-logo {
    width: 80px;
    height: 80px;
    background: var(--gradient);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin-bottom: 16px;
}
.auth-title {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 4px;
}
.auth-subtitle {
    color: var(--text2);
    font-size: 15px;
    margin-bottom: 32px;
}
.auth-form {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Form Elements */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-row {
    display: flex;
    gap: 12px;
}
.form-row .form-group { flex: 1; }

input, select, textarea {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg3);
    border: 1px solid var(--bg4);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 16px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0,212,170,0.15);
}
input::placeholder, textarea::placeholder {
    color: var(--text3);
}
textarea {
    resize: vertical;
    min-height: 80px;
}

/* Buttons */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 15px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn:disabled {
    opacity: 0.5;
    pointer-events: none;
}

.btn-primary {
    background: var(--gradient);
    color: #000;
}
.btn-primary:hover { opacity: 0.9; }

.btn-secondary {
    background: var(--bg3);
    color: var(--text);
    border: 1px solid var(--bg4);
}

.btn-danger {
    background: rgba(255,68,102,0.15);
    color: var(--danger);
    border: 1px solid rgba(255,68,102,0.2);
}

.btn-ghost {
    background: transparent;
    color: var(--accent);
    padding: 8px 0;
}

.btn-sm {
    padding: 10px 16px;
    font-size: 14px;
}

.btn-block { width: 100%; }

/* Cards */
.card {
    background: var(--bg2);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.card:active {
    background: var(--bg3);
    transform: scale(0.98);
}
.card-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
}
.card-meta {
    font-size: 13px;
    color: var(--text2);
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}
.card-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-active { background: rgba(0,212,170,0.15); color: var(--accent); }
.badge-completed { background: rgba(0,180,216,0.15); color: var(--accent2); }
.badge-pending { background: rgba(255,170,51,0.15); color: var(--warning); }

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}
.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}
.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text);
}
.empty-state p {
    color: var(--text2);
    font-size: 14px;
    margin-bottom: 24px;
    max-width: 280px;
}

/* Bottom Nav */
.bottom-nav {
    display: flex;
    background: var(--bg2);
    border-top: 1px solid rgba(255,255,255,0.05);
    padding: 8px 0;
    padding-bottom: calc(8px + var(--safe-bottom));
    flex-shrink: 0;
}
.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
    background: none;
    border: none;
    color: var(--text3);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
}
.nav-item.active { color: var(--accent); }
.nav-item svg { width: 24px; height: 24px; }

/* FAB */
.fab {
    position: fixed;
    bottom: calc(80px + var(--safe-bottom));
    right: 20px;
    width: 56px;
    height: 56px;
    background: var(--gradient);
    border: none;
    border-radius: 50%;
    color: #000;
    font-size: 28px;
    font-weight: 300;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,212,170,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    z-index: 50;
}
.fab:active { transform: scale(0.9); }

/* Photo Grid */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin-top: 12px;
}
.photo-grid-item {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    cursor: pointer;
}
.photo-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.photo-grid-item .photo-type-badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: rgba(0,0,0,0.7);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

/* Camera View */
.camera-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    z-index: 1000;
    display: none;
    flex-direction: column;
}
.camera-view.active { display: flex; }
.camera-preview {
    flex: 1;
    position: relative;
    overflow: hidden;
}
.camera-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.camera-preview canvas {
    display: none;
}
.camera-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: #fff;
    font-size: 12px;
    font-family: 'SF Mono', 'Fira Code', monospace;
}
.camera-overlay .coord-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}
.camera-controls {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 24px 40px;
    padding-bottom: calc(24px + var(--safe-bottom));
    background: rgba(0,0,0,0.9);
}
.camera-shutter {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 4px solid #fff;
    background: transparent;
    cursor: pointer;
    position: relative;
}
.camera-shutter::after {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.1s;
}
.camera-shutter:active::after { transform: scale(0.85); }
.camera-close, .camera-flip {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Photo Type Selector */
.photo-type-selector {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(0,0,0,0.9);
    overflow-x: auto;
}
.photo-type-btn {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.2);
    background: transparent;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
}
.photo-type-btn.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

/* Soil Analysis Card */
.soil-analysis {
    background: var(--bg3);
    border: 1px solid var(--bg4);
    border-radius: var(--radius);
    padding: 18px;
    margin-top: 16px;
}
.soil-analysis h4 {
    font-size: 14px;
    color: var(--accent);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ai-disclaimer {
    font-size: 11px;
    color: var(--text2);
    background: rgba(255,200,0,0.07);
    border: 1px solid rgba(255,200,0,0.2);
    border-radius: 6px;
    padding: 7px 10px;
    margin-bottom: 14px;
    line-height: 1.5;
}
.soil-stat {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 14px;
}
.soil-stat:last-child { border: none; }
.soil-stat-label { color: var(--text2); min-width: 110px; flex-shrink: 0; }
.soil-stat-value { font-weight: 600; text-align: right; max-width: 65%; }
.soil-rating {
    display: flex;
    gap: 4px;
    margin-top: 12px;
}
.soil-rating-dot {
    width: 32px;
    height: 6px;
    border-radius: 3px;
    background: var(--bg4);
}
.soil-rating-dot.filled { background: var(--accent); }
.soil-rating-dot.filled.warning { background: var(--warning); }
.soil-rating-dot.filled.danger { background: var(--danger); }

/* GPS Info Bar */
.gps-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg3);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-family: 'SF Mono', monospace;
    color: var(--text2);
    margin-bottom: 16px;
}
.gps-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Subscription Card */
.sub-card {
    background: var(--bg2);
    border: 1px solid var(--bg4);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
}
.sub-price {
    font-size: 40px;
    font-weight: 800;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.sub-price span { font-size: 16px; font-weight: 400; }
.sub-features {
    list-style: none;
    margin: 20px 0;
    text-align: left;
}
.sub-features li {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sub-features li::before {
    content: '✓';
    color: var(--accent);
    font-weight: 700;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 900;
    display: none;
    align-items: flex-end;
    justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--bg2);
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px;
    animation: slideUp 0.3s ease;
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
.modal-handle {
    width: 40px;
    height: 4px;
    background: var(--bg4);
    border-radius: 2px;
    margin: 0 auto 20px;
}
.modal h3 {
    font-size: 20px;
    margin-bottom: 20px;
}

/* Toast */
.toast-container {
    position: fixed;
    top: calc(20px + var(--safe-top));
    left: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    background: var(--bg3);
    border: 1px solid var(--bg4);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    font-size: 14px;
    font-weight: 500;
    pointer-events: auto;
    animation: toastIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow);
}
.toast.success { border-color: var(--accent); }
.toast.error { border-color: var(--danger); }
@keyframes toastIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Loading */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--bg4);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,10,15,0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1500;
    flex-direction: column;
    gap: 16px;
}
.loading-overlay.active { display: flex; }
.loading-overlay .spinner { width: 40px; height: 40px; }
.loading-text { color: var(--text2); font-size: 14px; }

/* Utility */
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-muted { color: var(--text2); }
.text-accent { color: var(--accent); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.hidden { display: none !important; }

/* Divider */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text3);
    font-size: 12px;
    margin: 20px 0;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--bg4);
}

/* Profile Screen */
#screen-profile .content {
    display: flex;
    flex-direction: column;
    align-items: center;
}
#screen-profile .auth-form {
    width: 100%;
    max-width: 420px;
}

/* Settings List */
.settings-list {
    background: var(--bg2);
    border-radius: var(--radius);
    overflow: hidden;
}
.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    transition: background 0.2s;
}
.settings-item:last-child { border: none; }
.settings-item:active { background: var(--bg3); }
.settings-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.settings-item-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--bg3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.settings-item-text h4 { font-size: 15px; font-weight: 600; }
.settings-item-text p { font-size: 12px; color: var(--text2); }
.settings-item-arrow { color: var(--text3); font-size: 18px; }

/* Photo review */
.photo-review {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 1100;
    display: none;
    flex-direction: column;
}
.photo-review.active { display: flex; }
.photo-review img {
    flex: 1;
    object-fit: contain;
    width: 100%;
}
.photo-review-actions {
    display: flex;
    gap: 12px;
    padding: 20px;
    padding-bottom: calc(20px + var(--safe-bottom));
    flex-shrink: 0;
    background: #000;
}
.photo-review-actions .btn {
    height: 54px;
    font-size: 16px;
}
