/* ==========================================================================
   Thane Change Detection / Street View Template Generator - Application Styles
   ========================================================================== */

:root {
    --bg-app: #0b0f19;
    --bg-surface: #131b2e;
    --bg-surface-elevated: #1a243d;
    --bg-input: #1f2b48;
    --border-color: #2a385c;
    --border-highlight: #3b82f6;
    
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --color-primary: #3b82f6;
    --color-primary-hover: #2563eb;
    --color-success: #10b981;
    --color-success-hover: #059669;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #06b6d4;
    --color-purple: #8b5cf6;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    
    --shadow-soft: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
    --shadow-glow-active: 0 0 0 3px rgba(245, 158, 11, 0.4), 0 0 25px rgba(245, 158, 11, 0.3);
    
    --transition-speed: 0.2s;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Top Navigation
   ========================================================================== */
.app-navbar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    font-size: 26px;
    background: var(--bg-surface-elevated);
    padding: 6px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.brand-title {
    font-family: 'Outfit', sans-serif;
    font-size: 17px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.01em;
}

.brand-sub {
    font-size: 11px;
    color: var(--text-muted);
}

/* Property Switcher */
.nav-property-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface-elevated);
    padding: 4px 8px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.nav-btn-icon {
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    font-size: 14px;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-speed);
}

.nav-btn-icon:hover:not(:disabled) {
    background: var(--bg-input);
    color: var(--color-warning);
}

.nav-btn-icon:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.search-box-wrapper {
    position: relative;
    width: 240px;
}

.property-search-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px 12px;
    font-size: 13px;
    color: #ffffff;
    font-family: inherit;
    font-weight: 600;
    outline: none;
    transition: var(--transition-speed);
}

.property-search-input:focus {
    border-color: var(--color-warning);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    max-height: 260px;
    overflow-y: auto;
    z-index: 200;
    display: none;
    box-shadow: var(--shadow-soft);
}

.search-dropdown.open {
    display: block;
}

.search-item {
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.search-item:hover {
    background: var(--color-primary);
    color: #fff;
}

.search-item .sr-tag {
    font-size: 11px;
    color: var(--text-dim);
}

.nav-counter {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-warning);
    min-width: 75px;
    text-align: center;
}

/* ==========================================================================
   Link Redirect Buttons (Google Maps & 360 View)
   ========================================================================== */
.nav-links-toolbar {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn-redirect-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    text-decoration: none;
}

.btn-google-link {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.3);
}

.btn-google-link:hover {
    background: rgba(16, 185, 129, 0.25);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

.btn-360-link {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    border-color: rgba(139, 92, 246, 0.3);
}

.btn-360-link:hover {
    background: rgba(139, 92, 246, 0.25);
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.3);
}

