/* ============================================================
   Unity — Custom Styles
   All project-specific polish on top of Bootstrap 4
   ============================================================ */

/* ---- Layout ---- */
.main {
    padding: 1.25rem 1rem 2.5rem;
}

/* ---- Page headings ---- */
.page-heading {
    font-weight: 600;
    color: #343a40;
    text-align: center;
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
}
.page-subheading {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

/* ---- Tables ---- */
.table thead th {
    background-color: #f8f9fa;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
    border-top: none;
    border-bottom-width: 1px;
    vertical-align: middle;
}
.table td {
    vertical-align: middle;
}
.table-hover tbody tr:hover {
    background-color: #f5f7fa;
}
.td-description {
    text-align: justify;
    max-width: 320px;
    word-wrap: break-word;
    white-space: normal;
}

/* ---- Money / amounts ---- */
.amount-positive {
    color: #1a7a1a;
    font-weight: 700;
}
.amount-secondary {
    color: #2e7fd4;
    font-size: 0.875rem;
}
.amount-negative {
    color: #c0392b;
    font-weight: 600;
}
.amount-due {
    color: #d35400;
}

/* ---- Member cell ---- */
.member-name {
    font-weight: 600;
    color: #212529;
    display: block;
}
.member-phone {
    font-size: 0.9rem;
    color: #6c757d;
    display: block;
}
.member-email {
    font-size: 0.8rem;
    color: #6c757d;
    display: block;
}
.member-email a {
    color: #6c757d;
    text-decoration: none;
}
.member-email a:hover {
    color: #007bff;
    text-decoration: underline;
}

/* ---- Month label ---- */
.month-label {
    color: #556b2f;
    font-weight: 500;
}

/* ---- Registrar cell ---- */
.registrar-name {
    color: #495057;
    display: block;
}
.registrar-phone {
    font-size: 0.8rem;
    color: #6c757d;
    display: block;
}

/* ---- Avatar ---- */
.avatar-sm {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}
.avatar-lg {
    width: 140px;
    height: 140px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid #dee2e6;
}

/* ---- Action dropdown (table rows) ---- */
.action-dropdown .dropdown-menu {
    min-width: 9rem;
    padding: 0.35rem 0;
}
.action-dropdown .dropdown-menu .btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.35rem 1rem;
    border: none;
    border-radius: 0;
    background: none;
    font-size: 0.875rem;
    line-height: 1.5;
}
.action-dropdown .dropdown-menu .btn:hover {
    background-color: rgba(0, 0, 0, 0.06);
}
.action-dropdown .dropdown-menu form {
    margin: 0;
    padding: 0;
}
.action-dropdown .dropdown-menu a.dropdown-item {
    padding: 0.35rem 1rem;
    font-size: 0.875rem;
}

/* ---- Pagination ---- */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

/* ---- Total bars (below tables) ---- */
.total-bar {
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    display: inline-block;
}

/* ---- Multiple deposit form ---- */
.multi-deposit-form {
    margin: 0 auto;
}
.multi-deposit-wrap {
    max-width: 900px !important;
}
.due-month-panel {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.due-month-toolbar {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 0.85rem 1rem 0.75rem;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
        "title summary"
        "helper helper";
    gap: 0.35rem 0.85rem;
    align-items: center;
}
.due-month-toolbar-main {
    display: contents;
    min-width: 0;
}
.due-month-heading {
    grid-area: title;
    color: #343a40;
    font-weight: 700;
    white-space: nowrap;
}
.due-month-helper {
    grid-area: helper;
    color: #6c757d;
    font-size: 0.85rem;
}
.due-month-summary {
    grid-area: summary;
    color: #6c757d;
    font-size: 0.875rem;
    white-space: nowrap;
    text-align: right;
}
.due-month-list {
    max-height: 360px;
    overflow-y: auto;
    padding: 0.85rem;
    background: #fcfcfd;
}
.due-month-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(320px, 1fr));
    gap: 0.65rem 0.85rem;
}
.due-month-item {
    display: grid;
    grid-template-columns: 18px minmax(130px, 1fr) auto;
    align-items: center;
    margin: 0;
    padding: 0.7rem 0.8rem;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    column-gap: 0.65rem;
    min-height: 46px;
    box-shadow: 0 1px 1px rgba(0,0,0,.02);
}
.due-month-item:hover {
    background: #f8f9fa;
}
.due-month-item-selected {
    border-color: #9fd3af;
    background: #f6fff8;
}
.due-month-checkbox {
    margin: 0;
}
.due-month-name {
    color: #556b2f;
    font-weight: 600;
    min-width: 0;
    overflow-wrap: break-word;
}
.due-month-amount {
    color: #1a7a1a;
    font-weight: 700;
    white-space: nowrap;
    text-align: right;
    padding-left: 0.75rem;
}
.due-month-footer {
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    padding: 0.65rem 1rem;
    text-align: right;
}
.due-month-toggle {
    min-width: 126px;
    white-space: nowrap;
}
.due-month-empty,
.due-month-loading {
    padding: 1rem;
    color: #6c757d;
    text-align: center;
}
@media (max-width: 767.98px) {
    .due-month-grid {
        grid-template-columns: 1fr;
    }
    .due-month-toolbar {
        grid-template-columns: 1fr;
        grid-template-areas:
            "title"
            "summary"
            "helper";
    }
    .due-month-summary {
        text-align: left;
        white-space: normal;
    }
    .due-month-footer {
        text-align: right;
    }
    .due-month-toggle {
        width: auto;
        min-width: 88px;
        padding-left: 0.9rem;
        padding-right: 0.9rem;
    }
    .due-month-amount {
        padding-left: 0.5rem;
    }
}

