:root {
    --bg-darker: #0d1117;
    --bg-panel: #161b22;
    --border-dim: #30363d;
    --brand-accent: #238636;
    --brand-accent-hover: #2ea043;
    --text-white: #c9d1d9;
    --text-dark-muted: #8b949e;
    --glass-bg: rgba(22, 27, 34, 0.7);
}

body, html {
    background-color: var(--bg-darker);
    color: var(--text-white);
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, sans-serif;
    height: 100vh;
    overflow-x: hidden;
    overscroll-behavior-y: none;
    -webkit-tap-highlight-color: transparent;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    overflow-x: hidden;
}

#blazor-error-ui {
    display: none;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    position: relative;
    overflow-x: hidden;
}

/* Splash / Home Screen */
.home-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--bg-darker);
    position: relative;
    animation: fadeIn 0.8s ease-out;
}

.brand-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -1px;
}

.brand-title .accent {
    color: var(--brand-accent);
}

.brand-subtitle {
    color: var(--text-dark-muted);
    font-size: 1.1rem;
    margin-top: 8px;
    margin-bottom: 40px;
}

.fab-new-doc {
    background: var(--brand-accent);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 16px 32px;
    font-size: 1.1rem;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(35, 134, 54, 0.4);
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.fab-new-doc:active {
    transform: scale(0.96);
    background: var(--brand-accent-hover);
}

.branding-footer {
    position: absolute;
    bottom: 30px;
    font-size: 0.8rem;
    color: var(--text-dark-muted);
    opacity: 0.6;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Editor Workspace */
.editor-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-dim);
    z-index: 10;
}