.btn-redirect-link.no-link {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-redirect-link.has-link {
    opacity: 1;
}

.btn-link-icon {
    font-size: 13px;
}

.btn-link-text {
    font-size: 11px;
    font-weight: 700;
}

.btn-link-ext {
    font-size: 11px;
    opacity: 0.7;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-primary {
    background: var(--color-primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.btn-success {
    background: var(--color-success);
    color: #fff;
}

.btn-success:hover {
    background: var(--color-success-hover);
}

.btn-info {
    background: var(--color-info);
    color: #fff;
}

.btn-info:hover {
    background: #0891b2;
}

.btn-warning {
    background: var(--color-warning);
    color: #000;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-danger {
    background: var(--color-danger);
    color: #fff;
}

.btn-secondary {
    background: var(--bg-surface-elevated);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-input);
    color: var(--text-main);
}

.btn-outline {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    background: var(--bg-surface-elevated);
    color: var(--text-main);
    border-color: var(--text-dim);
}

.btn-outline-light {
    background: transparent;
    color: var(--text-main);
    border: 1px solid rgba(255,255,255,0.18);
}

.btn-outline-light:hover {
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.3);
}

.btn-done {
    background: linear-gradient(135deg, #34d399, #10b981);
    color: #000;
    font-weight: 700;
}

.btn-done:hover {
    background: linear-gradient(135deg, #6ee7b7, #34d399);
    box-shadow: 0 2px 12px rgba(16, 185, 129, 0.4);
}

.btn-group {
    display: inline-flex;
    gap: 3px;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 11px;
}

.btn-xs {
    padding: 3px 8px;
    font-size: 11px;
    border-radius: 4px;
}

.btn-icon {
    padding: 4px 8px;
    font-size: 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface-elevated);
    color: var(--text-main);
}

.btn-icon:hover {
    background: var(--bg-input);
}

/* ==========================================================================
   Main Layout
   ========================================================================== */
.app-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar-panel {
    width: 340px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.canvas-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ==========================================================================
   Card Components
   ========================================================================== */
.card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.section-card {
    padding: 14px;
}

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

.card-header h2 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
}

.header-with-badge {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(59, 130, 246, 0.2);
    color: var(--color-primary);
    border: 1px solid rgba(59, 130, 246, 0.3);
    text-transform: uppercase;
}

.badge-satellite {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.3);
}

.badge-ground {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.3);
}

/* ==========================================================================
   Form Controls
   ========================================================================== */
.form-group {
    margin-bottom: 10px;
}

.form-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-group label .req {
    color: var(--color-danger);
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    color: #ffffff;
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.highlight-input {
    font-weight: 700;
    font-size: 15px;
    color: var(--color-warning);
}

.form-control.readonly-lock {
    background: rgba(15, 23, 42, 0.55) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    cursor: not-allowed;
    user-select: text;
    box-shadow: none !important;
    opacity: 0.9;
}

.form-control.readonly-lock:focus {
    border-color: rgba(255, 255, 255, 0.08) !important;
    box-shadow: none !important;
}

.form-row {
    display: flex;
    gap: 10px;
}

.form-row .col {
    flex: 1;
}

.section-hint {
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 10px;
}

/* Switch / Toggle */
.switch-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.switch-label input[type="checkbox"] {
    display: none;
}

.switch-slider {
    width: 36px;
    height: 20px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    position: relative;
    transition: all 0.2s;
}

.switch-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: var(--text-dim);
    border-radius: 50%;
    transition: all 0.2s;
}

.switch-label input[type="checkbox"]:checked + .switch-slider {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.switch-label input[type="checkbox"]:checked + .switch-slider::after {
    left: 18px;
    background: #fff;
}

/* Quick Year Chips */
.quick-years-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.quick-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.quick-year-chip {
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    background: var(--bg-input);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.15s;
}

.quick-year-chip:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--color-primary);
    color: #60a5fa;
}

/* ==========================================================================
   Sidebar Slot List
   ========================================================================== */
.slot-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-slot-item {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    cursor: pointer;
    transition: all 0.15s;
}

.sidebar-slot-item:hover {
    border-color: var(--text-dim);
}

.sidebar-slot-item.active-slot {
    border-color: var(--color-warning);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
    background: rgba(245, 158, 11, 0.06);
}

.sidebar-slot-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.slot-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 60px;
}

.slot-year-input {
    width: 56px;
    padding: 3px 6px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    color: var(--color-warning);
    text-align: center;
    outline: none;
}

.slot-year-input:focus {
    border-color: var(--color-warning);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.slot-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.btn-delete-slot {
    color: #ef4444 !important;
}

.btn-delete-slot:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    border-color: #ef4444 !important;
}

/* ==========================================================================
   Sidebar Links Card
   ========================================================================== */
.sidebar-links-card {
    margin-top: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px;
}

.sidebar-links-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.sidebar-links-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-main);
    text-transform: uppercase;
}

.links-indicator {
    font-size: 10px;
    font-weight: 700;
    color: #34d399;
}

.links-indicator.empty {
    color: var(--text-dim);
}

.sidebar-links-actions {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.w-100 {
    flex: 1;
}

.sidebar-links-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.link-item-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
}

.link-item-tag {
    font-weight: 700;
    color: var(--text-dim);
    min-width: 50px;
}

.link-item-url {
    color: var(--text-muted);
    cursor: pointer;
    word-break: break-all;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.link-item-url:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

/* ==========================================================================
   Server Status Card
   ========================================================================== */
.server-stats-grid {
    display: flex;
    gap: 8px;
}

.stat-box {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    transition: all 0.15s;
}

.stat-box:hover {
    border-color: var(--color-primary);
    background: rgba(59, 130, 246, 0.06);
}

.stat-count {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-main);
}

.stat-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stat-path {
    font-size: 9px;
    color: var(--text-dim);
}

/* ==========================================================================
   Canvas Panel
   ========================================================================== */
.canvas-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 16px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
}