/* ---- Flash / alert polish ---- */
.alert {
    font-size: 0.9rem;
    border-radius: 6px;
}

/* ---- Email queue health warning ---- */
.email-queue-health-alert {
    font-size: 0.875rem;
    border-left: 4px solid #e0a800;
    padding-right: 2.5rem; /* room for dismiss × */
}
.email-queue-health-header {
    margin-bottom: 0.35rem;
}
.email-queue-health-list {
    margin: 0.25rem 0 0.5rem 0;
    padding-left: 1.25rem;
}
.email-queue-health-list li {
    margin-bottom: 0.15rem;
}
.email-queue-health-hint {
    margin: 0;
    color: #6c757d;
    font-size: 0.8125rem;
}
.email-queue-health-hint code {
    font-size: 0.8rem;
    background: rgba(0,0,0,.06);
    padding: 1px 4px;
    border-radius: 3px;
}

/* ---- Login page ---- */
.login-page-bg {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f4f6f8;
}
.login-card {
    background: #fff;
    border: 1px solid #bee5eb;
    border-radius: 10px;
    padding: 2.5rem 2rem;
    box-shadow: 0 6px 24px rgba(0, 170, 210, 0.13);
    width: 100%;
    max-width: 440px;
}
.login-logo {
    display: block;
    margin: 0 auto 1.25rem;
    height: 90px;
}
.login-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: #343a40;
    text-align: center;
    margin-bottom: 1.5rem;
}
.login-input {
    border: none;
    border-bottom: 2px solid #28a745;
    border-radius: 0;
    background: transparent;
    padding-left: 0;
}
.login-input:focus {
    border-color: #17a2b8;
    box-shadow: none;
    background: transparent;
}