.back-btn {
    background: none;
    border: none;
    color: var(--text-white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
}

.top-bar-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.compile-btn {
    background: var(--brand-accent);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 6px 16px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
}

.preview-stage {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stack-scroller {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 500px;
    padding-bottom: 120px; /* Space for bottom sheet */
}

.stack-card {
    background: var(--bg-panel);
    border: 2px solid transparent;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.active-frame {
    border-color: var(--brand-accent);
    transform: scale(1.02);
}

.frame-tag {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-dark-muted);
    padding: 10px 16px;
    background: rgba(0,0,0,0.2);
    font-weight: 500;
}

.edit-badge {
    display: inline-flex;
    align-items: center;
    background: rgba(35, 134, 54, 0.15);
    color: var(--brand-accent);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.stack-card:hover .edit-badge, .active-frame .edit-badge {
    background: var(--brand-accent);
    color: white;
}

.image-wrapper {
    width: 100%;
    display: flex;
    overflow: hidden;
    background: #000;
}

.image-wrapper img {
    width: 100%;
    height: auto;
    object-fit: contain;
    transition: clip-path 0.2s ease;
}

/* Horizontal Strip */
.sequence-strip {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 110px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-dim);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    overflow-x: auto;
    z-index: 20;
    scroll-snap-type: x mandatory;
}

.sequence-strip::-webkit-scrollbar {
    display: none;
}

.strip-thumb {
    width: 70px;
    height: 90px;
    background: #222;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
    flex-shrink: 0;
    scroll-snap-align: center;
    transition: transform 0.2s;
}

.strip-thumb.active {
    border-color: var(--brand-accent);
    transform: translateY(-4px);
}

.strip-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Bottom Sheet */
.bottom-sheet {
    position: absolute;
    bottom: 110px; /* Above sequence strip */
    left: 0;
    right: 0;
    background: var(--bg-panel);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    padding: 24px;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
    z-index: 30;
    transform: translateY(120%);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.bottom-sheet.open {
    transform: translateY(0);
}

.sheet-handle {
    width: 40px;
    height: 5px;
    background: var(--border-dim);
    border-radius: 3px;
    margin: 0 auto 20px auto;
}

.sheet-content h5 {
    margin: 0 0 16px 0;
    font-size: 1.1rem;
}

.range-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.range-group label {
    font-size: 0.9rem;
    color: var(--text-dark-muted);
}

.range-group input[type=range] {
    width: 100%;
    accent-color: var(--brand-accent);
}

.sheet-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.sheet-btn {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    background: var(--border-dim);
    color: var(--text-white);
}

.sheet-btn.danger {
    background: rgba(248, 81, 73, 0.15);
    color: #f85149;
}

/* Custom System Hydration Animation View */
.shotstack-loader { display: flex; flex-direction: column; align-items: center; gap: 16px; justify-content: center; height: 100vh; background: var(--bg-darker); font-family: system-ui, -apple-system, sans-serif; color: var(--text-white); }
.spinner { width: 40px; height: 40px; border: 4px solid var(--border-dim); border-top-color: var(--brand-accent); border-radius: 50%; animation: spin 1s linear infinite; }
.shotstack-loader .loading-text { font-size: 1.05rem; font-weight: 500; letter-spacing: 0.5px; color: var(--text-white); }
.shotstack-loader .progress-bar-container { width: 200px; height: 6px; background: var(--border-dim); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.shotstack-loader .progress-bar-fill { height: 100%; background: var(--brand-accent); width: var(--blazor-load-percentage, 0%); border-radius: 3px; transition: width 0.1s ease; }
.shotstack-loader .progress-text::after { content: var(--blazor-load-percentage-text, "Loading..."); font-size: 0.85rem; color: var(--text-dark-muted); font-weight: 600; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Close Sheet Button */
.close-sheet-btn {
    background: none;
    border: none;
    color: var(--text-dark-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.close-sheet-btn:hover {
    color: var(--text-white);
}

/* Floating Compile Bar */
.floating-compile-bar {
    position: absolute;
    bottom: 110px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    z-index: 25;
    padding: 0 20px;
    animation: fadeIn 0.2s ease;
}

/* Compile Overlay */
.compile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.3s ease;
}

.compile-status-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-dim);
    border-radius: 20px;
    padding: 32px;
    width: 90%;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    animation: scaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.compile-status-card h3 {
    margin: 0;
    font-size: 1.3rem;
    color: var(--text-white);
    font-weight: 600;
}

.compile-status-card p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-dark-muted);
}

/* Modern Spinner */
.spinner-modern {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(35, 134, 54, 0.15);
    border-top: 4px solid var(--brand-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar-fill {
    height: 100%;
    background: var(--brand-accent);
    border-radius: 3px;
    transition: width 0.2s ease;
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Capacity Meter */
.capacity-meter-container {
    background: var(--glass-bg);
    border-bottom: 1px solid var(--border-dim);
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 5;
}

.capacity-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 600;
}

.capacity-title {
    color: var(--text-dark-muted);
}

.capacity-value {
    color: var(--text-white);
}

.capacity-value.healthy {
    color: var(--brand-accent);
}

.capacity-value.warning {
    color: #f0883e;
}

.capacity-value.critical {
    color: #f85149;
}

.capacity-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    overflow: hidden;
}

.capacity-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.capacity-fill.healthy {
    background: var(--brand-accent);
}

.capacity-fill.warning {
    background: #f0883e;
}

.capacity-fill.critical {
    background: #f85149;
}

.capacity-warning {
    font-size: 0.7rem;
    color: #f85149;
    font-weight: 500;
}

/* Editor Alert Banner */
.editor-alert-banner {
    background: rgba(248, 81, 73, 0.12);
    border: 1px solid rgba(248, 81, 73, 0.25);
    border-radius: 8px;
    padding: 12px 16px;
    margin: 16px 20px 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    color: #ff7b72;
    font-size: 0.85rem;
    line-height: 1.4;
    z-index: 10;
    animation: fadeIn 0.2s ease;
}

.alert-content {
    display: flex;
    align-items: flex-start;
}

.alert-close {
    background: none;
    border: none;
    color: #ff7b72;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.alert-close:hover {
    opacity: 1;
}

/* iOS Safe Area & Time Calc Styles */
.time-calc-layout {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    background-color: var(--bg-darker);
    color: var(--text-white);
    padding-top: env(safe-area-inset-top, 20px);
    padding-bottom: env(safe-area-inset-bottom, 20px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
}

.network-alert-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    z-index: 100;
    transition: all 0.3s ease;
}

.network-alert-banner.offline {
    background-color: rgba(248, 81, 73, 0.95);
    color: #fff;
    border-bottom: 1px solid rgba(248, 81, 73, 0.4);
}

.network-alert-banner.online {
    background-color: rgba(35, 134, 54, 0.95);
    color: #fff;
    border-bottom: 1px solid rgba(35, 134, 54, 0.4);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.pulse-dot.red {
    background: #ff4d4d;
    box-shadow: 0 0 8px #ff4d4d;
    animation: pulse 1.5s infinite;
}

.pulse-dot.green {
    background: #2ecc71;
    box-shadow: 0 0 8px #2ecc71;
}

@keyframes pulse {
    0% { transform: scale(0.9); opacity: 0.6; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.6; }
}

.dma-fallback-banner {
    background-color: rgba(240, 136, 62, 0.15);
    border: 1px solid rgba(240, 136, 62, 0.3);
    border-radius: 12px;
    margin: 12px 16px;
    padding: 12px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: #f0883e;
    font-size: 0.85rem;
    position: relative;
    animation: fadeIn 0.3s ease;
}

.dma-icon {
    font-size: 1.5rem;
}

.dma-text {
    flex: 1;
    line-height: 1.4;
}

.dma-close {
    background: none;
    border: none;
    color: #f0883e;
    font-size: 1rem;
    cursor: pointer;
    opacity: 0.7;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-dim);
}

.btn-back {
    background: none;
    border: none;
    color: var(--text-white);
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-titles h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.header-titles p {
    margin: 4px 0 0 0;
    font-size: 0.8rem;
    color: var(--text-dark-muted);
}

.badge-persistent .status-indicator {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-persistent .status-indicator.active {
    background: rgba(35, 134, 54, 0.15);
    color: #2ea043;
}

.badge-persistent .status-indicator.pending {
    background: rgba(240, 136, 62, 0.15);
    color: #f0883e;
}

.app-main-content {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.card {
    background: var(--bg-panel);
    border: 1px solid var(--border-dim);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.location-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
}

.location-status.ok {
    background: rgba(35, 134, 54, 0.15);
    color: #2ea043;
}

.location-status.warn {
    background: rgba(248, 81, 73, 0.15);
    color: #ff7b72;
}

.leaflet-map-container {
    height: 180px;
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border-dim);
    z-index: 1;
}

.map-controls {
    display: flex;
    gap: 8px;
}

.btn-secondary {
    flex: 1;
    background: rgba(255,255,255,0.05);
    color: var(--text-white);
    border: 1px solid var(--border-dim);
    border-radius: 8px;
    padding: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:active {
    background: rgba(255,255,255,0.1);
}

.verification-desc {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-dark-muted);
    line-height: 1.4;
}

.camera-verification-zone {
    border: 2px dashed var(--border-dim);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(0,0,0,0.1);
    position: relative;
}

.selfie-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-dark-muted);
    font-size: 0.85rem;
}

.selfie-preview-container {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--brand-accent);
    position: relative;
}

.selfie-preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-clear-photo {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    font-size: 0.7rem;
    padding: 4px 0;
    cursor: pointer;
}

.hidden-input {
    display: none;
}

.btn-camera-trigger {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-dim);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-white);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.btn-clock-in {
    background: var(--brand-accent);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(35, 134, 54, 0.3);
    transition: all 0.2s;
}

.btn-clock-in:disabled {
    background: var(--border-dim);
    color: var(--text-dark-muted);
    box-shadow: none;
    cursor: not-allowed;
}

.clock-in-reason {
    font-size: 0.75rem;
    color: #ff7b72;
    text-align: center;
    font-weight: 500;
}

.section-subtitle {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-dark-muted);
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 250px;
    overflow-y: auto;
}

.empty-list {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-dark-muted);
    padding: 20px 0;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: rgba(0,0,0,0.15);
    border: 1px solid var(--border-dim);
    border-radius: 10px;
}