.toolbar-left, .toolbar-center, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.paste-hint {
    font-size: 11px;
    color: var(--text-dim);
}

.paste-hint b {
    color: var(--text-muted);
}

kbd {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    padding: 0 4px;
    font-size: 11px;
    font-family: monospace;
    color: var(--text-main);
}

.canvas-links-bar {
    display: flex;
    gap: 6px;
}

.btn-canvas-link {
    font-size: 10px;
    padding: 3px 8px;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.zoom-level {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 40px;
    text-align: center;
}

/* Viewport for centering & panning template */
.canvas-viewport {
    flex: 1;
    overflow: auto;
    padding: 40px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: #181920;
    background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
}

/* ==========================================================================
   THE TEMPLATE DOCUMENT (Thane Change Detection / Street View design)
   ========================================================================== */
.template-document {
    width: 960px;
    background: #ffffff;
    color: #000000;
    font-family: Arial, Helvetica, sans-serif;
    /* Formal crisp outer black border as shown in reference design */
    border: 2px solid #000000;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    position: relative;
    transform-origin: top center;
    transition: transform 0.15s ease-out;
    padding: 10px 12px 14px 12px;
    box-sizing: border-box;
}

/* Header Section: Centered Yellow Title Box & Top-Right Compass */
.template-header-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 10px;
    min-height: 44px;
}

.template-title-box {
    background: #FFFFD4;
    border: 1.5px solid #000000;
    padding: 4px 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.template-title-text {
    font-family: 'Times New Roman', Times, serif;
    font-size: 23px;
    font-weight: bold;
    color: #b80000;
    letter-spacing: 0.8px;
    text-align: center;
    line-height: 1.2;
}

.template-compass-box {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.north-arrow-svg {
    width: 38px;
    height: 38px;
    display: block;
}

/* Template Image Rows: 2 rows with gap between rows and between columns */
.template-row {
    display: flex;
    width: 100%;
    gap: 10px;
    margin-bottom: 10px;
    background: transparent;
    border: none;
    box-sizing: border-box;
}

.row-ground {
    margin-bottom: 0;
}

/* Row hidden when no ground images */
.template-row.row-hidden {
    display: none !important;
}

/* Individual Image Cell: Fixed 285px height with black border */
.template-slot-cell {
    flex: 1 1 0;
    min-width: 0;
    height: 285px;
    max-height: 285px;
    min-height: 285px;
    box-sizing: border-box;
    position: relative;
    border: 1.5px solid #000000;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    transition: outline 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

/* Image inside slot: FIXED FIT */
.template-slot-cell img.slot-image {
    width: 100%;
    height: 100%;
    object-fit: fill; /* Fits the fixed section completely */
    display: block;
    margin: 0;
    padding: 0;
    border: none;
}

.template-slot-cell.fit-cover img.slot-image {
    object-fit: cover;
}

/* Year Badge on Image: Light Pink / Lilac fill with bold black stroke as in reference */
.slot-corner-year {
    position: absolute;
    top: 8px;
    left: 10px;
    font-family: 'Arial Black', Impact, Arial, sans-serif;
    font-size: 32px;
    font-weight: 900;
    line-height: 1;
    color: #F8B4DC;
    -webkit-text-stroke: 1.5px #000000;
    text-shadow: 
        -1.5px -1.5px 0 #000,
         1.5px -1.5px 0 #000,
        -1.5px  1.5px 0 #000,
         1.5px  1.5px 0 #000,
         0px   -1.5px 0 #000,
         0px    1.5px 0 #000,
        -1.5px  0px   0 #000,
         1.5px  0px   0 #000;
    z-index: 5;
    cursor: pointer;
    user-select: none;
    letter-spacing: 0.5px;
}

.slot-corner-year:hover {
    background: rgba(255, 255, 0, 0.8);
    -webkit-text-stroke: 1px #000;
    color: #000;
    text-shadow: none;
    border-radius: 4px;
}

/* Empty Placeholder Slot: strictly respects the 285px fixed height */
.slot-empty-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px;
    text-align: center;
    color: #94a3b8;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    background: #f8fafc;
    transition: var(--transition-speed);
}

.placeholder-icon {
    font-size: 32px;
    opacity: 0.7;
}

.placeholder-main {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.placeholder-sub {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    color: #94a3b8;
}

.placeholder-year-badge {
    font-family: 'Arial Black', Impact, sans-serif;
    font-size: 20px;
    font-weight: 900;
    color: #F8B4DC;
    -webkit-text-stroke: 1px #000;
    background: #f1f5f9;
    padding: 2px 10px;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
}

/* ACTIVE SLOT HIGHLIGHT (When ready to paste Ctrl+V) */
.template-slot-cell.active-paste-slot {
    outline: 3px solid #f59e0b !important;
    outline-offset: -3px;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.5) !important;
    z-index: 10;
}

.template-slot-cell.active-paste-slot .slot-empty-placeholder {
    border-color: #f59e0b;
    background: #fffbeb;
}

.template-slot-cell.active-paste-slot .placeholder-main {
    color: #b45309;
}

/* Slot Hover Overlay Actions */
.slot-hover-controls {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 6;
}

.template-slot-cell:hover .slot-hover-controls {
    opacity: 1;
}

.slot-ctrl-btn {
    background: rgba(0, 0, 0, 0.75);
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.12s;
}

.slot-ctrl-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(255,255,255,0.5);
}

/* ==========================================================================
   Template Footer Block (BUILD ID on left, NAME at the middle with wrapping)
   ========================================================================== */
.template-footer-block {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 10px;
    padding: 10px 4px 6px 4px;
    background: #ffffff;
    font-family: Arial, Helvetica, sans-serif;
    box-sizing: border-box;
    width: 100%;
    min-height: 34px;
}

.footer-left {
    flex: 1 1 0;
    width: calc(50% - 5px);
    max-width: calc(50% - 5px);
    min-width: 0;
    box-sizing: border-box;
    line-height: 1.3;
}

/* NAME section starts at the middle of the template (aligned with second column) */
.footer-right {
    flex: 1 1 0;
    width: calc(50% - 5px);
    max-width: calc(50% - 5px);
    min-width: 0;
    box-sizing: border-box;
    line-height: 1.3;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.footer-label {
    font-size: 19px;
    font-weight: 800;
    color: #000000;
    letter-spacing: 0.3px;
    white-space: nowrap;
    display: inline;
    line-height: 1.3;
}

.footer-value {
    font-size: 19px;
    font-weight: 800;
    color: #000000;
    letter-spacing: 0.3px;
    cursor: pointer;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    display: inline;
    line-height: 1.3;
}

.footer-value:hover {
    outline: 1px dashed #3b82f6;
}

/* ==========================================================================
   Floating Action Bar
   ========================================================================== */
.floating-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    gap: 12px;
}

.active-slot-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--color-warning);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.floating-buttons {
    display: flex;
    gap: 6px;
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
}

