/* ==============================================
   1. VARIABLES & GLOBAL RESETS
============================================== */
:root {
    --primary-color: #674FA3; /* Main Purple */
    --primary-hover: #56428a; /* Darker Purple */
    --gradient-start: #f2e9ff;
    --gradient-end: #dcd3ee;
    --white-color: #FFFFFF;
    --light-gray-bg: #f4f6f9;
    --text-color: #34495e; /* This is a dark color we can use for text */
    --text-muted: #7f8c8d;
    --border-color: #ecf0f1;
    --input-bg-color: #f8f9fa;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    background-color: var(--light-gray-bg);
    color: var(--text-color);
}
a { text-decoration: none; }

/* ==============================================
   2. LOGIN PAGE STYLES
============================================== */
.login-body { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end)); padding: 20px; }
.login-container { width: 100%; max-width: 400px; background-color: var(--white-color); padding: 30px; border-radius: 20px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,0.1); }
.login-logo img { max-width: 90px; margin-bottom: 20px; }
.login-container h2 { font-size: 2rem; font-weight: 700; color: var(--text-color); }
.login-container .subtitle { color: var(--text-muted); margin-bottom: 30px; font-size: 0.95rem; }
.login-form .input-group { position: relative; margin-bottom: 20px; }
.login-form .input-icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.login-form input { width: 100%; padding: 14px 15px 14px 50px; border: 1px solid var(--border-color); background-color: var(--input-bg-color); border-radius: 12px; font-size: 1rem; font-family: 'Poppins', sans-serif; }
.forgot-password { display: block; text-align: right; margin-bottom: 25px; font-size: 0.9em; color: var(--primary-color); }
.btn-login { width: 100%; padding: 15px; background-color: var(--primary-color); color: var(--white-color); border: none; border-radius: 12px; font-size: 1.1rem; font-weight: 500; cursor: pointer; box-shadow: 0 8px 20px rgba(103, 79, 163, 0.3); transition: all 0.3s ease; }
.btn-login:hover { background-color: var(--primary-hover); transform: translateY(-2px); }
.signup-link { margin-top: 30px; color: var(--text-muted); font-size: 0.9em; }
.signup-link a { color: var(--primary-color); font-weight: 500; }
.error-box { background-color: #f8d7da; color: #721c24; padding: 10px; border-radius: 8px; margin-bottom: 20px; text-align: center; }

.main-footer { background-color: var(--white-color); border-top: 1px solid var(--border-color); padding: 15px 25px; margin-top: auto; display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 15px; font-size: 12px; color: var(--text-muted); }
.footer-logo { height: 40px; width: 40px; border-radius: 50%; object-fit: cover; }

/* ==============================================
   3. APP LAYOUT
============================================== */
.app-container {
    /* ### CHANGED: Reduced top padding to decrease space ### */
    padding: 50px 0 90px 0;
}
.app-header { position: fixed; top: 0; left: 0; width: 100%; background-color: var(--white-color); padding: 10px 15px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 10px rgba(0,0,0,0.05); z-index: 100; }
.header-logo { height: 40px; }
.header-right { display: flex; align-items: center; gap: 15px; }
.member-name { font-weight: 500; }
.member-avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.logout-icon { font-size: 1.1rem; color: var(--text-muted); }
.app-content { padding: 15px; }
.app-footer { position: fixed; bottom: 0; left: 0; width: 100%; background-color: var(--white-color); display: flex; justify-content: space-around; box-shadow: 0 -2px 10px rgba(0,0,0,0.05); z-index: 100; padding-top: 5px; }
.footer-link { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 12px 7px; color: var(--text-muted); font-size: 10px; flex-grow: 1; }
.footer-link i { font-size: 20px; margin-bottom: 7px; }
.footer-link.active { color: var(--primary-color); }

/* ==============================================
   4. GENERAL COMPONENTS
============================================== */
.page-header { margin-bottom: 20px; }
.page-title { font-size: 1.5rem; font-weight: 700; }
.page-subtitle { color: var(--text-muted); }
.card { background-color: var(--white-color); border-radius: 12px; margin-bottom: 20px; overflow: hidden; }
.card-header { font-weight: 500; padding: 15px; border-bottom: 1px solid var(--border-color); }
.card-body { padding: 15px; }

/* ==============================================
   5. DASHBOARD STYLES
============================================== */
.membership-card { background-color: var(--primary-color); border-radius: 20px; padding: 20px; color: var(--white-color); position: relative; overflow: hidden; margin-bottom: 30px; box-shadow: 0 10px 25px rgba(103, 79, 163, 0.3); }
.card-bg { position: absolute; top: -50px; right: -50px; width: 200px; height: 200px; background-color: rgba(255, 255, 255, 0.1); border-radius: 50%; }
.card-content { position: relative; z-index: 2; }
.card-header-line { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(255, 255, 255, 0.3); padding-bottom: 10px; margin-bottom: 15px; }
.card-logo { height: 30px; opacity: 0.8; }
.card-title { font-weight: 500; font-size: 1rem; }
.card-main { display: flex; align-items: center; }
.member-photo img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 3px solid var(--white-color); margin-right: 20px; }
.member-details { display: flex; flex-direction: column; }
.member-card-name { font-size: 1.2rem; font-weight: 700; margin-bottom: 5px; }
.member-card-info { font-size: 0.85rem; opacity: 0.9; }
.member-card-info strong { font-weight: 500; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.section-title { font-size: 1.2rem; font-weight: 700; }
.section-view-all { font-size: 0.9rem; color: var(--primary-color); font-weight: 500; }
.post-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; margin-bottom: 30px; }
.post-card-small { background-color: var(--white-color); border-radius: 10px; overflow: hidden; box-shadow: 0 5px 15px rgba(0,0,0,0.05); }
.post-card-small img { width: 100%; height: 100px; object-fit: cover; }
.post-card-title1 { font-size: 0.9rem; font-weight: 500; color: var(--text-color); margin-bottom: 10px; text-align: center;}
.activity-list { list-style: none; padding: 0; }
.activity-item { display: flex; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border-color); }
.activity-item:last-child { border-bottom: none; }
.activity-icon { width: 40px; height: 40px; border-radius: 50%; background-color: var(--light-gray-bg); color: var(--primary-color); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; margin-right: 15px; }
.activity-details { display: flex; flex-direction: column; }
.activity-details span { font-weight: 500; }
.activity-details small { color: var(--text-muted); }