.item-selfie-thumbnail {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--border-dim);
}

.item-selfie-thumbnail.empty-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: var(--bg-darker);
}

.item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.item-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

.item-time {
    font-weight: 600;
}

.item-coords {
    color: var(--text-dark-muted);
}

.badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.badge.synced {
    background: rgba(35, 134, 54, 0.15);
    color: #2ea043;
}

.badge.skipped {
    background: rgba(255,255,255,0.08);
    color: var(--text-dark-muted);
}

.badge.failed {
    background: rgba(248, 81, 73, 0.15);
    color: #ff7b72;
}

.badge.pending-sync {
    background: rgba(240, 136, 62, 0.15);
    color: #f0883e;
}

.sync-actions-group {
    display: flex;
    gap: 4px;
}

.btn-sync-retry {
    background: var(--brand-accent);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 8px;
    cursor: pointer;
}

.btn-sync-skip {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-white);
    border: 1px solid var(--border-dim);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 8px;
    cursor: pointer;
}

/* SkyDrop Global Drag & Drop Overlay */
.global-drag-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.global-drag-overlay.active {
    display: flex !important;
}

.drag-modal {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 40px;
    border: 3px dashed #007aff;
    border-radius: 28px;
    background: rgba(28, 28, 30, 0.95);
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 122, 255, 0.3);
}

.drag-icon {
    font-size: 3.5rem;
}

.drag-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
}

.drag-subtitle {
    font-size: 1rem;
    color: #8e8e93;
}




