/* ============================================================
   DataLimora — datacollect.css
   Owns: #collection, #offline-banner sections
   Respondent-facing form, progress, nav, offline sync banner
   ============================================================ */

/* ─── Collection shell ───────────────────────────────────── */
#collection {
    min-height: calc(100vh - var(--nav-height));
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: var(--space-xl) var(--space-md);
    /* Ghost space: ensures the Next/Submit button is never hidden behind the status bar.
       80px = status bar height (~48px) + comfortable breathing room */
    padding-bottom: calc(var(--space-xl) + 80px);
}

.col-shell {
    width: 100%;
    max-width: 680px;
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

/* ─── Progress bar ───────────────────────────────────────── */
.col-progress-bar {
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.col-progress-fill {
    height: 100%;
    background: var(--accent-color);
    border-radius: var(--radius-pill);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px rgba(91, 138, 240, 0.5);
}

.col-progress-label {
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: right;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ─── Section card ───────────────────────────────────────── */
.col-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    box-shadow: var(--shadow-sm);
}

.col-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--space-md);
}

/* ─── Fields ─────────────────────────────────────────────── */
.col-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.col-label {
    font-size: .875rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.col-required {
    color: var(--danger-color);
    font-size: .875rem;
}

.col-option-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: .875rem;
    color: var(--text-primary);
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}
.col-option-label:hover {
    background: var(--hover-bg);
    border-color: var(--accent-color);
}
.col-option-label input[type="radio"],
.col-option-label input[type="checkbox"] {
    accent-color: var(--accent-color);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ─── Scale (range) ──────────────────────────────────────── */
.col-scale-row {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    color: var(--text-secondary);
    font-size: .8125rem;
    font-weight: 600;
}

.col-range {
    flex: 1;
    accent-color: var(--accent-color);
    height: 4px;
    border: none;
    background: var(--border-color);
    border-radius: var(--radius-pill);
    cursor: pointer;
    outline: none;
}
.col-range:focus { outline: 2px solid var(--accent-color); outline-offset: 4px; }

/* ─── GPS button ─────────────────────────────────────────── */
.col-gps-btn {
    align-self: flex-start;
    font-size: .8125rem;
}

/* ─── Navigation buttons ─────────────────────────────────── */
.col-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
    padding-top: var(--space-sm);
}
.col-nav .btn-primary,
.col-nav .btn-ghost {
    min-width: 120px;
    justify-content: center;
}

/* ─── Success state ──────────────────────────────────────── */
.col-success {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}

.col-success-icon {
    width: 64px;
    height: 64px;
    background: rgba(76, 186, 122, 0.15);
    border: 2px solid var(--success-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: var(--success-color);
    margin-bottom: var(--space-sm);
    animation: success-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes success-pop {
    from { transform: scale(0.6); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.col-success h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}
.col-success p {
    color: var(--text-secondary);
    font-size: .9375rem;
}

/* ─── Error / retry state ────────────────────────────────── */
.col-error {
    text-align: center;
    padding: var(--space-xl) var(--space-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    color: var(--text-secondary);
}
.col-error p { color: var(--danger-color); }

/* ─── Offline banner ─────────────────────────────────────── */
#offline-banner {
    position: fixed;
    bottom: 0;
    /* Respect the sidebar so the bar isn't hidden under it */
    left: var(--sidebar-width);
    right: 0;
    z-index: 50;
    pointer-events: none;
    transition: left var(--transition-std);
}

/* Adjust when sidebar is collapsed or hidden */
body.sidebar-collapsed #offline-banner { left: var(--sidebar-collapsed); }
body.sidebar-hidden    #offline-banner { left: 0; }

.offline-bar {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: var(--space-sm) var(--space-lg);
    font-size: .8125rem;
    color: var(--text-secondary);
    pointer-events: all;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
    transition: transform 0.3s ease;
}

.offline-dot {
    color: var(--warning-color);
    font-size: .625rem;
    animation: dot-pulse 1.6s ease-in-out infinite;
}
@keyframes dot-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

.offline-count {
    font-weight: 700;
    color: var(--warning-color);
    background: rgba(232, 168, 76, 0.12);
    border-radius: var(--radius-pill);
    padding: 2px 8px;
    font-size: .75rem;
}

.offline-bar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-shrink: 0;
}

.offline-sync-btn,
.offline-home-btn {
    font-size: .8125rem;
    padding: 0.35rem 0.9rem;
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
    /* On mobile main gets padding-top:56px from sidebar.css for hamburger.
       Subtract that so collection doesn't double-pad. */
    #collection {
        padding: var(--space-md) var(--space-sm);
        /* Ghost space: Next/Submit button must clear the status bar on small screens */
        padding-bottom: calc(var(--space-md) + 80px);
        /* ensure form is never hidden behind hamburger button */
        min-height: calc(100vh - 56px);
    }
}

@media (max-width: 600px) {
    #collection { padding: var(--space-md) var(--space-sm); padding-bottom: calc(var(--space-md) + 80px); }
    .col-shell { max-width: 100%; }
    .col-section { padding: var(--space-lg) var(--space-md); border-radius: var(--radius-lg); }
    .col-nav { flex-wrap: wrap; }
    .col-nav .btn-primary,
    .col-nav .btn-ghost { min-width: 0; flex: 1; }
    .offline-bar { flex-wrap: wrap; }
    /* offline bar also needs left:0 since there's no sidebar on mobile */
    #offline-banner { left: 0; }
}