/* ==============================================
   6. PROFILE PAGE STYLES
============================================== */
.profile-header {
    text-align: center;
    padding: 20px 0;
    margin-bottom: 20px;
}
.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--white-color);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    margin-bottom: 15px;
}
.profile-name {
    font-size: 1.5rem;
    font-weight: 700;
}
.profile-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}
.info-row:last-child {
    border-bottom: none;
}
.info-label {
    font-weight: 500;
    color: var(--text-muted);
}
.info-value {
    font-weight: 500;
    text-align: right;
}

/* Form Styles for Profile Page */
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}
.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    background-color: var(--input-bg-color);
}
.btn-primary {
    width: 100%;
    padding: 14px;
    background-color: var(--primary-color);
    color: var(--white-color);
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
}

/* Alert Message Styles */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 10px;
}
.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}
.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

/* ==============================================
   7. POSTS PAGE STYLES
============================================== */

/* --- Filter Bar --- */
.filter-card .card-body {
    padding: 10px;
}
.filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
}
.filter-group .form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--input-bg-color);
}
.btn-filter {
    width: 100%;
    height: 100%;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: var(--white-color);
    border: none;
    border-radius: 8px;
    font-weight: 500;
}

/* --- Post List --- */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.post-card-large {
    display: block;
    background-color: var(--white-color);
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    overflow: hidden;
}
.post-card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
}
.post-card-content {
    padding: 15px;
}
.post-card-category {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--primary-color);
    margin-bottom: 5px;
    display: inline-block;
}
.post-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 10px;
    
}
.post-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* --- Single Post View --- */

.post-view-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.post-view-content {
    padding: 0 10px;
}
.post-view-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 15px;
}
.post-view-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 10px;
    font-size: 0.80rem;
    color: var(--text-muted);
    margin-bottom: 25px;
}
.post-view-meta strong {
    color: var(--text-color);
}
.post-view-body {
    line-height: 1.7;
    font-size: 1rem;
}
.post-view-body p {
    margin-bottom: 1.5em;
}
.btn-back {
    display: inline-block;
    margin: 20px 10px;
    font-weight: 500;
    color: var(--primary-color);
}