.modal-dialog {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
}

.modal-close-btn:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--color-primary);
    background: rgba(59, 130, 246, 0.04);
}

.drop-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.drop-zone h4 {
    font-size: 14px;
    color: var(--text-main);
    margin-bottom: 6px;
}

.drop-zone p {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.drop-hint {
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 12px;
}

.modal-excel-meta {
    margin-top: 14px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
}

.file-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.file-name {
    font-weight: 700;
    font-size: 13px;
    color: var(--text-main);
}

.file-count {
    font-size: 12px;
    color: var(--color-success);
    font-weight: 600;
}

/* Abstract Summary Grid */
.abstract-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.abstract-stat-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    text-align: center;
}

.stat-card-wide {
    grid-column: span 2;
}

.abstract-stat-num {
    display: block;
    font-size: 24px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 2px;
}

.abstract-stat-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}

.text-success { color: var(--color-success); }
.text-satellite { color: #60a5fa; }
.text-ground { color: #fbbf24; }
.text-warning { color: var(--color-warning); }

.excel-preview-info {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
}

.columns-pill-list code {
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-muted);
    margin: 2px;
    display: inline-block;
}

/* ==========================================================================
   Loading Overlay
   ========================================================================== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.active {
    display: flex;
}

.spinner-container {
    text-align: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-title {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 4px;
}

.loading-sub {
    font-size: 12px;
    color: var(--text-muted);
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-container {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-soft);
    animation: slideIn 0.25s ease-out;
    max-width: 400px;
}

.toast.success {
    border-left: 3px solid var(--color-success);
}

.toast.error {
    border-left: 3px solid var(--color-danger);
}

.toast.warning {
    border-left: 3px solid var(--color-warning);
}

.toast.info {
    border-left: 3px solid var(--color-info);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
