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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #0f1117;
    color: #e0e0e0;
    min-height: 100vh;
}

.app-container { max-width: 800px; margin: 0 auto; padding: 24px 16px; }

/* Header */
header { text-align: center; margin-bottom: 28px; }
.logo { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 6px; }
.logo h1 { font-size: 1.7rem; font-weight: 700; background: linear-gradient(135deg, #4CAF50, #81C784); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.subtitle { color: #888; font-size: 0.9rem; }

/* Upload */
.upload-area {
    border: 2px dashed #444; border-radius: 14px; padding: 48px 24px;
    text-align: center; cursor: pointer; transition: all 0.3s; background: #1a1d27;
}
.upload-area:hover, .upload-area.dragover { border-color: #4CAF50; background: #1e2330; }
.upload-area.hidden { display: none; }
.upload-area svg { margin-bottom: 12px; opacity: 0.5; }
.upload-area p { color: #999; font-size: 0.95rem; }
.upload-area input[type="file"] { display: none; }

/* Preview thumb */
.preview-thumb {
    display: flex; align-items: center; gap: 12px;
    background: #1a1d27; border-radius: 12px; padding: 12px 16px;
}
.preview-thumb.hidden { display: none; }
.preview-thumb img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
.preview-thumb span { flex: 1; font-size: 0.9rem; color: #aaa; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-clear { background: none; border: none; color: #888; font-size: 1.5rem; cursor: pointer; padding: 4px 8px; }
.btn-clear:hover { color: #f44336; }

/* Coords form */
.coords-form { margin-top: 16px; }
.form-row { display: flex; gap: 12px; margin-bottom: 16px; }
.form-group { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 0.8rem; color: #888; text-transform: uppercase; letter-spacing: 0.5px; }
.form-group input, .form-group textarea {
    padding: 10px 14px; border-radius: 10px; border: 1px solid #333;
    background: #1a1d27; color: #e0e0e0; font-size: 1rem; outline: none; transition: border-color 0.2s;
    font-family: inherit;
}
.form-group input[type="datetime-local"] {
    color-scheme: dark;
    cursor: pointer;
}
.form-group input:focus, .form-group textarea:focus { border-color: #4CAF50; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px;
    border-radius: 10px; border: 1px solid #444; background: #1a1d27;
    color: #e0e0e0; font-size: 0.95rem; cursor: pointer; transition: all 0.2s;
}
.btn:hover { background: #252836; border-color: #666; }
.btn-primary { background: #4CAF50; border-color: #4CAF50; color: #fff; font-weight: 600; width: 100%; justify-content: center; }
.btn-primary:hover { background: #43A047; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary:disabled:hover { background: #4CAF50; }

/* Loading */
.loading-section { text-align: center; padding: 60px 20px; }
.spinner { width: 44px; height: 44px; border: 4px solid #333; border-top-color: #4CAF50; border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-section p { color: #888; }

/* Result */
.result-section { display: flex; flex-direction: column; gap: 16px; }
.result-preview { border-radius: 12px; overflow: hidden; background: #000; display: flex; justify-content: center; }
.result-preview canvas { max-width: 100%; height: auto; display: block; }
.actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.actions .btn-primary { width: auto; }

/* Utility */
.hidden { display: none !important; }

/* Lookup button */
.btn-lookup {
    padding: 10px 14px; border-radius: 10px; border: 1px solid #333;
    background: #1a1d27; color: #e0e0e0; font-size: 1.1rem; cursor: pointer;
    transition: all 0.2s; min-width: 44px; text-align: center;
}
.btn-lookup:hover:not(:disabled) { background: #252836; border-color: #4CAF50; }
.btn-lookup:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-lookup.loading span { display: inline-block; animation: spin 0.8s linear infinite; }

/* Auto-fill notice */
.auto-fill-notice {
    font-size: 0.78rem; color: #4CAF50; margin: -8px 0 12px 2px;
    transition: opacity 0.3s;
}
.auto-fill-notice.hidden { display: none; }

/* Pincode wrapper */
.pincode-wrapper { position: relative; }
.pincode-wrapper input { width: 100%; padding-right: 32px; }
.pincode-status {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    font-size: 1.1rem; pointer-events: none;
}
.pincode-status.loading { color: #888; animation: spin 0.8s linear infinite; display: inline-block; }
.pincode-status.success { color: #4CAF50; }
.pincode-status.error { color: #f44336; }

/* 3-column form row */
.form-row-3 { display: flex; gap: 12px; margin-bottom: 16px; }
.form-row-3 .form-group { flex: 1; }

/* Responsive */
@media (max-width: 500px) {
    .form-row, .form-row-3 { flex-direction: column; }
    .logo h1 { font-size: 1.3rem; }
}