/* ==============================================
   8. BUTTON STYLES
============================================== */

/* Base style for all buttons in the member panel */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.3s;
}

/* Gray button style */
.btn-secondary {
    background-color: #e9ecef;
    color: var(--text-color);
}
.btn-secondary:hover {
    background-color: #dee2e6;
}

/* Container for the back button to center it */
.back-button-container {
    text-align: center;
    padding: 10px 15px 20px 15px;
}

/* ==============================================
   7. POSTS PAGE STYLES
============================================== */

/* --- Filter Bar --- */
.filter-card .card-body { padding: 10px; }
.filter-grid { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; }
.filter-group .form-control { width: 100%; padding: 10px; border: 1px solid var(--border-color); border-radius: 8px; background-color: var(--input-bg-color); }
.btn-filter { width: 100%; height: 100%; padding: 10px 20px; background-color: var(--primary-color); color: var(--white-color); border: none; border-radius: 8px; font-weight: 500; }

/* --- Post List --- */
.post-list { display: flex; flex-direction: column; gap: 20px; }
.post-card-large { display: block; background-color: var(--white-color); border-radius: 15px; box-shadow: 0 5px 15px rgba(0,0,0,0.05); overflow: hidden; }
.post-card-image { width: 100%; height: 180px; object-fit: cover; }
.post-card-content { padding: 15px; }
.post-card-category { font-size: 0.8rem; font-weight: 500; color: var(--primary-color); margin-bottom: 5px; display: inline-block; }
.post-card-title { font-size: 1.1rem; font-weight: 600; color: var(--text-color); margin-bottom: 10px; }
.post-card-meta { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); }