/* ---- Profile page ---- */
.profile-photo-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
}
.profile-photo-card img {
    border-radius: 10px;
    width: 140px;
    height: 140px;
    object-fit: cover;
    border: 2px solid #dee2e6;
    margin-bottom: 1rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* ---- Form page wrapper (add / edit) ---- */
.form-page-wrap {
    max-width: 520px;
    margin: 0 auto;
}
@media (min-width: 768px) {
    .investment-form-wrap {
        max-width: 760px;
    }
}

/* ---- Account summary table ---- */
.summary-table thead {
    display: none; /* summary uses only tbody rows */
}
.summary-table th.summary-label {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    text-transform: none;
    letter-spacing: 0;
    color: inherit;
    background: transparent;
}
.summary-table th.summary-value {
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
    background: transparent;
    text-transform: none;
    letter-spacing: 0;
    color: inherit;
}
.summary-table th.summary-desc {
    font-size: 0.85rem;
    line-height: 1.65;
    font-weight: normal;
    background: transparent;
    text-transform: none;
    letter-spacing: 0;
    color: inherit;
}
.summary-table tr[onclick] {
    cursor: pointer;
}

/* ---- Deposit / dues section headers ---- */
.section-heading {
    font-weight: 600;
    color: #343a40;
    text-align: center;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

/* ---- Navbar logo ---- */
.navbar-brand img {
    height: 48px;
    max-height: 48px;
}

/* ---- Navbar logout ---- */
/* Desktop: right-edge link, subtle muted style */
.nav-link-logout {
    opacity: 0.75;
}
.nav-link-logout:hover {
    opacity: 1;
    color: #f8d7da !important;
}

/* Mobile: separator above logout section */
@media (max-width: 991px) {
    .navbar-logout {
        border-top: 1px solid rgba(255, 255, 255, 0.15);
        margin-top: 0.4rem;
        padding-top: 0.25rem;
    }
}

/* ---- Required field indicator ---- */
.required-label::after {
    content: " *";
    color: #dc3545;
    font-weight: 700;
}

/* ---- Page toolbar (title centered, action button right-aligned) ---- */
.page-toolbar {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0.75rem 0 1rem;
    min-height: 2.5rem;
}
.page-toolbar-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #343a40;
    margin: 0;
    text-align: center;
    /* keep title clear of the absolutely-positioned action button */
    padding: 0 7rem;
}
.page-toolbar-action {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

/* ---- Accounts summary redesign ---- */

/* Page-level header (summary page uses this instead of page-toolbar) */
.summary-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
}
.summary-header-title    { font-size: 1.4rem; font-weight: 700; color: #212529; margin: 0 0 0.15rem; }
.summary-header-subtitle { font-size: 0.8rem;  color: #6c757d; margin: 0; }

/* Stat cards */
.summary-stat-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 1.1rem 0.75rem 0.9rem;
    text-align: center;
    height: 100%;
}
.summary-stat-card.summary-stat-positive { border-top: 3px solid #28a745; }
.summary-stat-card.summary-stat-due      { border-top: 3px solid #fd7e14; }
.summary-stat-card.summary-stat-ok       { border-top: 3px solid #28a745; }
.summary-stat-card.summary-stat-negative { border-top: 3px solid #dc3545; }
.summary-stat-card.summary-stat-balance  { border-top: 3px solid #007bff; background: #f0f6ff; }

.summary-stat-card .stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6c757d;
    font-weight: 700;
    margin-bottom: 0.3rem;
}
.summary-stat-card .stat-value {
    font-size: 1.35rem;
    font-weight: 800;
    color: #212529;
    line-height: 1.2;
    margin-bottom: 0.2rem;
}
/* Smaller variant — used when numbers are large (investment monetary cards) */
.summary-stat-card .stat-value-md {
    font-size: 1.05rem;
    font-weight: 800;
    color: #212529;
    line-height: 1.2;
    margin-bottom: 0.2rem;
}
.summary-stat-card .stat-desc { font-size: 0.72rem; color: #adb5bd; }

/* State → value colour propagation */
.summary-stat-card.summary-stat-balance .stat-value   { color: #0056b3; }
.summary-stat-card.summary-stat-positive .stat-value,
.summary-stat-card.summary-stat-positive .stat-value-md { color: #1a7a1a; }
.summary-stat-card.summary-stat-negative .stat-value,
.summary-stat-card.summary-stat-negative .stat-value-md { color: #c0392b; }

/* Section header used inside the page (investment insight, etc.) */
.summary-section-title {
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #6c757d;
    margin: 0 0 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid #e9ecef;
}

/* Summary breakdown table */
.summary-breakdown         { font-size: 0.925rem; }
.summary-breakdown td      { padding: 0.7rem 0.75rem; vertical-align: middle; }
.summary-breakdown .summary-row-label { color: #343a40; width: 55%; font-weight: 500; }
.summary-breakdown .summary-row-value { font-weight: 700; font-size: 1rem; white-space: nowrap; }
.summary-breakdown .summary-row-value.summary-balance-value { font-size: 1.1rem; font-weight: 800; }
.summary-breakdown .summary-balance-row td { background: #f0f6ff; border-top: 2px solid #b8d4f5; }
.summary-breakdown tbody tr:last-child td { border-bottom: none; }
/* Clickable rows in the breakdown (Debit, Credit) */
.summary-breakdown .summary-clickable { cursor: pointer; }
.summary-breakdown .summary-clickable:hover td { background-color: #f0f7ff; }

.font-weight-400 { font-weight: 400 !important; }
.font-weight-700 { font-weight: 700 !important; }
.font-weight-800 { font-weight: 800 !important; }

/* ---- Deposit note badge ---- */
.deposit-note-badge {
    cursor: pointer;
    font-size: 0.65rem;
    vertical-align: middle;
    margin-left: 0.3rem;
    opacity: 0.75;
    letter-spacing: 0.02em;
}
.deposit-note-badge:hover,
.deposit-note-badge:focus {
    opacity: 1;
    outline: none;
}

/* ---- Removed member row ---- */
.row-member-removed {
    opacity: 0.55;
}
.row-member-removed .member-name {
    text-decoration: line-through;
    color: #6c757d;
}
.badge-removed {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    background-color: #6c757d;
    color: #fff;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    vertical-align: middle;
    margin-left: 0.3rem;
    letter-spacing: 0.02em;
}

/* ---- Filter / search card ---- */
.filter-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 0.875rem 1rem 0;
}
.filter-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
    margin-bottom: 0.2rem;
    white-space: nowrap;
}
.filter-results-note {
    font-size: 0.8rem;
    color: #6c757d;
    margin: 0.25rem 0 0.75rem;
}
.filter-results-note a {
    color: #495057;
    text-decoration: underline;
}

/* ---- Account security card (profile page) ---- */
.security-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
}
.security-card h6 {
    font-weight: 600;
    color: #343a40;
    margin-bottom: 0.25rem;
}

/* ---- Responsive ---- */
@media (max-width: 767px) {
    .main {
        padding: 0.75rem 0.5rem 2rem;
    }
    .page-heading {
        font-size: 1.2rem;
    }
    .table {
        font-size: 0.82rem;
    }
    .summary-table th.summary-desc {
        display: none; /* hide Bengali description on mobile to save space */
    }
    .form-page-wrap {
        padding: 0 0.25rem;
    }
    .login-card {
        padding: 2rem 1.25rem;
        border-radius: 8px;
    }
    .profile-photo-card {
        padding: 1rem;
    }
    .avatar-lg {
        width: 110px;
        height: 110px;
    }
    /* toolbar stacks vertically on small screens */
    .page-toolbar {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    .page-toolbar-title {
        padding: 0;
        font-size: 1.2rem;
        width: 100%;
        text-align: center;
    }
    .page-toolbar-action {
        position: static;
        transform: none;
        width: 100%;
        display: flex;
        justify-content: flex-end;
    }
}
