/* Global Styles */
body {
    font-family: "Gill Sans", sans-serif;
    background-color: #f2f2f2;
    margin: 0;
    padding: 0;
}

/* Header Styles */
.header {
    background-color: #128C7E;
    color: white;
    padding: 15px 5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header img {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    margin-right: 10px;
}

.header .header-title {
    display: flex;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    flex-grow: 1;
}

.header .total-amount {
    margin-left: 15px;
    font-size: 20px;
    background-color: #fff;
    color: #128C7E;
    padding: 5px 10px;
    border-radius: 8px;
}

.total-amount:hover {
    transform: scale(1.05);
}

/* Bottom Navigation */
.bottom-nav {
    display: flex;
    justify-content: space-around;
    background-color: #ffffff;
    padding: 10px 0;
    box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.1);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
}

.bottom-nav .nav-item {
    text-align: center;
    color: #555;
    text-decoration: none;
    transition: color 0.2s ease;
}

.bottom-nav .nav-item.active {
    color: #128C7E;
    font-weight: bold;
}

.bottom-nav .nav-item i {
    font-size: 24px;
    display: block;
}

.bottom-nav .nav-item span {
    font-size: 12px;
}

.bottom-nav .nav-item:hover {
    color: #128C7E;
}

/* Index Styles */
.search-container {
    padding: 15px 20px;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.search-container input {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 20px;
    outline: none;
    font-size: 16px;
    background-color: #f0f2f5;
    color: #333;
    box-sizing: border-box;
}

/* Contact List Styles */
.contact-list {
    padding: 0;
    margin: 0;
}

.contact-item {
    display: flex;
    align-items: center;
    background-color: white;
    padding: 15px;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.contact-item.non-regular {
    background-color: #f9f9f9;
    opacity: 0.8;
}

.avatar {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 15px;
    font-weight: bold;
    flex-shrink: 0;
}

.contact-info {
    flex-grow: 1;
    min-width: 0;
}

.contact-info h5 {
    margin: 0;
    font-size: 16px;
    color: #128C7E;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-info small {
    display: block;
    color: #888;
    font-size: 12px;
    line-height: 1.4;
}

.truncate-text {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- ** FINAL, FOOLPROOF Contact Actions & Tooltip Styles ** --- */
.contact-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    color: #8C8C8C;
    padding-left: 10px;
}

.contact-actions span,
.contact-actions .action-icon i {
    background-color: #f0f2f5;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.contact-actions span {
    font-size: 14px;
    color: #2979B6;
    font-weight: bold;
}

.contact-actions .action-icon {
    text-decoration: none;
    position: relative;
}

.contact-actions .action-icon i {
    font-size: 16px;
    cursor: pointer;
    color: #555;
}

.contact-actions .action-icon.disabled {
    opacity: 0.5;
    cursor: pointer;
}

/* Tooltip Base Styles */
.action-icon[data-tooltip]::after,
.action-icon[data-tooltip]::before {
    content: '';
    position: absolute;
    opacity: 0;
    visibility: hidden;
    z-index: 10;
    transition: opacity 0.3s, visibility 0.3s;
}

.action-icon[data-tooltip]::after {
    content: attr(data-tooltip);
    bottom: 125%;
    background-color: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    width: 120px;
    white-space: normal;
    text-align: center;

    /* --- FIX: Align from the right to prevent overflow --- */
    right: 0;
}

.action-icon[data-tooltip]::before {
    bottom: 100%;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;

    /* --- FIX: Position the arrow relative to the right edge --- */
    right: 8px;
    /* Puts the arrow roughly in the middle of the 30px icon */
}

/* Show on Mobile Click via JS - This is the ONLY rule to show the tooltip */
.action-icon.tooltip-visible::after,
.action-icon.tooltip-visible::before {
    opacity: 1;
    visibility: visible;
}


/* --- Profile Page & Other Pages Styles --- */
.profile-container,
.container {
    max-width: 600px;
    margin: auto;
    background: #f2f2f2;
    padding: 10px;
    box-shadow: none;
}

.profile-header-card {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border-top: 4px solid #128C7E;
    margin-bottom: 20px;
}

.profile-header-top {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.avatar.large {
    width: 70px;
    height: 70px;
    font-size: 32px;
}

.name-details h1 {
    margin: 0;
    font-size: 24px;
    color: #333;
}

.name-details p {
    margin: 4px 0 0 0;
    color: #777;
    font-size: 14px;
}

.profile-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 25px;
}

.info-item {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #555;
}

.info-item i {
    color: #128C7E;
    font-size: 16px;
}

.info-item.bakaya {
    padding: 8px 12px;
    gap: 12px;
}

.bakaya-details span {
    display: block;
    font-size: 12px;
    line-height: 1.2;
}

.bakaya-details strong {
    font-size: 24px;
    line-height: 1;
}

.info-item.no-bakaya {
    background-color: #e7f7ef;
    color: #128C7E;
}

.info-item.no-bakaya i,
.info-item.no-bakaya strong {
    color: #28a745;
}

.info-item.high-bakaya {
    background-color: #fdeaea;
    color: #c9302c;
}

.info-item.high-bakaya i,
.info-item.high-bakaya strong {
    color: #dc3545;
}

.info-item.is-regular {
    background-color: #e7f7ef;
    color: #128C7E;
    font-weight: bold;
}

.info-item.is-regular i {
    color: #28a745;
}

.info-item.not-regular {
    background-color: #fff8e1;
    color: #e67e22;
}

.info-item.not-regular i {
    color: #e67e22;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.action-button {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 10px;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
    gap: 8px;
}

.action-button:not(.disabled):hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.action-button:not(.disabled):active {
    transform: translateY(1px);
}

.call-now {
    background-color: #007bff;
}

.whatsapp {
    background-color: #25D366;
}

.action-button.disabled {
    background-color: #cdd2d6;
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.payment-history-list {
    margin-top: 30px;
    padding: 0 10px;
}

.month-card {
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
    padding: 15px 20px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 5px solid transparent;
    transition: all 0.3s ease;
}

.month-card:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.month-card.paid {
    border-left-color: #28a745;
}

.month-card.not-paid {
    border-left-color: #dc3545;
}

.month-details {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #333;
    font-weight: 500;
}

.month-details i {
    color: #128C7E;
}

.payment-status .status-badge {
    display: inline-block;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
    min-width: 90px;
    text-align: center;
}

.payment-status.paid .status-badge {
    background-color: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.payment-status.not-paid .status-badge {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.payment-status small {
    font-weight: normal;
    font-size: 0.9em;
    color: #555;
}

.summary-cards-container {
    display: flex;
    gap: 15px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.summary-card {
    background-color: #fff;
    border-radius: 10px;
    padding: 20px;
    flex: 1;
    min-width: 180px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.07);
    border-top: 4px solid;
}

.summary-card i {
    font-size: 2em;
}

.summary-card .card-content span {
    font-size: 0.9em;
    color: #666;
    display: block;
}

.summary-card .card-content h4 {
    margin: 5px 0 0 0;
    font-size: 1.5em;
    color: #333;
}

.summary-card.green {
    border-color: #28a745;
}

.summary-card.green i {
    color: #28a745;
}

.summary-card.red {
    border-color: #dc3545;
}

.summary-card.red i {
    color: #dc3545;
}

.summary-card.blue {
    border-color: #007bff;
}

.summary-card.blue i {
    color: #007bff;
}

.expenses-container {
    padding: 10px 0;
}

.category-accordion {
    margin-bottom: 15px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.category-header {
    background-color: #fff;
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.3s ease;
}

.category-header:hover {
    background-color: #f8f9fa;
}

.category-title {
    font-size: 1.1em;
    font-weight: bold;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-total-amount {
    font-size: 1em;
    font-weight: 500;
    color: #d9534f;
}

.category-header .toggle-icon {
    font-size: 1em;
    color: #555;
    transition: transform 0.3s ease;
}

.category-header.open .toggle-icon {
    transform: rotate(180deg);
}

.expenses-list {
    display: none;
    background-color: #f8f9fa;
    padding: 15px;
}

.expense-card {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    border-left: 4px solid #495057;
}

.expense-card:last-child {
    margin-bottom: 0;
}

.expense-card h5 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 1em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.expense-amount {
    font-weight: bold;
    color: #444;
}

.expense-card p {
    margin: 4px 0;
    color: #666;
    font-size: 0.9em;
    line-height: 1.5;
}

.expense-card p i {
    margin-right: 8px;
    color: #999;
}

.timeline-container {
    margin-top: 30px;
}

.timeline-year {
    text-align: center;
    margin: 20px 0;
}

.timeline-year span {
    background-color: #007bff;
    color: white;
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 1em;
    font-weight: bold;
}

.timeline {
    list-style: none;
    padding-left: 30px;
    position: relative;
    border-left: 3px solid #dee2e6;
}

.timeline-item {
    position: relative;
    margin-bottom: 25px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -37.5px;
    top: 5px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background-color: #fff;
    border: 3px solid #007bff;
}

.timeline-content {
    background-color: #fff;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease;
}

.timeline-item:hover .timeline-content {
    transform: translateX(5px);
}

.timeline-content h5 {
    margin: 0 0 10px 0;
    font-size: 1.1em;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 8px;
}

.timeline-content p {
    margin: 0;
    font-size: 1.6em;
    font-weight: bold;
    color: #343a40;
}

.page-description {
    margin-bottom: 25px;
    color: #555;
    font-size: 1em;
    line-height: 1.6;
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.page-description p {
    margin: 0;
}

.page-description p:last-child {
    margin-top: 10px;
}

.bakaya-months[data-value="0"] {
    color: green;
}

.bakaya-months[data-value]:not([data-value="0"]) {
    color: red;
}

.category-total {
    display: none;
}