Files
Aberwyn/Aberwyn/wwwroot/css/budget.css
Elias Jansson e3eb2dc7cb
All checks were successful
continuous-integration/drone/push Build is passing
Budget page improvements
2025-06-09 16:11:59 +02:00

672 lines
12 KiB
CSS

:root {
--text-main: #1E293B;
--text-sub: #64748B;
--bg-main: #f9fafb;
--bg-card: #f1f5f9;
--border-color: #e5e7eb;
--card-income: #f97316;
--card-expense: #ef4444;
--card-savings: #facc15;
--card-leftover: #86efac;
--btn-edit: #3b82f6;
--btn-check: #10b981;
--btn-delete: #ef4444;
}
body {
background-color: var(--bg-main);
color: var(--text-main);
font-family: 'Segoe UI', sans-serif;
font-size: 14px;
font-weight: 500;
}
.budget-page {
padding: 16px 24px;
margin-left: 0;
max-width: unset;
}
.budget-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
flex-wrap: wrap;
gap: 12px;
padding-right: 8px;
}
.month-nav-bar {
display: flex;
align-items: center;
gap: 6px;
position: relative;
}
.month-label {
padding: 4px 10px;
background-color: #e2e8f0;
border-radius: 6px;
cursor: pointer;
font-weight: 600;
font-size: 16px;
text-align: center;
min-width: 90px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.menu-container {
position: relative;
}
.month-picker-dropdown select,
.month-picker-dropdown input {
font-size: 13px;
padding: 5px;
border-radius: 6px;
border: 1px solid var(--border-color);
width: 100%;
box-sizing: border-box;
margin-bottom: 6px;
}
.nav-button {
background-color: #e2e8f0;
color: var(--text-main);
border: none;
padding: 4px 8px;
border-radius: 6px;
cursor: pointer;
font-weight: bold;
transition: background 0.2s;
font-size: 16px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.nav-button:hover {
background-color: #cbd5e1;
}
.budget-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap:10px;
align-items: stretch;
}
.budget-card {
display: flex;
flex-direction: column;
width: 100%;
height: 350px;
border: 1px solid var(--border-color);
border-radius: 12px;
background-color: var(--bg-card);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
overflow: hidden;
}
.item-list {
flex-grow: 1;
overflow-y: auto;
padding: 2px 8px;
display: flex;
flex-direction: column;
position: relative;
}
.item-row:last-child {
margin-bottom: 5px;
}
.total-row {
padding: 2px 8px;
font-weight: bold;
font-size: 13px;
background: #f1f5f9;
border-top: 1px solid var(--border-color);
border-radius: 0 0 12px 12px;
flex-shrink: 0;
}
.card-header {
border-radius: 12px 12px 0 0;
position: sticky;
top: 0;
z-index: 3; /* högre än total-row */
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px 12px;
font-weight: 600;
color: #ffffff;
font-size: 14px;
flex-wrap: wrap;
gap: 6px;
}
.header-edit {
padding: 4px 8px;
border-radius: 6px;
border: 1px solid var(--border-color);
flex: 1;
min-width: 120px; /* om du vill att den ska vara större */
}
.card-header.income {
background-color: var(--card-income);
}
.card-header.expense {
background-color: var(--card-expense);
}
.card-header.savings {
background-color: var(--card-savings);
}
.card-header.leftover {
background-color: var(--card-leftover);
}
.item-row {
display: flex;
flex-wrap: nowrap;
justify-content: space-between;
align-items: center;
gap: 0px;
font-size: 13px;
}
.item-list::-webkit-scrollbar {
width: 6px;
}
.item-list::-webkit-scrollbar-thumb {
background-color: rgba(100, 116, 139, 0.2);
border-radius: 3px;
}
.item-list::-webkit-scrollbar-track {
background: transparent;
}
/* === För Firefox === */
.item-list {
scrollbar-width: thin;
scrollbar-color: rgba(100, 116, 139, 0.2) transparent;
}
.item-row input[type="text"] {
flex: 1;
padding: 5px 6px;
font-size: 13px;
border: 1px solid var(--border-color);
border-radius: 6px;
background-color: #ffffff;
color: var(--text-main);
font-weight: 500;
min-width: 70px;
}
.item-row input[type="number"] {
flex: 1;
padding: 5px 6px;
font-size: 13px;
border: 1px solid var(--border-color);
border-radius: 6px;
background-color: #ffffff;
color: var(--text-main);
font-weight: 500;
max-width: 60px;
}
.amount {
min-width: 70px;
text-align: right;
font-weight: 600;
}
.icon-button {
background: none;
border: none;
cursor: pointer;
font-size: 13px;
padding: 4px;
transition: color 0.2s;
}
.icon-button:hover {
color: #000000;
}
.icon-button.danger {
color: var(--btn-delete);
}
.icon-button.danger:hover {
color: #b91c1c;
}
.icon-button.edit {
color: var(--btn-edit);
}
.icon-button.confirm {
color: var(--btn-check);
}
.dropdown-menu {
position: absolute;
right: 0;
top: calc(100% + 6px);
background-color: #ffffff;
border: 1px solid var(--border-color);
border-radius: 6px;
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
z-index: 1000;
padding: 6px;
display: none;
gap: 4px;
flex-wrap: wrap;
min-width: 200px;
}
.menu-container.open .dropdown-menu {
display: flex;
}
.dropdown-menu button {
padding: 5px 8px;
border-radius: 6px;
border: 1px solid #ddd;
background: #f3f4f6;
cursor: pointer;
font-size: 12px;
flex: 1;
font-weight: 500;
}
.dropdown-menu button:hover {
background-color: #e5e7eb;
}
.no-data {
text-align: center;
padding: 16px;
font-size: 14px;
color: var(--text-sub);
border: 1px dashed var(--border-color);
border-radius: 8px;
background-color: #fff;
margin-top: 12px;
font-weight: 500;
}
.toast {
position: fixed;
bottom: 20px;
right: 20px;
background: #10B981;
color: white;
padding: 10px 16px;
border-radius: 6px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
opacity: 0;
transform: translateY(20px);
transition: opacity 0.3s, transform 0.3s;
z-index: 9999;
font-weight: 500;
}
.toast.show {
opacity: 1;
transform: translateY(0);
}
.toast.error {
background: #ef4444;
}
/* === Dropzones === */
.drop-placeholder {
height: 0px;
transition: all 0.2s ease;
margin: 0;
}
.drop-placeholder.drag-over {
border-top: 3px solid #3B82F6;
height: 40px; /* gör det mer tydligt när man drar */
transition: height 0.2s ease;
}
/* Gör att man ser var man kan släppa */
.drop-zone.active-drop-target {
height: 12px;
background-color: rgba(22, 163, 74, 0.1); /* svagt grön basfärg */
}
.drop-zone.drag-over {
border: 2px dashed #16a34a; /* grön */
background-color: rgba(22, 163, 74, 0.1);
}
.item-floating-menu {
position: fixed !important; /* viktig för att den inte ska följa DOM-flödet */
z-index: 9999 !important; /* se till att inget annat ligger över */
background: #1F2C3C;
color: #fff;
border: 1px solid #444;
border-radius: 6px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
padding: 4px 0px 4px 0;
min-width: 20px;
max-width: 130px;
display: block;
}
.item-floating-menu button {
background: none;
border: none;
color: #fff;
text-align: left;
padding: 8px 16px;
width: 100%;
cursor: pointer;
}
.item-floating-menu button:hover {
background: #333;
}
.item-floating-menu button.disabled {
color: #aaa;
pointer-events: none;
font-style: italic;
}
.add-item-popup {
position: absolute; /* ← Ändrat från fixed */
z-index: 9999;
background-color: #1F2C3C;
color: white;
border: 1px solid #444;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
padding: 14px;
width: 280px;
font-size: 14px;
margin-top: 6px;
}
.add-item-popup.above {
margin-top: unset;
margin-bottom: 6px;
}
.add-item-popup label {
display: block;
margin-top: 8px;
font-weight: 600;
font-size: 13px;
color: #cbd5e1;
}
.add-item-popup input,
.add-item-popup select {
width: 100%;
padding: 6px 8px;
border: none;
border-radius: 6px;
margin-top: 4px;
font-size: 13px;
box-sizing: border-box;
background-color: #334155;
color: white;
}
.add-item-popup input::placeholder {
color: #94a3b8;
}
.add-item-popup button {
margin-top: 12px;
margin-right: 8px;
padding: 6px 12px;
background-color: #3b82f6;
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 13px;
font-weight: 500;
transition: background-color 0.2s;
}
.add-item-popup button:hover {
background-color: #2563eb;
}
.add-post-btn {
margin: 10px 0 6px 0;
padding: 6px 10px;
background-color: #3b82f6;
color: white;
border-radius: 6px;
font-size: 13px;
font-weight: 500;
transition: background-color 0.2s ease;
display: inline-flex;
align-items: center;
gap: 6px;
}
.add-post-btn:hover {
background-color: #2563eb;
}
.suggestion-list {
position: absolute;
background: #1F2C3C;
color: white;
border: 1px solid #555;
border-radius: 4px;
margin-top: 4px;
padding: 0;
list-style: none;
width: 100%;
max-height: 150px;
overflow-y: auto;
z-index: 10000; /* 👈 ovanför resten */
}
.suggestion-list li {
padding: 6px 10px;
cursor: pointer;
}
.suggestion-list li:hover {
background: #334155;
}
/* Summary */
.budget-overview-row {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin: 8px 0 16px;
}
.budget-summary-box,
.budget-chart-box {
flex: 1 1 250px;
background-color: var(--bg-card);
padding: 8px 12px;
border-radius: 8px;
box-shadow: 0 1px 3px rgba(0,0,0,0.04);
min-width: 220px;
}
.budget-summary-box h3,
.budget-chart-box h3 {
margin: 0 0 6px;
font-size: 13px;
font-weight: 600;
color: var(--text-main);
}
.summary-list,
.category-summary-list {
list-style: none;
padding: 0;
margin: 0;
}
.summary-list li,
.category-summary-list li {
display: flex;
justify-content: space-between;
padding: 1px 0;
font-size: 12px;
font-weight: 500;
line-height: 1.4;
color: var(--text-main);
}
.summary-list li span:first-child {
font-weight: 600;
color: var(--text-sub);
}
.category-summary-list li {
border-top: 1px dashed var(--border-color);
padding: 3px 0;
font-size: 11.5px;
}
.highlight {
font-weight: 700;
}
.highlight.leftover.plus {
color: #15803d;
}
.highlight.leftover.minus {
color: #dc2626;
}
/* chart */
.chart-area {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
}
.chart-legend h4 {
margin: 0 0 6px;
font-size: 13px;
font-weight: 600;
}
.chart-area {
flex: 1;
min-width: 200px;
max-width: 340px;
}
canvas {
max-width: 100%;
height: auto;
}
@media (min-width: 769px) {
.budget-overview-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
align-items: start;
}
.budget-chart-box {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
min-height: 300px;
text-align: center;
}
.budget-chart-box .chart-row {
display: flex;
justify-content: center;
align-items: center;
}
.budget-chart-box .chart-area {
flex: 1;
max-width: 420px;
width: 100%;
}
.budget-chart-box canvas {
max-width: 100%;
height: auto;
}
}
@media (max-width: 768px) {
.budget-overview-row {
display: flex;
flex-direction: column;
gap: 12px;
}
.budget-summary-box,
.budget-chart-box {
width: 100%;
}
.chart-row {
flex-direction: column;
align-items: center;
}
.chart-area {
max-width: 100%;
}
.chart-legend {
width: 100%;
text-align: center;
padding-bottom: 10px;
}
.chart-area canvas {
max-width: 240px;
height: auto;
}
}