/* ==========================================================================
   Excel Compare Tool — v5.0.0
   Clean Layout, White Background, Smooth Hover Animations
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

.ec-app {
    --ec-font: 'Inter', -apple-system, sans-serif;
    
    /* Layout Colors - Pure White Base */
    --ec-bg-app: #ffffff;
    --ec-bg-surface: #ffffff;
    --ec-bg-alt: #f8fafc;
    --ec-border: #e2e8f0;
    
    /* Text Colors */
    --ec-text: #215387;
    --ec-text-muted: #64748b;
    
    /* Button Colors */
    --ec-btn-dark: #215387;
    --ec-btn-dark-hover: #1b4570;
    --ec-btn-teal: #0d9488;
    --ec-btn-teal-hover: #0f766e;
    --ec-btn-grey: #f1f5f9;
    --ec-btn-grey-hover: #e2e8f0;
    --ec-btn-danger: #fee2e2;
    --ec-btn-danger-hover: #fecaca;
    --ec-danger-text: #b91c1c;

    /* Highlight (Yellow) */
    --ec-hi-bg: #fef08a;     /* Yellow 200 */
    --ec-hi-text: #854d0e;   /* Yellow 800 */
    
    /* Dimensions */
    --ec-radius: 8px;
    --ec-shadow-card: 0 4px 6px -1px rgba(0,0,0,0.05);
    --ec-shadow-hover: 0 6px 14px rgba(0,0,0,0.12);
    --ec-shadow-modal: 0 20px 25px -5px rgba(0,0,0,0.2);
}

.ec-app[data-theme="dark"] {
    --ec-bg-app: #0f172a;
    --ec-bg-surface: #1e293b;
    --ec-bg-alt: #0f172a;
    --ec-border: #334155;
    --ec-text: #f8fafc;
    --ec-text-muted: #94a3b8;
    
    /* Tools / Buttons in Dark Mode tuned for high contrast */
    --ec-btn-dark: #cbd5e1;
    --ec-btn-dark-hover: #f8fafc;
    --ec-btn-grey: #215387;
    --ec-btn-grey-hover: #1b4570;
    --ec-btn-teal: #14b8a6;
    --ec-btn-teal-hover: #2dd4bf;
    --ec-btn-danger: #7f1d1d;
    --ec-btn-danger-hover: #991b1b;
    --ec-danger-text: #fecaca;
    
    --ec-hi-bg: #854d0e;
    --ec-hi-text: #fef08a;
    --ec-shadow-hover: 0 6px 14px rgba(0,0,0,0.5);
}

