/* Personal Budget Manager front end styles */

/* Category editing inputs inside tables */
.pbm-cat-input {
    width: 80px;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    font-size: 0.8rem;
    text-align: right;
    background-color: #ffffff;
}

/* Action links in tables */
.pbm-table-actions {
    white-space: nowrap;
    font-size: 0.8rem;
}

.pbm-link-danger {
    cursor: pointer;
    color: #b91c1c;
    text-decoration: none;
}

.pbm-link-danger:hover {
    text-decoration: underline;
}

#pbm-app {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    max-width: 1100px;
    margin: 2rem auto;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e3e5ea;
    padding: 1.5rem 2rem 2.5rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    color: #111827;
}

/* Header */

.pbm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.pbm-header-left {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pbm-title {
    font-size: 1.4rem;
    margin: 0;
    font-weight: 600;
    color: #111827;
}

.pbm-month-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.pbm-month-selector label {
    font-size: 0.85rem;
    color: #4b5563;
}

#pbm-month-select {
    min-width: 170px;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    font-size: 0.9rem;
    background: #f9fafb;
}

/* Buttons */

.pbm-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 0.9rem;
    line-height: 1.2;
    padding: 0.4rem 0.95rem;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.pbm-button-primary {
    background-color: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 3px 8px rgba(37, 99, 235, 0.35);
}

.pbm-button-primary:hover {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
}

.pbm-button-secondary {
    background-color: #f3f4f6;
    color: #1f2937;
    border-color: #d1d5db;
}

.pbm-button-secondary:hover {
    background-color: #e5e7eb;
}

.pbm-button-small {
    font-size: 0.8rem;
    padding: 0.25rem 0.7rem;
}

/* Summary cards */

.pbm-summary-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.pbm-summary-card {
    border-radius: 8px;
    padding: 0.9rem 1rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
}

.pbm-summary-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6b7280;
    margin-bottom: 0.4rem;
}

.pbm-summary-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: #111827;
}

.pbm-summary-sub {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: #6b7280;
}

/* Tabs */

.pbm-tabs {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 1rem;
    gap: 0.25rem;
}

.pbm-tab-button {
    position: relative;
    border: none;
    background: transparent;
    padding: 0.5rem 0.9rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: #6b7280;
    border-radius: 6px 6px 0 0;
    transform: translateY(1px);
}

.pbm-tab-button:hover {
    color: #111827;
    background-color: #f3f4f6;
}

.pbm-tab-active {
    color: #111827;
    font-weight: 500;
    background-color: #ffffff;
    border-bottom: 2px solid #2563eb;
}

/* Tab panels */

.pbm-tab-panel {
    display: none;
}

.pbm-tab-panel-active {
    display: block;
}

.pbm-section {
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

.pbm-section h3 {
    font-size: 1.05rem;
    margin: 0 0 0.35rem;
    font-weight: 600;
    color: #111827;
}

.pbm-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Muted helper text */

.pbm-muted {
    font-size: 0.85rem;
    color: #6b7280;
    margin: 0 0 0.75rem;
}

/* Import boxes */

.pbm-import-sources {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.pbm-import-box {
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    padding: 1rem 1.1rem;
    background: #f9fafb;
}

.pbm-import-box h4 {
    margin: 0 0 0.4rem;
    font-size: 1rem;
    font-weight: 600;
}

.pbm-import-box p {
    margin: 0 0 0.6rem;
    font-size: 0.88rem;
    color: #4b5563;
}

#pbm-csv-file {
    display: block;
    margin-bottom: 0.6rem;
}

.pbm-form-row {
    margin-bottom: 0.7rem;
}

.pbm-form-row label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    color: #4b5563;
}

.pbm-form-row select {
    width: 100%;
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background-color: #ffffff;
    font-size: 0.9rem;
}

.pbm-status-message {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #4b5563;
}

/* Transactions toolbar */

.pbm-transactions-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    margin-top: 0.25rem;
}

.pbm-inline-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: #4b5563;
}

.pbm-inline-label select {
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    font-size: 0.85rem;
    background: #ffffff;
}

/* Tables */

.pbm-table-wrapper {
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    background-color: #ffffff;
}

.pbm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.pbm-table thead {
    background-color: #f3f4f6;
}

.pbm-table th,
.pbm-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

.pbm-table th {
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6b7280;
}

.pbm-table tr:last-child td {
    border-bottom: none;
}

.pbm-align-right {
    text-align: right;
}

.pbm-table tbody tr:nth-child(even) {
    background-color: #f9fafb;
}

/* Category tables */

.pbm-category-table {
    margin-bottom: 1.25rem;
}

.pbm-category-table h4 {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
    font-weight: 600;
}

/* Period dates label */

.pbm-period-dates {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    color: #4b5563;
}

/* Amount coloring */

.pbm-amount-negative {
    color: #b91c1c;
}

.pbm-amount-positive {
    color: #047857;
}

/* Income tab */

#pbm-income-summary-wrapper {
    margin-bottom: 1rem;
}

/* Responsive tweaks */

@media (max-width: 900px) {
    #pbm-app {
        padding: 1.25rem 1rem 1.5rem;
        margin: 1rem;
    }

    .pbm-summary-row {
        grid-template-columns: 1fr;
    }

    .pbm-import-sources {
        grid-template-columns: 1fr;
    }

    .pbm-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .pbm-header-right {
        width: 100%;
        display: flex;
        justify-content: flex-start;
    }
}

@media (max-width: 600px) {
    .pbm-tabs {
        overflow-x: auto;
    }

    .pbm-tab-button {
        white-space: nowrap;
    }
}
