filediff-viewer / style.css
Meroar's picture
Make the diffs provide more visual feedback and add some clever, innovative functionality or visual analytics
c238fdf verified
:root{
/* Theme colors - set to undefined to force external override, or keep defaults */
--color-primary: #0ea5e9; /* sky-500 */
--color-primary-600: #0284c7;
--color-secondary: #64748b; /* slate-500 */
--color-bg: #ffffff;
--color-bg-soft: #f8fafc; /* slate-50 */
--color-text: #0f172a; /* slate-900 */
--color-muted: #475569; /* slate-600 */
--color-border: #e2e8f0; /* slate-200 */
--color-added-bg: #ecfdf5; /* emerald-50 */
--color-del-bg: #fef2f2; /* rose-50 */
--color-mod-bg: #fff7ed; /* orange-50 */
--color-move-bg: #eff6ff; /* blue-50 */
--color-added-border: #10b981;
--color-del-border: #ef4444;
--color-mod-border: #f59e0b;
--color-move-border: #3b82f6;
--shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
--shadow-md: 0 4px 8px rgba(0,0,0,0.08);
--radius: 10px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body{
margin:0;
font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
color: var(--color-text);
background: var(--color-bg);
}
.app-header{
position: sticky; top: 0; z-index: 10;
display: flex; align-items: center; justify-content: space-between;
padding: 12px 16px;
border-bottom: 1px solid var(--color-border);
background: linear-gradient(180deg, var(--color-bg) 0%, var(--color-bg-soft) 100%);
backdrop-filter: blur(4px);
}
.brand{ display: flex; align-items: center; gap: 10px; }
.brand .logo{
width: 32px; height: 32px; display: grid; place-items:center;
border-radius: 8px; background: var(--color-primary);
color: white; font-weight: 700;
box-shadow: var(--shadow-sm);
}
h1{ font-size: 18px; margin: 0; }
.header-actions{ display: flex; align-items: center; gap: 16px; }
.btn-info{
width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--color-border);
background: var(--color-bg); color: var(--color-muted); cursor: pointer; display: grid; place-items: center;
transition: background .2s ease, color .2s ease;
}
.btn-info:hover{ background: var(--color-primary); color: white; }
.switch{ display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input{ display: none; }
.switch .slider{
width: 40px; height: 22px; border-radius: 999px; background: var(--color-border);
position: relative; transition: background .2s ease;
}
.switch .slider::after{
content:""; position: absolute; top: 3px; left: 3px;
width: 16px; height: 16px; border-radius: 50%; background: white; box-shadow: var(--shadow-sm);
transition: transform .2s ease;
}
.switch input:checked + .slider{ background: var(--color-primary); }
.switch input:checked + .slider::after{ transform: translateX(18px); }
.switch .switch-label{ color: var(--color-muted); font-size: 14px; }
.search-container{
position: relative; display: flex; align-items: center;
border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-bg);
overflow: hidden;
}
.search-input{
border: none; padding: 6px 10px; background: transparent; color: var(--color-text);
width: 200px; font-size: 14px;
}
.search-input:focus{ outline: none; }
.search-btn{
border: none; background: transparent; color: var(--color-muted); cursor: pointer;
padding: 6px 10px; display: flex; align-items: center; justify-content: center;
transition: background .2s ease;
}
.search-btn:hover{ background: var(--color-bg-soft); color: var(--color-primary); }
.controls{
display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
padding: 12px 16px;
}
.file-block{
border: 1px solid var(--color-border);
border-radius: var(--radius);
background: var(--color-bg);
box-shadow: var(--shadow-sm);
overflow: hidden;
}
.block-header{
display: flex; align-items: center; justify-content: space-between; gap: 12px;
padding: 10px 12px;
border-bottom: 1px solid var(--color-border);
background: var(--color-bg-soft);
}
.file-actions{ display: flex; align-items: center; gap: 8px; }
.btn{
background: var(--color-primary); color: white; border: none; border-radius: 8px;
padding: 8px 12px; cursor: pointer; box-shadow: var(--shadow-sm);
transition: transform .05s ease, background .2s ease;
}
.btn:hover{ background: var(--color-primary-600); }
.btn:active{ transform: translateY(1px); }
.btn.secondary{
background: var(--color-secondary);
}
.btn.ghost{
background: transparent; color: var(--color-text); border: 1px solid var(--color-border);
}
.btn.small{
padding: 4px 8px; font-size: 12px; border-radius: 6px;
}
.file-summary{ padding: 8px 12px; color: var(--color-muted); font-size: 14px; }
.textarea-wrap{ padding: 10px; border-top: 1px dashed var(--color-border); background: var(--color-bg-soft); }
.textarea-wrap textarea{
width: 100%; min-height: 160px; resize: vertical; padding: 10px; border-radius: 8px;
border: 1px solid var(--color-border); background: white; color: var(--color-text);
}
.paste-actions{ display:flex; gap: 8px; margin-top: 8px; }
.stats{
display: flex; gap: 16px; align-items: center;
padding: 8px 16px; color: var(--color-muted);
}
.stat{ display: inline-flex; gap: 6px; align-items: center; background: var(--color-bg-soft); border: 1px solid var(--color-border); padding: 6px 10px; border-radius: 999px; }
.stat .label{ font-size: 12px; }
.stat .value{ font-weight: 700; color: var(--color-text); }
.analytics{
margin: 0 16px; border: 1px solid var(--color-border); border-radius: var(--radius);
background: var(--color-bg); box-shadow: var(--shadow-sm); overflow: hidden;
}
.analytics-header{
display: flex; align-items: center; justify-content: space-between; padding: 12px 16px;
border-bottom: 1px solid var(--color-border); background: var(--color-bg-soft);
}
.analytics-header h3{ margin: 0; font-size: 16px; }
.analytics-controls{ display: flex; gap: 8px; }
.analytics-content{
display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding: 16px;
}
.chart-container h4{
margin: 0 0 12px 0; font-size: 14px; color: var(--color-muted);
}
.bar-chart{
display: flex; flex-direction: column; gap: 8px; min-height: 120px;
}
.bar-item{
display: flex; align-items: center; gap: 10px;
}
.bar-label{
min-width: 60px; font-size: 12px; color: var(--color-muted);
}
.bar-track{
flex: 1; height: 20px; background: var(--color-bg-soft); border-radius: 10px; position: relative; overflow: hidden;
}
.bar-fill{
height: 100%; border-radius: 10px; transition: width .3s ease; position: relative;
}
.bar-value{
min-width: 30px; text-align: right; font-size: 12px; font-weight: 600;
}
.bar-fill.added{ background: linear-gradient(90deg, var(--color-added-border), #34d399); }
.bar-fill.deleted{ background: linear-gradient(90deg, var(--color-del-border), #f87171); }
.bar-fill.modified{ background: linear-gradient(90deg, var(--color-mod-border), #fbbf24); }
.bar-fill.moved{ background: linear-gradient(90deg, var(--color-move-border), #60a5fa); }
.change-heatmap{
display: grid; grid-template-rows: auto 1fr; gap: 12px;
}
.heatmap-header{
display: flex; align-items: center; justify-content: space-between;
}
.heatmap-grid{
display: flex; flex-direction: column; gap: 2px; max-height: 200px; overflow-y: auto;
border: 1px solid var(--color-border); border-radius: 8px; padding: 8px;
background: var(--color-bg-soft);
}
.heatmap-row{
display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center;
padding: 2px 0; border-radius: 4px; transition: background .2s ease;
}
.heatmap-row:hover{ background: var(--color-border); }
.heatmap-line{
height: 4px; border-radius: 2px; transition: all .2s ease;
}
.heatmap-label{
font-size: 10px; color: var(--color-muted);
}
.diff-container{
position: relative;
display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
padding: 12px 16px 24px;
}
.pane-wrapper{
position: relative; display: contents;
}
.pane{
display:flex; flex-direction: column; min-height: 60vh; border: 1px solid var(--color-border);
border-radius: var(--radius); overflow: hidden; background: var(--color-bg);
box-shadow: var(--shadow-sm);
}
.pane-header{
display:flex; align-items: baseline; justify-content: space-between; gap: 10px;
padding: 10px 12px; border-bottom: 1px solid var(--color-border); background: var(--color-bg-soft);
}
.pane-header h2{ margin: 0; font-size: 16px; }
.file-meta{ color: var(--color-muted); font-size: 12px; }
.code-wrap{ overflow: auto; height: 100%; }
table.code{ width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
tbody tr{ border-bottom: 1px solid var(--color-border); }
tbody tr:last-child{ border-bottom: none; }
td{
padding: 6px 10px; vertical-align: top; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
font-size: 13px; line-height: 1.45;
}
.gutter{ width: 64px; color: var(--color-muted); background: var(--color-bg); border-right: 1px solid var(--color-border); text-align: right; user-select: none; }
.content{ white-space: pre-wrap; word-break: break-word; }
.line.added{ background: var(--color-added-bg); }
.line.added .content{ border-left: 3px solid var(--color-added-border); padding-left: 7px; }
.line.deleted{ background: var(--color-del-bg); }
.line.deleted .content{ border-left: 3px solid var(--color-del-border); padding-left: 7px; }
.line.modified{ background: var(--color-mod-bg); }
.line.modified .content{ border-left: 3px solid var(--color-mod-border); padding-left: 7px; }
.line.moved{ background: var(--color-move-bg); }
.line.moved .content{ border-left: 3px solid var(--color-move-border); padding-left: 7px; }
.line.equal .content{ color: var(--color-text); }
.line .actions{
display: inline-flex; gap: 6px; margin-left: 8px; opacity: 0; transition: opacity .15s ease;
}
tr:hover .line .actions{ opacity: 1; }
.btn-jump{
border: none; background: transparent; color: var(--color-muted); cursor: pointer; padding: 2px 4px;
border-radius: 6px;
}
.btn-jump:hover{ color: var(--color-primary); background: rgba(14,165,233,0.08); }
.jump-indicator{ color: var(--color-primary); font-weight: 700; }
.line-connectors{
position: absolute; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; z-index: 5;
overflow: visible;
}
.connector-line{
stroke: var(--color-primary); stroke-width: 1; fill: none; opacity: 0.4;
stroke-dasharray: 3,3; animation: dash 2s linear infinite;
}
@keyframes dash{
to{ stroke-dashoffset: -6; }
}
.connector-line.moved{ stroke: var(--color-move-border); }
.connector-line.modified{ stroke: var(--color-mod-border); }
.word-diff{
display: inline; position: relative;
}
.word-diff.added{
background: rgba(16, 185, 129, 0.3); color: var(--color-text);
border-radius: 2px; padding: 1px 2px;
}
.word-diff.deleted{
background: rgba(239, 68, 68, 0.3); color: var(--color-text);
border-radius: 2px; padding: 1px 2px; text-decoration: line-through;
}
.hover-preview{
position: absolute; background: var(--color-bg); border: 1px solid var(--color-border);
border-radius: 6px; padding: 8px; box-shadow: var(--shadow-md); z-index: 20;
font-size: 12px; max-width: 200px; white-space: pre-wrap;
opacity: 0; transform: translateY(-10px); transition: all .2s ease;
pointer-events: none;
}
.hover-preview.show{
opacity: 1; transform: translateY(0);
}
.minimap{
position: fixed; right: 20px; top: 50%; transform: translateY(-50%);
width: 120px; background: var(--color-bg); border: 1px solid var(--color-border);
border-radius: var(--radius); box-shadow: var(--shadow-md); z-index: 15;
max-height: 60vh; overflow: hidden;
}
.minimap-header{
padding: 8px 12px; border-bottom: 1px solid var(--color-border); background: var(--color-bg-soft);
}
.minimap-header h4{
margin: 0; font-size: 12px; color: var(--color-muted);
}
.minimap-content{
padding: 8px; height: 200px; overflow-y: auto;
}
.minimap-block{
height: 3px; margin: 1px 0; border-radius: 2px; cursor: pointer;
transition: all .2s ease;
}
.minimap-block:hover{
transform: scaleY(2);
}
.minimap-block.added{ background: var(--color-added-border); }
.minimap-block.deleted{ background: var(--color-del-border); }
.minimap-block.modified{ background: var(--color-mod-border); }
.minimap-block.moved{ background: var(--color-move-border); }
.minimap-block.equal{ background: var(--color-border); opacity: 0.3; }
.search-highlight{
background: rgba(14, 165, 233, 0.3) !important;
animation: highlight-pulse 1s ease-in-out;
}
@keyframes highlight-pulse{
0%{ background: rgba(14, 165, 233, 0.5); }
50%{ background: rgba(14, 165, 233, 0.2); }
100%{ background: rgba(14, 165, 233, 0.3); }
}
.change-severity{
position: absolute; right: 4px; top: 2px; width: 3px; height: calc(100% - 4px);
border-radius: 2px;
}
.change-severity.low{ background: rgba(34, 197, 94, 0.3); }
.change-severity.medium{ background: rgba(251, 191, 36, 0.5); }
.change-severity.high{ background: rgba(239, 68, 68, 0.7); }
.app-footer{
padding: 12px 16px; border-top: 1px solid var(--color-border); color: var(--color-muted);
background: var(--color-bg-soft);
}
.hidden{ display: none !important; }
/* Modal styles */
.modal-overlay{
position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 50;
display: flex; align-items: center; justify-content: center;
background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(2px);
animation: fadeIn .2s ease;
}
.modal{
background: var(--color-bg); border-radius: 12px; border: 1px solid var(--color-border);
width: 90%; max-width: 640px; max-height: 80vh; overflow: hidden; box-shadow: var(--shadow-md);
animation: slideUp .2s ease;
}
.modal-header{
display: flex; align-items: center; justify-content: space-between; gap: 12px;
padding: 16px 20px; border-bottom: 1px solid var(--color-border); background: var(--color-bg-soft);
}
.modal-header h3{ margin: 0; font-size: 18px; }
.modal-close{
border: none; background: transparent; cursor: pointer; color: var(--color-muted);
width: 32px; height: 32px; border-radius: 6px; display: grid; place-items: center;
transition: background .2s ease, color .2s ease;
}
.modal-close:hover{ background: var(--color-border); color: var(--color-text); }
.modal-content{
padding: 20px; overflow-y: auto; max-height: calc(80vh - 70px);
}
.modal-section{
margin-bottom: 24px;
}
.modal-section:last-child{
margin-bottom: 0;
}
.modal-section h4{
margin: 0 0 10px 0; font-size: 16px; color: var(--color-text);
}
.modal-section p{
margin: 0 0 10px 0; line-height: 1.5; color: var(--color-muted);
}
.modal-section ul{
margin: 0; padding-left: 20px; color: var(--color-muted);
}
.modal-section li{
margin-bottom: 6px; line-height: 1.4;
}
.modal-section strong{
color: var(--color-text);
}
@media (max-width: 980px){
.controls{ grid-template-columns: 1fr; }
.diff-container{ grid-template-columns: 1fr; }
.modal{ width: 95%; max-height: 85vh; }
}
@keyframes fadeIn{
from{ opacity: 0; }
to{ opacity: 1; }
}
@keyframes slideUp{
from{ transform: translateY(20px); opacity: 0; }
to{ transform: translateY(0); opacity: 1; }
}