.ec-app * { box-sizing: border-box; }
.ec-app {
    font-family: var(--ec-font);
    background: var(--ec-bg-app);
    color: var(--ec-text);
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-radius: var(--ec-radius);
    overflow: hidden;
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}
/* For dark mode text colors in app elements */
.ec-app[data-theme="dark"] .ec-btn-dark { color: #0f172a; }

/* Base Buttons */
.ec-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    font-family: var(--ec-font); font-size: 0.85rem; font-weight: 600;
    padding: 10px 18px; border-radius: 6px; border: none; cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0);
    white-space: nowrap;
}
.ec-btn:disabled { opacity: 0.5; pointer-events: none; }
.ec-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--ec-shadow-hover);
}
.ec-btn-dark { background: #215387; color: #ffffff; }
.ec-btn-dark:hover { background: #1b4570; }
.ec-app[data-theme="dark"] .ec-btn-dark { background: #215387; color: #e2e8f0; }
.ec-app[data-theme="dark"] .ec-btn-dark:hover { background: #1b4570; color: #ffffff; }
.ec-btn-teal { background: var(--ec-btn-teal); color: #fff; }
.ec-btn-teal:hover { background: var(--ec-btn-teal-hover); }
.ec-btn-grey { background: var(--ec-btn-grey); color: var(--ec-text); border: 1px solid var(--ec-border); }
.ec-btn-grey:hover { background: var(--ec-btn-grey-hover); }
.ec-btn-danger { background: var(--ec-btn-danger); color: var(--ec-danger-text); border: 1px solid var(--ec-border); }
.ec-btn-danger:hover { background: var(--ec-btn-danger-hover); }
.ec-btn-full { width: 100%; padding: 12px; font-size: 0.95rem; }

/* (Dark Toggle Button removed — theme auto-synced with Kadence .color-switch-dark) */


/* Top Actions Row */
.ec-top-actions {
    display: flex; justify-content: space-between; align-items: center; width: 100%;
    padding: 24px 30px; border-bottom: 1px solid var(--ec-border);
    background: var(--ec-bg-surface); gap: 16px;
}
.ec-action-col { display: flex; align-items: center; flex: 1; }
.ec-action-col-left { justify-content: flex-start; }
.ec-action-col-center { justify-content: center; }
.ec-action-col-right { justify-content: flex-end; }

/* Bottom Actions Row */
.ec-bottom-actions {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 30px; width: 100%; 
    background: var(--ec-bg-surface); border-radius: 0 0 12px 12px;
}

.ec-btn-pulse { font-size: 1.05rem; padding: 12px 36px; border-radius: 30px; transition: all 0.3s ease; }
#ec-compare-btn:disabled {
    opacity: 0.85;
    background-color: #215387 !important;
    cursor: not-allowed;
}
#ec-compare-btn:not(:disabled):hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 16px rgba(33, 83, 135, 0.4);
    background-color: #1b4570;
}

/* Custom Header Toggle Button */
.ec-toggle-btn {
    display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
    background: transparent; padding: 10px 16px; border-radius: 6px;
    border: none; font-size: 0.85rem; font-weight: 600;
    color: var(--ec-text); transition: all 0.2s;
}
.ec-toggle-btn:hover { background: var(--ec-bg-alt); border-color: var(--ec-text-muted); }
.ec-toggle-box {
    display: flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; border: 1.5px solid var(--ec-text-muted); border-radius: 4px;
    background: var(--ec-bg-surface); transition: all 0.2s;
}
.ec-chk-icon { opacity: 0; stroke: #fff; }
.ec-toggle-btn input:checked + .ec-toggle-box {
    background: var(--ec-btn-teal); border-color: var(--ec-btn-teal);
}
.ec-toggle-btn input:checked + .ec-toggle-box .ec-chk-icon { opacity: 1; }

/* iOS Toggles (Inline Version) */
.ec-toggle-inline {
    display: flex; align-items: center; gap: 10px; cursor: pointer;
    background: var(--ec-bg-alt); padding: 8px 14px; border-radius: 20px;
    border: 1px solid var(--ec-border);
}
.ec-toggle-name { font-size: 0.85rem; font-weight: 600; color: var(--ec-text); }
.ec-switch { position: relative; width: 44px; height: 24px; flex-shrink:0; }
.ec-switch input { opacity: 0; width: 0; height: 0; position:absolute; }
.ec-slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1; transition: .4s; border-radius: 24px;
}
.ec-app[data-theme="dark"] .ec-slider { background-color: #475569; }
.ec-slider:before {
    position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px;
    background-color: white; transition: .4s; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.ec-switch input:checked + .ec-slider { background-color: var(--ec-btn-teal); }
.ec-switch input:checked + .ec-slider:before { transform: translateX(20px); }

/* Workspace Canvas */
.ec-workspace {
    flex: 1; display: flex; flex-direction: column;
    background: var(--ec-bg-surface); min-width: 0;
    overflow-x: auto;
}

.ec-swap-btn { background: #215387; border: none; cursor: pointer; color: #f8fafc; padding: 10px 16px; border-radius: 30px; display: inline-flex; align-items: center; gap: 6px; transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); }
.ec-swap-btn:active { background: #f8fafc; color: #215387; transform: rotate(180deg) scale(1.1); box-shadow: 0 4px 8px rgba(0,0,0,0.15); }

.ec-exports { display: flex; gap: 12px; }
.ec-btn-dark-light {
    background: #215387; border: none; font-size: 0.85rem; color: #f8fafc;
    font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 6px;
    transition: all 0.2s;
}
.ec-btn-dark-light:hover:not(:disabled) { background: #f8fafc; color: #215387; transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.ec-btn-dark-light:disabled { opacity: 0.4; }
.ec-app[data-theme="dark"] .ec-btn-dark-light { background: #cbd5e1; color: #215387; }
.ec-app[data-theme="dark"] .ec-btn-dark-light:hover:not(:disabled) { background: #215387; color: #f8fafc; }

/* Dropdown Container */
.ec-dropdown-container {
    position: relative;
    display: inline-block;
}

/* Caret Icon */
.ec-caret {
    margin-left: 6px;
    transition: transform 0.2s ease;
}
.ec-dropdown-container.ec-open .ec-caret {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.ec-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 100;
    min-width: 190px;
    background: var(--ec-bg-surface);
    border: 1px solid var(--ec-border);
    border-radius: var(--ec-radius);
    box-shadow: var(--ec-shadow-modal);
    padding: 6px 0;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.ec-dropdown-container.ec-open .ec-dropdown-menu {
    display: flex !important;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Dropdown Item */
.ec-dropdown-item {
    width: 100%;
    border: none;
    background: transparent;
    padding: 10px 16px;
    font-family: var(--ec-font);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ec-text);
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s, color 0.2s;
}

.ec-dropdown-item svg {
    flex-shrink: 0;
    color: var(--ec-text-muted);
    transition: color 0.2s;
}

.ec-dropdown-item:hover {
    background-color: var(--ec-bg-alt);
    color: var(--ec-btn-teal);
}

.ec-dropdown-item:hover svg {
    color: var(--ec-btn-teal);
}

/* Align dropdown items in dark mode correctly */
.ec-app[data-theme="dark"] .ec-dropdown-item:hover {
    background-color: #334155;
    color: #2dd4bf;
}
.ec-app[data-theme="dark"] .ec-dropdown-item:hover svg {
    color: #2dd4bf;
}

/* Upload Section */
.ec-upload-section {
    display: flex; flex-direction: row; flex-wrap: nowrap; gap: 12px;
    padding: 24px 16px; width: 100%; box-sizing: border-box;
}
.ec-upload-zone {
    flex: 1; min-width: 0; background: #e8f4fd; border: 2px dashed #2e75b6; border-radius: 12px;
    text-align: center; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); position: relative;
    display: flex; flex-direction: column; min-height: 300px;
}
.ec-app[data-theme="dark"] .ec-upload-zone { border-color: #4a8abf; background: #1a2e40; }
.ec-upload-zone:hover { border-color: #2566a3; background: #b5d6f0; transform: translateY(-4px); box-shadow: var(--ec-shadow-hover); }
.ec-upload-zone.ec-dragover { border-color: #2566a3; background: #b5d6f0; }
.ec-upload-zone.ec-has-file { border: 1px solid var(--ec-btn-teal); background: var(--ec-bg-surface); padding: 0; transform: translateY(0); box-shadow: var(--ec-shadow-card); }
.ec-upload-zone.ec-has-file:hover { transform: translateY(0); box-shadow: var(--ec-shadow-card); }
.ec-upload-inner { padding: 56px 28px; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; position: relative; }
.ec-upload-inner * { pointer-events: none; }
.ec-upload-inner .ec-file-input { pointer-events: auto; }
.ec-upload-icon { margin-bottom: 24px; transition: transform 0.3s; }
.ec-state-empty:hover .ec-upload-icon { transform: scale(1.05); }
.ec-upload-title { font-size: 1.15rem; margin: 0 0 8px; font-weight: 700; color: var(--ec-text); }
.ec-upload-desc { font-size: 0.9rem; color: var(--ec-text-muted); margin: 0; }
.ec-btn-browse { margin-top: 24px; border: 1px solid var(--ec-btn-dark) !important; }
.ec-file-input { position: absolute; top:0; left:0; width:100%; height:100%; opacity:0; cursor:pointer; z-index: 10; }
.ec-state-empty { width: 100%; height: 100%; display: flex; flex-direction: column; }
.ec-state-filled { width: 100%; height: 100%; display: flex; flex-direction: column; text-align: left; border-radius: 11px; overflow: hidden; background: var(--ec-bg-surface); }
.ec-file-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--ec-border); min-width: 0; }
.ec-file-info { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.ec-file-icon { width: 32px; height: 32px; background: #6ee7b7; color: #064e3b; display: flex; align-items: center; justify-content: center; border-radius: 4px; flex-shrink: 0; }
.ec-file-names { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.ec-filename { font-weight: 600; font-size: 0.9rem; color: var(--ec-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ec-filesize { font-size: 0.75rem; color: var(--ec-text-muted); }
.ec-file-remove { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--ec-text-muted); padding: 4px; transition: color 0.2s; display:flex; align-items:center; flex-shrink: 0; }
.ec-file-remove:hover { color: var(--ec-danger-text); }
.ec-file-preview { flex: 1; padding: 16px; background: var(--ec-bg-alt); display:flex; flex-direction:column; min-height: 200px; max-height: 300px; }
.ec-preview-scroll { flex:1; overflow: scroll; border: 1px solid var(--ec-border); border-radius: 6px; background: var(--ec-bg-surface); }
.ec-preview-table { width: max-content; min-width: 100%; border-collapse: collapse; table-layout: auto; }
.ec-preview-table th { background: #e2e8f0; color: var(--ec-text-muted); padding: 6px; font-size: 0.75rem; border-right: 1px solid var(--ec-border); border-bottom: 1px solid var(--ec-border); text-align: center; font-weight: 600; position: sticky; top: 0; z-index: 2; }
.ec-preview-table td { padding: 8px; font-size: 0.8rem; border-right: 1px solid var(--ec-border); border-bottom: 1px solid var(--ec-border); color: var(--ec-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.ec-preview-table th, .ec-preview-table td { min-width: 100px; max-width: 250px; }
.ec-preview-table td:first-child { background: #f1f5f9; color: var(--ec-text-muted); font-weight: 600; text-align: center; position: sticky; left: 0; z-index: 3; width: 40px; min-width: 40px; max-width: 40px; border-right: 2px solid var(--ec-border); }
.ec-preview-table th:first-child { position: sticky; left: 0; z-index: 4; background: #e2e8f0; border-right: 2px solid var(--ec-border); }
.ec-app[data-theme="dark"] .ec-preview-table th, .ec-app[data-theme="dark"] .ec-preview-table td:first-child { background: #1e293b; color: #94a3b8; }
.ec-app[data-theme="dark"] .ec-preview-table th:first-child { background: #1e293b; }
.ec-file-footer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--ec-border); background: var(--ec-bg-surface); align-items: center; flex-wrap: wrap; }
.ec-file-control { display: flex; align-items: center; gap: 6px; border: 1px solid var(--ec-border); padding: 4px 8px; border-radius: 6px; font-size: 0.8rem; font-weight: 500; flex: 1; min-width: 100px; justify-content: space-between; }
.ec-file-control span { color: var(--ec-text-muted); }
.ec-file-control select, .ec-file-control input { border: none; background: transparent; font-family: var(--ec-font); font-size: 0.85rem; font-weight: 600; color: var(--ec-text); outline: none; padding: 0; min-width: 60px; cursor: pointer; }
.ec-fake-input { width: 24px; text-align: center; cursor: default !important; }

/* Results Section */
.ec-results-area { display: flex; flex-direction: column; min-height: 0; padding: 24px; }
.ec-result-options {
    display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px;
    background: var(--ec-bg-alt); border: 1px solid var(--ec-border); border-radius: var(--ec-radius); padding: 20px;
}
.ec-toggles-horizontal { display: flex; flex-wrap: wrap; gap: 20px; }
.ec-stats-bar {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    border-bottom: 1px solid var(--ec-border); padding-bottom: 16px;
}
.ec-stat-item { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1rem; white-space: nowrap; }
.ec-stat-diffs { color: var(--ec-btn-teal); }
.ec-legend-text { font-size: 0.85rem; color: var(--ec-text-muted); }

/* Layout Wrapper */
.ec-layout-wrapper {
    display: flex; gap: 16px;
    max-height: 65vh;
    min-height: 280px;
    align-items: stretch;
}

/* Grids */
.ec-grids-wrapper {
    display: flex; gap: 2px; background: var(--ec-border); border: 1px solid var(--ec-border); border-radius: var(--ec-radius);
    flex-shrink: 0; flex: 1; min-width: 0;
}
.ec-grid-panel { flex: 1; background: var(--ec-bg-surface); display: flex; flex-direction: column; min-width: 0; border-radius: calc(var(--ec-radius) - 1px); overflow: hidden; }
.ec-grid-divider { width: 2px; background: var(--ec-border); }
.ec-grid-scroll { overflow: scroll; flex: 1; cursor: grab; position: relative; }
.ec-grid-scroll:active { cursor: grabbing; }

/* Always-visible scrollbar styling */
.ec-preview-scroll::-webkit-scrollbar,
.ec-grid-scroll::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
.ec-sidebar-content::-webkit-scrollbar {
    width: 16px;
    height: 16px;
}
.ec-preview-scroll::-webkit-scrollbar-track,
.ec-grid-scroll::-webkit-scrollbar-track,
.ec-sidebar-content::-webkit-scrollbar-track {
    background: var(--ec-bg-alt);
    border-radius: 5px;
}
.ec-sidebar-content::-webkit-scrollbar-track {
    border-radius: 0;
}
.ec-preview-scroll::-webkit-scrollbar-thumb,
.ec-grid-scroll::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 5px;
    border: 2px solid var(--ec-bg-alt);
}
.ec-sidebar-content::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 8px;
    border: 3px solid var(--ec-bg-alt);
}
.ec-preview-scroll::-webkit-scrollbar-thumb:hover,
.ec-grid-scroll::-webkit-scrollbar-thumb:hover,
.ec-sidebar-content::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}
.ec-sidebar-content::-webkit-scrollbar-button:vertical:decrement {
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%2364748b"><path d="M7 14l5-5 5 5z"/></svg>') no-repeat center center;
    background-size: 16px;
    background-color: var(--ec-bg-alt);
    height: 16px;
}
.ec-sidebar-content::-webkit-scrollbar-button:vertical:increment {
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%2364748b"><path d="M7 10l5 5 5-5z"/></svg>') no-repeat center center;
    background-size: 16px;
    background-color: var(--ec-bg-alt);
    height: 16px;
}
.ec-app[data-theme="dark"] .ec-preview-scroll::-webkit-scrollbar-thumb,
.ec-app[data-theme="dark"] .ec-grid-scroll::-webkit-scrollbar-thumb,
.ec-app[data-theme="dark"] .ec-sidebar-content::-webkit-scrollbar-thumb {
    background: #475569;
}
.ec-app[data-theme="dark"] .ec-preview-scroll::-webkit-scrollbar-thumb:hover,
.ec-app[data-theme="dark"] .ec-grid-scroll::-webkit-scrollbar-thumb:hover,
.ec-app[data-theme="dark"] .ec-sidebar-content::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}
.ec-preview-scroll,
.ec-grid-scroll,
.ec-sidebar-content {
    scrollbar-width: auto;
    scrollbar-color: #94a3b8 var(--ec-bg-alt);
}
.ec-app[data-theme="dark"] .ec-preview-scroll,
.ec-app[data-theme="dark"] .ec-grid-scroll,
.ec-app[data-theme="dark"] .ec-sidebar-content {
    scrollbar-color: #475569 var(--ec-bg-alt);
}
.ec-grid-scroll table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; table-layout: auto; }
.ec-grid-scroll th {
    position: sticky; top: 0; z-index: 2; background: var(--ec-bg-alt); font-size: 0.8rem;
    font-weight: 600; padding: 12px 10px; border-bottom: 2px solid var(--ec-border);
    border-right: 1px solid var(--ec-border); color: var(--ec-text-muted); text-align: center;
}
.ec-grid-scroll td {
    padding: 10px; font-size: 0.85rem; border-bottom: 1px solid var(--ec-border);
    border-right: 1px solid var(--ec-border); color: var(--ec-text); word-break: break-all; vertical-align: top; text-align: center;
}
.ec-grid-scroll th, .ec-grid-scroll td { min-width: 120px; max-width: 300px; }
.ec-grid-scroll td:nth-child(1), .ec-grid-scroll td:nth-child(2) {
    position: sticky; z-index: 3; background: var(--ec-bg-alt);
    font-weight: 600; text-align: center; width: 50px; min-width: 50px; max-width: 50px;
    white-space: nowrap; word-break: normal;
}
.ec-grid-scroll td:nth-child(1) { left: 0; border-right: 1px solid var(--ec-border); }
.ec-grid-scroll td:nth-child(2) { left: 50px; border-right: 2px solid var(--ec-border); }

.ec-sidebar-content {
    overflow-y: scroll !important;
}

.ec-grid-scroll th:nth-child(1), .ec-grid-scroll th:nth-child(2) {
    position: sticky; z-index: 4; background: var(--ec-bg-alt);
    width: 50px; min-width: 50px; max-width: 50px;
    white-space: nowrap; word-break: normal;
}
.ec-grid-scroll th:nth-child(1) { left: 0; border-right: 1px solid var(--ec-border); }
.ec-grid-scroll th:nth-child(2) { left: 50px; border-right: 2px solid var(--ec-border); }

.ec-app[data-theme="dark"] .ec-grid-scroll td:nth-child(1),
.ec-app[data-theme="dark"] .ec-grid-scroll th:nth-child(1),
.ec-app[data-theme="dark"] .ec-grid-scroll td:nth-child(2),
.ec-app[data-theme="dark"] .ec-grid-scroll th:nth-child(2) {
    background: #1e293b;
    border-right-color: var(--ec-border);
}

/* Inline Differences Highlight */
.ec-inline-diff-container { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ec-diff-old, .ec-diff-new { padding: 4px 8px; border-radius: 4px; font-weight: 600; font-size: 0.8rem; line-height: 1.2; word-break: break-all; }
.ec-diff-old { background: #fee2e2; color: #991b1b; }
.ec-diff-new { background: #dcfce7; color: #166534; }
.ec-app[data-theme="dark"] .ec-diff-old { background: #7f1d1d; color: #fecaca; }
.ec-app[data-theme="dark"] .ec-diff-new { background: #14532d; color: #bbf7d0; }

/* Changes Sidebar Cards */
.ec-diff-card {
    background: var(--ec-bg);
    border: 1px solid var(--ec-border);
    border-radius: var(--ec-radius);
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s;
}
.ec-diff-card:hover {
    border-color: var(--ec-primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.ec-diff-card.active {
    border-color: var(--ec-primary);
    box-shadow: 0 0 0 2px var(--ec-primary);
}
.ec-card-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;
}
.ec-card-badge {
    background: #e0f2fe; color: #0369a1; padding: 2px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
}
.ec-app[data-theme="dark"] .ec-card-badge { background: #075985; color: #bae6fd; }
.ec-card-cell { font-size: 0.8rem; color: var(--ec-text-muted); font-weight: 600; }
.ec-card-values { display: flex; flex-direction: column; gap: 4px; }
.ec-card-old, .ec-card-new { padding: 6px 8px; border-radius: 4px; font-size: 0.8rem; word-break: break-all; }
.ec-card-old { background: #fee2e2; color: #991b1b; }
.ec-card-new { background: #dcfce7; color: #166534; }
.ec-app[data-theme="dark"] .ec-card-old { background: #7f1d1d; color: #fecaca; }
.ec-app[data-theme="dark"] .ec-card-new { background: #14532d; color: #bbf7d0; }

/* Row Number Highlight */
.ec-grid-scroll td.ec-row-diff-num { color: #0369a1; background: #e0f2fe; }
.ec-app[data-theme="dark"] .ec-grid-scroll td.ec-row-diff-num { color: #bae6fd; background: #075985; }

.ec-hidden-row, .ec-hidden-col { display: none !important; }

/* Loader */
.ec-loader {
    display: inline-block; width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff; border-radius: 50%;
    animation: ec-spin 0.8s linear infinite;
}
@keyframes ec-spin { to { transform: rotate(360deg); } }

/* Share Modal */
.ec-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); z-index: 9999; display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
}
.ec-modal, .ec-modal-content {
    background: var(--ec-bg-surface); border-radius: var(--ec-radius); box-shadow: var(--ec-shadow-modal);
    width: 440px; max-width: 90%; color: var(--ec-text); display:flex; flex-direction:column;
}
.ec-modal-header { padding: 20px 24px; border-bottom: 1px solid var(--ec-border); display: flex; justify-content: space-between; align-items: center; }

/* File Details Grid */
.ec-details-grid {
    display: flex; gap: 32px; padding: 24px;
}
.ec-details-col { flex: 1; }
.ec-details-row {
    display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--ec-border);
}
.ec-details-row:last-child { border-bottom: none; }
.ec-details-label { font-weight: 600; font-size: 0.85rem; color: var(--ec-text-muted); }
.ec-details-value { font-size: 0.85rem; color: var(--ec-text); text-align: right; word-break: break-all; max-width: 250px; }
@media (max-width: 768px) {
    .ec-details-grid { flex-direction: column; gap: 24px; }
}
.ec-modal-header .ec-modal-title { margin: 0; font-size: 1.2rem; font-weight: 700;}
.ec-modal-close { background: transparent; border: none; font-size: 1.2rem; cursor: pointer; color: var(--ec-text-muted); transition: color 0.2s;}
.ec-modal-close:hover { color: var(--ec-text); }
.ec-modal-body { padding: 24px; }
.ec-modal-body p { font-size: 0.9rem; color: var(--ec-text-muted); margin: 0 0 20px 0; line-height: 1.5; }
.ec-modal-label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 8px; }
.ec-modal-select { width: 100%; padding: 12px; margin-bottom: 24px; border: 1px solid var(--ec-border); border-radius: 6px; font-family: var(--ec-font); background: var(--ec-bg-alt); color: var(--ec-text); font-size: 0.95rem; }
.ec-modal-input { width: 100%; padding: 12px; border: 1px solid var(--ec-btn-teal); border-radius: 6px; font-family:var(--ec-font); font-size:0.85rem; background: rgba(13, 148, 136, 0.05); color: var(--ec-btn-teal); cursor: text; font-weight: 500;}

/* Alert */
.ec-alert {
    padding: 14px 24px; font-size: 0.95rem; font-weight: 600; text-align: center;
}
.ec-alert-error { background: var(--ec-btn-danger); color: var(--ec-danger-text); border-bottom: 1px solid #fecaca; }
.ec-alert-success { background: #dcfce7; color: #15803d; border-bottom: 1px solid #bbf7d0; }

@media (max-width: 800px) {
    .ec-toggles-horizontal { flex-direction: column; gap:10px; }
    .ec-top-actions { flex-direction: column; gap: 16px; padding: 16px; }
    .ec-action-col { justify-content: center; width: 100%; }
    .ec-upload-section { gap: 8px; padding: 16px 10px; }
    .ec-upload-zone { min-height: 180px; }
    .ec-upload-inner { padding: 16px 10px; }
    .ec-upload-icon svg { width: 40px !important; height: 40px !important; }
    .ec-upload-title { font-size: 0.85rem; }
    .ec-upload-desc { font-size: 0.75rem; }
    .ec-btn-browse { font-size: 0.78rem; padding: 7px 12px; margin-top: 12px; }
    .ec-changes-sidebar { width: 180px !important; }
    .ec-results-area { padding: 12px 6px; }
}

/* Zoom Control Styles */
.ec-zoom-controls {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--ec-bg-alt);
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--ec-border);
    margin-left: 16px;
}
.ec-zoom-btn {
    background: none;
    border: none;
    color: var(--ec-text);
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, transform 0.1s;
    white-space: nowrap;
}
.ec-zoom-btn:hover {
    color: var(--ec-btn-teal);
    transform: scale(1.1);
}
.ec-zoom-btn:active {
    transform: scale(0.9);
}
#ec-zoom-percent {
    font-size: 0.8rem;
    font-weight: 700;
    min-width: 40px;
    text-align: center;
}
#ec-zoom-reset {
    background: #ffffff;
    color: #215387;
    border: 1px solid #e2e8f0;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 6px;
    margin-left: 8px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
#ec-zoom-reset:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.ec-app[data-theme="dark"] #ec-zoom-reset {
    background: #1e293b;
    color: #f8fafc;
    border-color: #334155;
}
.ec-app[data-theme="dark"] #ec-zoom-reset:hover {
    background: #334155;
    border-color: #475569;
}
@media (max-width: 600px) {
    .ec-zoom-controls {
        margin-left: 0;
        margin-top: 8px;
        width: 100%;
        justify-content: center;
    }
}