/* --- Single Post View --- */
.post-view-title { font-size: 1.4rem; font-weight: 600; margin-bottom: 15px; color: var(--text-color); }
.post-view-meta { display: flex; flex-wrap: wrap; gap: 5px 10px; font-size: 0.80rem; color: var(--text-muted); margin-bottom: 25px; border-bottom: 1px solid var(--border-color); padding-bottom: 15px; }
.post-view-meta strong { color: var(--text-color); }
.post-view-body { line-height: 1.7; font-size: 1rem; color: #555; }
.post-view-body p { margin-bottom: 1.5em; }

/* Back Button */
.back-button-container { text-align: center; padding: 10px 15px 20px 15px; }
.btn-secondary { background-color: #e9ecef; color: var(--text-color); }
.btn-secondary:hover { background-color: #dee2e6; }


/* ==============================================
   7. BUTTON STYLES
============================================== */
.btn { display: inline-block; padding: 10px 20px; border: none; border-radius: 10px; font-size: 0.95rem; font-weight: 500; cursor: pointer; text-align: center; transition: background-color 0.3s; }
.btn-primary { width: 100%; padding: 14px; background-color: var(--primary-color); color: var(--white-color); }
.btn-secondary { background-color: #e9ecef; color: var(--text-color); }

/* ==============================================
   8. DONATIONS PAGE STYLES (CORRECTED)
============================================== */
.add-new-donation-container { 
    margin-bottom: 20px; 
}

.donation-card {
    background-color: var(--white-color);
    border-radius: 15px;
    margin-bottom: 20px;
    overflow: hidden;
    /* ### ADDED: Shadow similar to post cards ### */
    box-shadow: 0 5px 15px rgba(0,0,0,0.05); 
}

.donation-card-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}
.donation-type {
    font-size: 1.05rem; /* Slightly reduced font size */
    font-weight: 700;
}
.donation-card-body {
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* Creates three equal columns */
    gap: 10px;
    text-align: center;
}
.amount-item { 
    display: flex; 
    flex-direction: column; 
    padding: 10px;
    background-color: var(--light-gray-bg);
    border-radius: 10px;
}
.amount-item small {
    font-size: 0.8rem; /* Decreased font size */
    color: var(--text-muted);
    margin-bottom: 5px;
}
.amount-item span { 
    font-size: 1rem; /* Decreased font size */
    font-weight: 700; 
}
.amount-item .balance.due { 
    color: #dc3545; 
}
.amount-item .balance.paid { 
    color: #28a745; 
}
.donation-card-footer {
    padding: 0 15px 15px 15px;
    text-align: right;
}
.btn-outline-primary {
    display: inline-block;
    border: 1px solid var(--primary-color);
    background-color: transparent;
    color: var(--primary-color);
    padding: 8px 18px;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 8px;
}
.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: var(--white-color);
}



/* ==============================================
   9. MATRIMONIAL PAGES STYLES (CORRECTED & RESPONSIVE)
============================================== */

/* --- Filter Bar --- */
.filter-card .card-body { padding: 10px; }
.matrimonial-filter-grid {
    display: grid;
    /* Adjust columns for different screen sizes */
    grid-template-columns: repeat(2, 1fr); /* Default to 2 columns */
    gap: 10px;
    align-items: center;
}
/* Make age inputs smaller */
.age-filter { display: flex; align-items: center; gap: 5px; }
.age-filter input { width: calc(50% - 5px); } /* Adjust width */
.age-filter span { text-align: center; }

/* Apply button styles */
.btn-filter { width: 100%; height: 42px; padding: 10px; background-color: var(--primary-color); color: var(--white-color); border: none; border-radius: 8px; font-weight: 500; }
.btn-clear { display: block; height: 42px; padding: 10px; background-color: var(--light-gray-bg); color: var(--text-muted); border: 1px solid var(--border-color); border-radius: 8px; text-align: center; font-size: 14px; width: 100%; }

/* --- Profile Grid (List Page) --- */
.matrimonial-profile-grid {
    display: grid;
    /* Responsive grid columns */
    grid-template-columns: repeat(2, 1fr); /* Default to 2 columns */
    gap: 15px;
}
.profile-card { background-color: var(--white-color); border-radius: 15px; box-shadow: 0 5px 15px rgba(0,0,0,0.05); overflow: hidden; text-align: center; }
.profile-card-image { width: 100%; height: 160px; object-fit: cover; display: block; }
.profile-card-body { padding: 12px; }
.profile-card-name { font-size: 1rem; font-weight: 600; margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-card-info { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-card-info i { margin-right: 3px; }

/* --- Matrimonial Profile Edit Page --- */
.form-section { border: 1px solid var(--border-color); border-radius: 10px; padding: 20px; margin-bottom: 25px; background-color: var(--white-color); }
.form-section-title { font-size: 1.1rem; font-weight: 600; color: var(--primary-color); margin-bottom: 20px; padding-bottom: 10px; border-bottom: 1px solid var(--border-color); }
.profile-avatar-edit {
    display: block; /* Ensures centering works */
    width: 120px; /* Corrected size */
    height: 120px; /* Corrected size */
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 15px auto; /* Centers the image */
    border: 3px solid var(--white-color);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.form-group .text-muted { font-size: 0.85em; }

/* --- Matrimonial View Page (Single Profile) --- */
.matrimonial-view-profile-pic { width: 150px; height: 150px; border-radius: 50%; object-fit: cover; margin: 10px auto 20px auto; display: block; border: 5px solid var(--white-color); box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.detail-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
.detail-label { font-weight: 500; color: var(--text-muted); flex-shrink: 0; margin-right: 20px; width: 150px; }
.detail-value { color: var(--text-color); text-align: right; }

/* ==============================================
   10. RESPONSIVE ADJUSTMENTS FOR MATRIMONIAL
============================================== */
@media (min-width: 576px) {
    /* More columns for filters on slightly larger screens */
    .matrimonial-filter-grid {
        grid-template-columns: repeat(4, 1fr) auto auto; /* Sex, AgeMin, AgeMax, Edu, Filter, Clear */
    }
     .age-filter {
        grid-column: span 2; /* Make age filter span two columns */
        display: flex;
    }
     .age-filter input { width: calc(50% - 5px); }
     .filter-group:last-child {
        grid-column: span 2; /* Make buttons span two columns */
        display: flex; gap: 10px;
     }
}

@media (min-width: 768px) {
    /* More profile columns on tablets */
    .matrimonial-profile-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 992px) {
    /* Even more profile columns on desktop */
    .matrimonial-profile-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}