* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --primary-color: #1a5f7a;
    --secondary-color: #57cc99;
    --accent-color: #ffd166;
    --admin-color: #ff6b6b;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
}

body {
    background-color: #f5f7fa;
    color: var(--dark-color);
    line-height: 1.6;
}

/* Header & Navigation */
header {
    background-color: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.logo {
    display: flex;
    align-items: center;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary-color);
      gap: 12px;
}

.logo i {
    font-size: 1.6rem; /* Larger icon */
    padding: 8px; /* Padding around icon */
    border-radius: 50%; /* Makes icon background circular */
    background-color: rgba(87, 204, 153, 0.15); /* Light green background */
    color: var(--primary-color); /* Changes icon color to blue */
    box-shadow: 0 3px 6px rgba(26, 95, 122, 0.1); /* Subtle shadow */
}

.logo span {
    background: linear-gradient(90deg, var(--primary-color), #2a8fb8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}


.user-role {
    background-color: var(--secondary-color);
    color: white;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    margin-left: 10px;
}

.user-role.admin {
    background-color: var(--admin-color);
}

.nav-links {
    display: flex;
    list-style: none;
}

.nav-links li {
    margin-left: 25px;
}

.nav-links a {
    text-decoration: none;
    color: var(--dark-color);
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--primary-color);
}

.nav-links a.active {
    color: var(--secondary-color);
    font-weight: 600;
}

.hamburger {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 160px);
    padding: 30px 0;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.login-box {
    background-color: white;
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 450px;
}

.login-box h2 {
    margin-bottom: 25px;
    color: var(--primary-color);
    text-align: center;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group .password-info {
    font-size: 0.85rem;
    color: #666;
    margin-top: 5px;
}

.btn {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color 0.3s;
    text-align: center;
}

.btn:hover {
    background-color: #0d4c63;
}

.btn-secondary {
    background-color: var(--secondary-color);
}

.btn-secondary:hover {
    background-color: #3daa7a;
}

.btn-admin {
    background-color: var(--admin-color);
}

.btn-admin:hover {
    background-color: #e05555;
}

/* Role Selection */
.role-selection {
    display: flex;
    margin-bottom: 25px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.role-option {
    flex: 1;
    text-align: center;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.role-option:hover {
    background-color: #f5f5f5;
}

.role-option.selected {
    background-color: var(--primary-color);
    color: white;
}

.role-option.admin.selected {
    background-color: var(--admin-color);
}

.role-option i {
    display: block;
    font-size: 1.5rem;
    margin-bottom: 5px;
}

/* Home Page */
.welcome-section {
    text-align: center;
    margin-bottom: 40px;
}

.welcome-section h1 {
    color: var(--primary-color);
    margin-bottom: 15px;
    margin-left: 20px;
}

.welcome-section p {
    max-width: 800px;
    margin: 0 auto 30px;
    color: #666;
}

.slider-container {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    height: 400px;
    overflow: hidden;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.slider {
    display: flex;
    width: 300%;
    height: 100%;
    transition: transform 0.5s ease-in-out;
}

.slide {
    width: 33.33%;
    height: 100%;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.slider-controls {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    text-align: center;
}

.slider-controls button {
    background-color: rgba(255, 255, 255, 0.7);
    border: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin: 0 5px;
    cursor: pointer;
}

.slider-controls .active {
    background-color: var(--primary-color);
}

.info-cards {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 40px;
}

.info-card {
    background-color: white;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
    width: 250px;
}

.info-card h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.info-card .count {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--secondary-color);
}

/* Villages Page */
.page-title {
    margin-bottom: 30px;
    margin: 20px 20px;
    color: var(--primary-color);
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 10px;
}

.village-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.village-card {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.3s;
}

.village-card:hover {
    transform: translateY(-5px);
}

.village-card h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

/* Members Page */
.search-filter {
    background-color: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.search-filter h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.search-box input {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.filter-options select {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
}

.members-table {
    width: 100%;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 30px;
}

.members-table table {
    width: 100%;
    border-collapse: collapse;
}

.members-table th, .members-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.members-table th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
}

.members-table tr:hover {
    background-color: #f9f9f9;
}

.mobile-hidden {
    color: #666;
}

/* Family Details */
.family-details-container {
    display: none;
    margin-top: 30px;
}

.family-card {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.family-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.family-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 25px;
    border: 3px solid var(--secondary-color);
}

.family-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.family-info h3 {
    color: var(--primary-color);
    margin-bottom: 8px;
}

.family-info p {
    color: #666;
    margin-bottom: 5px;
}

.address-section {
    display: flex;
    gap: 30px;
    margin-bottom: 25px;
}

.address-box {
    flex: 1;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: var(--border-radius);
}

.address-box h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #ddd;
}

.children-section {
    margin-bottom: 25px;
}

.children-section h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.children-list {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.child-item {
    background-color: #f0f9ff;
    padding: 12px 15px;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--secondary-color);
}

/* ===== MOBILE RESPONSIVE FIXES FOR MEMBERS PAGE ===== */

/* For tablets and smaller screens */
@media (max-width: 768px) {
    /* Family card layout */
    .family-card {
        padding: 15px;
    }
    
    .family-card > div {
        flex-direction: column;
        gap: 20px;
    }
    
    /* Family photo on mobile */
    .family-photo {
        width: 200px;
        height: 150px;
        border-radius: 10px;
        margin: 0 auto 15px auto;
        border: 3px solid var(--primary-color);
    }
    
    /* Hide ID badge on mobile if needed */
    .family-card .family-photo + div {
        top: 10px;
        left: 10px;
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }
    
    /* Table container for horizontal scrolling */
    .family-card .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border: 1px solid #eee;
        border-radius: var(--border-radius);
        margin-bottom: 20px;
    }
    
    /* Ensure table has minimum width */
    .family-card table {
        min-width: 600px;
    }
    
    /* Compact table cells */
    .family-card table th,
    .family-card table td {
        padding: 10px 8px;
        font-size: 0.9rem;
        white-space: nowrap;
        min-width: 80px;
    }
    
    /* Smaller table headers */
    .family-card table th {
        font-size: 0.85rem;
        padding: 8px 6px;
    }
    
    /* Address boxes stack on mobile */
    .address-section {
        flex-direction: column;
        gap: 15px;
    }
    
    .address-box {
        padding: 12px;
    }
    
    /* Search filter adjustments */
    .search-filter {
        padding: 15px;
    }
    
    .search-box {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-box input,
    .search-box button {
        width: 100%;
    }
    
    .filter-options {
        flex-direction: column;
        gap: 10px;
    }
    
    .filter-options select {
        width: 100%;
    }
}

/* For phones (very small screens) */
@media (max-width: 480px) {
    /* Hide table on very small screens and show mobile cards */
    .family-card table {
        display: none;
    }
    
    /* Show mobile family view */
    .mobile-family-view {
        display: block !important;
    }
    
    /* Mobile family member card */
    .mobile-family-member {
        background: white;
        border: 1px solid #eee;
        border-radius: 8px;
        padding: 15px;
        margin-bottom: 10px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }
    
    .mobile-member-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 10px;
        padding-bottom: 10px;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .mobile-member-header strong {
        color: var(--primary-color);
        font-size: 1.1rem;
        flex: 1;
    }
    
    .mobile-member-relation {
        background: var(--secondary-color);
        color: white;
        padding: 3px 10px;
        border-radius: 12px;
        font-size: 0.8rem;
        font-weight: 500;
    }
    
    .mobile-member-details {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        font-size: 0.9rem;
    }
    
    .mobile-detail-item {
        margin-bottom: 5px;
    }
    
    .mobile-detail-label {
        font-weight: 600;
        color: #666;
        font-size: 0.85rem;
    }
    
    .mobile-detail-value {
        color: #333;
    }
    
    /* Smaller photo on mobile */
    .family-photo {
        width: 150px;
        height: 120px;
    }
    
    /* Adjust village cards */
    .village-card {
        padding: 15px;
    }
    
    .village-card h3 {
        font-size: 1.1rem;
    }
}

/* Hide mobile view by default (for larger screens) */
.mobile-family-view {
    display: none;
}

/* Touch-friendly improvements */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Ensure no text overlap on mobile */
@media (max-width: 768px) {
    .family-info h3 {
        font-size: 1.2rem;
    }
    
    .family-info p {
        font-size: 0.9rem;
    }
    
    .address-box h4 {
        font-size: 1rem;
    }
    
    .address-box p {
        font-size: 0.9rem;
        line-height: 1.4;
    }
}

/* Profile Page */
.profile-container {
    background-color: white;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.profile-header {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.profile-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 30px;
    border: 3px solid var(--secondary-color);
}

.profile-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info h2 {
    color: var(--primary-color);
    margin-bottom: 5px;
}

.profile-info p {
    color: #666;
}

.profile-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.profile-form .form-group.full-width {
    grid-column: 1 / -1;
}

/* Gallery Page */
.gallery-grid {
    display: grid;
   
    gap: 20px;
    margin-bottom: 30px;
}

.gallery-item {
    border-radius: var(--border-radius);
    overflow: hidden;
    height: 200px;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* Admin Dashboard */
.admin-container {
    display: flex;
    min-height: 80vh;
}

.sidebar {
    width: 250px;
    background-color: var(--primary-color);
    padding: 20px 0;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 5px;
}

.sidebar-menu a {
    display: block;
    color: white;
    text-decoration: none;
    padding: 15px 25px;
    transition: background-color 0.3s;
}

.sidebar-menu a:hover, .sidebar-menu a.active {
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-menu i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.admin-main {
    flex: 1;
    padding: 30px;
}

.admin-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    color: var(--primary-color);
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.modal-body {
    padding: 20px;
}

/* Footer */
footer {
    background-color: var(--dark-color);
    color: white;
    padding: 25px 0;
    text-align: center;
    margin-top: 40px;
}

/* Responsive Styles */
@media (max-width: 1200px) {
    .container {
        max-width: 100%;
        padding: 0 15px;
    }
}

@media (max-width: 992px) {
    .profile-form {
        grid-template-columns: 1fr;
    }

    .admin-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        margin-bottom: 20px;
    }

    .address-section {
        flex-direction: column;
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .hamburger {
        display: block;
        margin-left: auto; /* This pushes hamburger to right */
        z-index: 1000;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%; /* Start off-screen on the RIGHT */
        width: 200px; /* Fixed width for right sidebar */
        height: 88vh;
        background-color: var(--primary-color);
        flex-direction: column;
        align-items: flex-start;
        padding: 80px 20px 20px;
        box-shadow: var(--shadow);
        transition: right 0.3s ease; /* Animate RIGHT property */
        z-index: 999;
        opacity: 1;
        transform: none;
        left: auto; /* Ensure left is not set */
    }

    .nav-links.active {
        right: 0; /* Slide in from RIGHT */
        opacity: 1;
        transform: none;
    }

    .nav-links li {
        margin: 10px 0;
        width: 100%;
    }

    .nav-links a {
        display: block;
        padding: 12px 15px;
        color: white;
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-links a:hover,
    .nav-links a.active {
        background-color: rgb(255, 255, 255);
        padding-left: 20px;
    }

    /* Fix header container */
    header {
        padding: 0 15px;
    }
    
    .container {
        padding: 0 15px;
    }
    
    /* Compact navbar for mobile */
    .navbar {
        padding: 12px 0;
        position: relative;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    /* Logo adjustments for mobile - FIXED */
    .logo {
        display: flex;
        align-items: center;
        font-size: 1.2rem;
        gap: 8px;
        flex: 1; /* Take available space */
        min-width: 0; /* Allow shrinking */
        overflow: hidden; /* Contain child elements */
    }
    
    .logo img {
        height: 70px !important; /* Smaller logo */
        margin-right: 8px !important;
        flex-shrink: 0; /* Don't shrink image */
    }
    
    .logo span {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1; /* Take remaining space */
        min-width: 0; /* Allow text truncation */
    }
    
    /* User role badge adjustments */
    .user-role {
        font-size: 0.7rem;
        padding: 2px 8px;
        margin-left: 8px;
        flex-shrink: 0; /* Don't shrink badge */
    }
    
    /* Hamburger menu - FIXED POSITIONING */
    .hamburger {
        display: flex;
        align-items: center;
        justify-content: center;
        margin-left: 10px;
        flex-shrink: 0; /* Don't shrink */
        font-size: 1.4rem;
        padding: 8px;
        background: none;
        border: none;
        cursor: pointer;
    }

}

/* Ensure logo text wraps on mobile */
@media (max-width: 768px) {
    .logo {
        flex-wrap: wrap;
        min-height: 50px; /* Ensure enough vertical space */
    }
    
    .logo span {
        display: block;
        width: 100%;
        margin-top: 5px;
    }
}


/* For phones */
@media (max-width: 480px) {
    /* Compact header */
    header {
        padding: 0 10px;
    }
    
    .navbar {
        padding: 10px 0;
    }
    
    .logo {
        font-size: 1rem;
        gap: 6px;
    }
    
    .logo img {
        height: 60px !important;
        margin-right: 6px !important;
    }
    
    .logo span {
        font-size: 0.95rem;
        /* Let it shrink more on small screens */
    }
    
    .nav-links {
        width: 250px;
    }
    
    .nav-links a {
        padding: 12px 15px;
        font-size: 0.95rem;
    }
    
    .user-role {
        font-size: 0.6rem;
        padding: 1px 6px;
        margin-left: 6px;
    }
    
    .hamburger {
        font-size: 1.3rem;
        padding: 6px;
        margin-left: 8px;
    }
}

/* For extra small screens - SHORTEN TEXT */
@media (max-width: 360px) {
    .logo span {
        /* Show shorter version: "PAAWA Portal" instead of full text */
        content: "PAAWA Portal";
    }
    
    /* OR if content property doesn't work, use this JavaScript approach */
    .logo {
        font-size: 0.9rem;
    }
    
    .logo img {
        height: 50px !important;
        margin-right: 5px !important;
    }
    
    .nav-links {
        width: 220px;
    }
    
    .nav-links a {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
}


/* Desktop-specific village modal */
@media (min-width: 1024px) {
    .modal-content.large-modal {
        width: 95%;
        max-width: 1400px;
        height: 90vh;
    }
    
    .village-details-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 30px;
        margin-top: 20px;
    }
    
    .village-history {
        font-size: 1.1rem;
        line-height: 1.8;
    }
    
    .village-statistics {
        padding: 25px;
        background-color: #f8f9fa;
        border-radius: var(--border-radius);
        border-left: 4px solid var(--secondary-color);
    }
    
    .village-members-preview {
        background-color: white;
        padding: 20px;
        border-radius: var(--border-radius);
        border: 1px solid #eee;
        margin-top: 20px;
    }
}

.history-box {
  white-space: pre-line;   /* enables \n\n */
  text-align: justify;
  line-height: 1.9;
  font-size: 16px;
  color: #333;
}


/* Admin Modal Styles */
.modal-content .form-group {
    margin-bottom: 15px;
}

.modal-content .form-group.full-width {
    display: flex;
    justify-content: flex-end;
}

/* Gallery Item Admin Styles */
.gallery-item {
    position: relative;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.gallery-item > div {
    padding: 15px;
}

.gallery-item h4 {
    margin: 0 0 5px 0;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.gallery-item p {
    margin: 0 0 10px 0;
    color: #666;
    font-size: 0.9rem;
}

.gallery-item button {
    margin-right: 5px;
    padding: 5px 10px;
    font-size: 0.9rem;
}

/* Table Actions */
.btn-secondary, .btn-admin {
    padding: 5px 10px !important;
    font-size: 0.9rem !important;
    margin-right: 5px !important;
}

/* Loading States */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Form validation */
input:invalid:not(:focus):not(:placeholder-shown),
select:invalid:not(:focus):not(:placeholder-shown) {
    border-color: #dc3545 !important;
}

/* Password error styling */
.password-error {
    color: #dc3545 !important;
    font-weight: 600;
}

.password-error-border {
    border-color: #dc3545 !important;
}

.required::after {
    content: " *";
    color: #dc3545;
}

/* Confirmation Dialog */
.confirmation-dialog {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    max-width: 400px;
    margin: 100px auto;
    text-align: center;
}

.confirmation-dialog h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.confirmation-dialog p {
    margin-bottom: 20px;
    color: #666;
}

.confirmation-dialog .btn-group {
    display: flex;
    justify-content: center;
    gap: 10px;
}


/* File Upload Preview */
#image-preview {
    border: 2px dashed #ddd;
    padding: 10px;
    border-radius: var(--border-radius);
    text-align: center;
    background-color: #f9f9f9;
}

#preview-image {
    max-width: 100%;
    max-height: 200px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* File Input Styling */
input[type="file"] {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    width: 100%;
    background-color: white;
}

input[type="file"]::file-selector-button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    margin-right: 15px;
    transition: background-color 0.3s;
}

input[type="file"]::file-selector-button:hover {
    background-color: #3daa7a;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 15px 20px;
    min-width: 300px;
    max-width: 400px;
    z-index: 10000;
    transform: translateX(150%);
    transition: transform 0.3s ease-in-out;
    border-left: 4px solid var(--secondary-color);
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    border-left-color: var(--secondary-color);
}

.notification.error {
    border-left-color: var(--admin-color);
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notification i {
    font-size: 1.2rem;
    color: var(--secondary-color);
}

.notification.error i {
    color: var(--admin-color);
}

.notification span {
    flex: 1;
    color: var(--dark-color);
    font-weight: 500;
}

.notification-close {
    background: none;
    border: none;
    color: #999;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.notification-close:hover {
    background-color: #f5f5f5;
    color: var(--dark-color);
}

/* Image Cards with Title */
.gallery-item {
    position: relative;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.image-info {
    padding: 15px;
    background: white;
}

.image-info h4 {
    margin: 0 0 8px 0;
    color: var(--primary-color);
    font-size: 1.1rem;
    line-height: 1.3;
}

.image-info p {
    margin: 0 0 10px 0;
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
}

.image-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #888;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

/* Admin Gallery Controls */
#admin-gallery-controls {
    margin-bottom: 20px;
}

#admin-gallery-controls .btn-admin {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}



/* Tablet fixes */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 95%;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
    
    .village-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

/* Mobile menu toggle animation */
.hamburger {
    transition: transform 0.3s;
}

.hamburger.active {
    transform: rotate(90deg);
    color: var(--primary-color);
}

/* Prevent body scrolling when menu is open */
body.menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}


/* Touch-friendly elements */
.btn, 
.village-card, 
.gallery-item,
.role-option {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Improve touch targets */
.btn {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Prevent text selection on interactive elements */
.nav-links a,
.btn,
.role-option,
.slider-dot {
    user-select: none;
    -webkit-user-select: none;
}

/* Improve form input for mobile */
input, select, textarea {
    font-size: 16px; /* Prevents iOS zoom */
}

input[type="text"],
input[type="tel"],
input[type="password"],
input[type="date"],
select,
textarea {
    min-height: 44px;
}

/* ===== PROFILE PAGE ADDRESS LABEL ===== */
#profile-page .address-section {
    margin-bottom: 25px;
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    padding: 20px;
    background-color: #f8f9fa;
}

#profile-page .address-box {
    flex: 1;
    padding: 20px;
    background-color: white;
    border-radius: var(--border-radius);
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

#profile-page .address-box h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--secondary-color);
    font-size: 1.4rem; /* Bigger font size */
    font-weight: 700; /* Bolder */
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#profile-page .address-box p {
    color: #444;
    font-size: 1.1rem; /* Bigger text */
    line-height: 1.6;
    padding: 10px 5px;
}

#profile-page #edit-office,
#profile-page #edit-residence {
    font-size: 1.1rem; /* Bigger input text */
    padding: 14px;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    transition: border-color 0.3s;
}

#profile-page #edit-office:focus,
#profile-page #edit-residence:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(26, 95, 122, 0.1);
}

/* Make the labels for address fields bigger too */
#profile-page .form-group label[for="edit-office"],
#profile-page .form-group label[for="edit-residence"] {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 12px;
    display: block;
}

/* Profile page specific styling */
#profile-page .profile-form .form-group.full-width {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px dashed #ddd;
}

#profile-page .profile-form .form-group {
    margin-bottom: 25px; /* More spacing between fields */
}

#profile-page .profile-form .form-group label {
    font-size: 1.1rem; /* Slightly bigger labels overall */
    font-weight: 600;
    color: #333;
}


/* ===== GALLERY PAGE IMPROVEMENTS ===== */
#gallery-page .page-title {
    margin: 20px 20px;
}

/* Filter controls styling */
#gallery-filter-controls {
    background-color: white;
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    margin-left: 20px;
    margin-right: 20px;
}

#gallery-filter-controls h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.category-filter-btn {
    background-color: #f8f9fa;
    border: 2px solid #e9ecef;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #555;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.category-filter-btn:hover {
    background-color: #e9ecef;
    border-color: #dee2e6;
    transform: translateY(-2px);
}

.category-filter-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 8px rgba(26, 95, 122, 0.2);
}

.category-filter-btn i {
    font-size: 0.9rem;
}

/* Main gallery container */
#gallery-grid {
    margin-left: 20px;
    margin-right: 20px;
}

/* Category section styling */
.category-section {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 30px;
    margin-bottom: 40px;
    transition: transform 0.3s ease;
}

.category-section:hover {
    transform: translateY(-5px);
}

.category-header {
    margin-bottom: 25px;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.category-header h3 {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--primary-color);
    font-size: 1.4rem;
    margin: 0;
}

.category-header i {
    color: var(--accent-color);
    font-size: 1.2rem;
    background-color: rgba(255, 209, 102, 0.1);
    padding: 8px;
    border-radius: 50%;
}

.category-count {
    background-color: var(--secondary-color);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Grid layout for images */
.category-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 10px;
}

@media (max-width: 768px) {
    .category-images-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .category-images-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
}

/* Gallery item improvements */
.gallery-item {
    position: relative;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.gallery-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.gallery-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.image-info {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.image-info h4 {
    margin: 0 0 8px 0;
    color: var(--primary-color);
    font-size: 1rem;
    line-height: 1.3;
    font-weight: 600;
}

.image-info p {
    margin: 0 0 10px 0;
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
    flex-grow: 1;
}

.image-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #888;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

/* Empty state styling */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.empty-state i {
    font-size: 4rem;
    color: #e9ecef;
    margin-bottom: 20px;
}

.empty-state h3 {
    color: #666;
    margin-bottom: 10px;
}

.empty-state p {
    color: #888;
    max-width: 400px;
    margin: 0 auto;
}

/* Back to all button */
.back-to-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    background-color: #f8f9fa;
    border: 2px solid #e9ecef;
    padding: 10px 20px;
    border-radius: 25px;
    color: var(--primary-color);
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s;
}

.back-to-all-btn:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}


/* ===== GALLERY CATEGORY STYLES ===== */
/* ===== HORIZONTAL GALLERY LAYOUT ===== */
.categories-container {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.category-row {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow);
}

.category-header {
    margin-bottom: 20px;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 15px;
}

.category-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
    font-size: 1.4rem;
}

.category-header i {
    color: var(--accent-color);
    font-size: 1.2rem;
}

.category-images-container {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: thin;
}

/* Custom scrollbar */
.category-images-container::-webkit-scrollbar {
    height: 8px;
}

.category-images-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.category-images-container::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.category-images-container::-webkit-scrollbar-thumb:hover {
    background: #0d4c63;
}

.gallery-item {
    flex: 0 0 auto;
    width: 220px;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.gallery-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.image-info {
    padding: 15px;
}

.image-info h4 {
    margin: 0 0 8px 0;
    color: var(--primary-color);
    font-size: 1rem;
    line-height: 1.3;
}

.image-info p {
    margin: 0 0 10px 0;
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
}

.category-badge {
    background-color: var(--secondary-color);
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Responsive horizontal layout */
@media (max-width: 768px) {
    .category-row {
        padding: 15px;
    }
    
    .gallery-item {
        width: 200px;
    }
    
    .gallery-item img {
        height: 160px;
    }
    
    .category-header h3 {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .gallery-item {
        width: 180px;
    }
    
    .gallery-item img {
        height: 140px;
    }
    
    .image-info {
        padding: 10px;
    }
    
    .image-info h4 {
        font-size: 0.9rem;
    }
    
    .image-info p {
        font-size: 0.8rem;
    }
}
/* Gallery Management Table Styles */
.gallery-table-container {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-top: 20px;
}

.gallery-table {
    width: 100%;
    border-collapse: collapse;
}

.gallery-table thead {
    background-color: var(--primary-color);
    color: white;
}

.gallery-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
}

.gallery-table td {
    padding: 15px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.gallery-table tbody tr:hover {
    background-color: #f9f9f9;
}

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

/* Image thumbnail in table */
.gallery-thumbnail {
    width: 170px;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    border: 2px solid #ddd;
}

/* Action buttons */
.action-buttons {
    display: flex;
    gap: 10px;
}

/* Category badges for table */
.table-category-badge {
    display: inline-block;
    background-color: var(--secondary-color);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}


/* ===== ADMIN MOBILE RESPONSIVE FIXES ===== */
@media (max-width: 992px) {
    /* Make admin container stack vertically */
    .admin-container {
        flex-direction: column;
        min-height: auto;
    }
    
    .sidebar {
        width: 100%;
        margin-bottom: 0;
        padding: 0;
        position: sticky;
        top: 60px; /* Below header */
        z-index: 99;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
    
    .sidebar-menu {
        display: flex;
        overflow-x: auto;
        white-space: nowrap;
        padding: 0 10px;
    }
    
    .sidebar-menu li {
        margin: 0;
        flex-shrink: 0;
    }
    
    .sidebar-menu a {
        padding: 12px 15px;
        border-bottom: 2px solid transparent;
    }
    
    .sidebar-menu a:hover,
    .sidebar-menu a.active {
        border-bottom: 2px solid white;
        background-color: rgba(255, 255, 255, 0.1);
    }
    
    .admin-main {
        padding: 15px;
        width: 100%;
    }
    
    /* Table fixes */
    .members-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: var(--border-radius);
        margin-bottom: 20px;
    }
    
    .members-table table {
        min-width: 600px; /* Minimum width for table */
    }
    
    /* Compact table cells for mobile */
    .members-table th,
    .members-table td {
        padding: 10px 8px;
        font-size: 0.9rem;
    }
    
    /* Action buttons - make them stack */
    .members-table td:last-child {
        min-width: 150px;
    }
    
    .members-table button {
        margin: 2px 0;
        width: 100%;
    }
}

@media (max-width: 768px) {
    /* Further compact admin on tablets */
    .admin-actions {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .admin-actions h3 {
        margin-bottom: 0;
    }
    
    /* Gallery table adjustments */
    /* Admin Gallery Table - 3 Columns */
.gallery-table-container {
    overflow-x: auto;
    margin: 20px 0;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: white;
}

.gallery-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

.gallery-table th {
    background-color: var(--primary-color);
    color: white;
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
}

.gallery-table th:nth-child(1) { width: 20%; }  /* Image */
.gallery-table th:nth-child(2) { width: 50%; }  /* Category */
.gallery-table th:nth-child(3) { width: 30%; }  /* Actions */

.gallery-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.gallery-table tbody tr:hover {
    background-color: #f8f9fa;
}

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

.gallery-thumbnail {
    width: 170px;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.table-category-badge {
    display: inline-block;
    background-color: var(--secondary-color);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.image-title {
    font-size: 0.9rem;
    color: #495057;
    margin-top: 5px;
    line-height: 1.4;
}

/* Action Buttons - Single button layout */
.action-buttons {
    display: flex;
    justify-content: center; /* Center the single button */
}

.action-buttons .btn-secondary {
    background-color: var(--secondary-color);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    font-size: 0.9rem;
    min-width: 80px;
}

.action-buttons .btn-secondary:hover {
    background-color: #4a9c86; /* Slightly darker shade */
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: all 0.2s;
}

/* Optional: Make edit button more prominent */
.action-buttons .btn-secondary i {
    margin-right: 5px;
}
}

/* Hide Delete buttons in Admin section */
.delete-member-btn, 
.delete-gallery-btn,
.btn-admin[style*="background-color: #dc3545"] {
    display: none !important;
}

/* Make edit buttons look good */
.edit-member-btn, 
.edit-gallery-btn {
    width: 100%;
    max-width: 120px;
    padding: 10px !important;
    font-size: 0.95rem !important;
}

@media (max-width: 480px) {
    /* Mobile phones - more aggressive fixes */
    .admin-main {
        padding: 10px;
    }
    
    .members-table table {
        min-width: 500px;
    }
    
    /* Hide less important columns on very small screens */
    .members-table th:nth-child(3), /* Mobile column */
    .members-table td:nth-child(3) {
        display: none;
    }
    
    /* Make action buttons very compact */
    .members-table td:last-child {
        min-width: 120px;
    }
    
    .members-table button {
        padding: 5px 8px;
        font-size: 0.8rem;
    }
    
    /* Gallery table on phones */
    .gallery-table {
        min-width: 600px;
    }
    
    /* Hide gallery table columns on phones */
    .gallery-table th:nth-child(4), /* File size */
    .gallery-table td:nth-child(4) {
        display: none;
    }
}

/* Touch-friendly improvements for admin */
.admin-section {
    touch-action: manipulation;
}

/* Ensure modals work on mobile */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 80vh;
        margin: 10px;
    }
    
    .modal-body {
        padding: 15px;
        max-height: 60vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Fix for mobile menu not closing when clicking admin links */
@media (max-width: 768px) {
    .admin-menu-item {
        color: white !important;
        padding: 12px 15px !important;
        width: 100% !important;
        text-align: left !important;
    }
    
    .admin-menu-item:hover {
        background-color: rgba(255, 255, 255, 0.1) !important;
    }
}

/* Mobile-friendly form inputs in admin */
@media (max-width: 768px) {
    .modal-content .form-group input,
    .modal-content .form-group select,
    .modal-content .form-group textarea {
        font-size: 16px; /* Prevents iOS zoom */
        min-height: 44px; /* Touch target */
    }
}

/* Ensure no text overflow in admin tables */
.members-table td,
.gallery-table td {
    word-break: break-word;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 768px) {
    .members-table td,
    .gallery-table td {
        max-width: 150px;
    }
}

/* ===== PROFILE PAGE MOBILE FIXES ===== */
@media (max-width: 768px) {
    /* Profile container */
    #profile-page .profile-container {
        padding: 15px;
        margin: 0 10px;
    }
    
    /* Profile header - stack vertically */
    #profile-page .profile-header {
        flex-direction: column;
        text-align: center;
        padding: 15px 0;
        margin-bottom: 20px;
    }
    
    /* Profile photo on mobile */
    #profile-page .profile-photo {
        width: 120px;
        height: 120px;
        margin: 0 auto 15px auto;
    }
    
    /* Profile info on mobile */
    #profile-page .profile-info {
        text-align: center;
    }
    
    #profile-page .profile-info h2 {
        font-size: 1.4rem;
        margin-bottom: 5px;
    }
    
    #profile-page .profile-info p {
        font-size: 0.9rem;
        margin-bottom: 3px;
    }
    
    /* Profile form - single column on mobile */
    #profile-page .profile-form {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }
    
    #profile-page .profile-form .form-group {
        margin-bottom: 15px;
    }
    
    /* Form inputs on mobile */
    #profile-page .profile-form input,
    #profile-page .profile-form select,
    #profile-page .profile-form textarea {
        font-size: 16px; /* Prevents iOS zoom */
        padding: 12px;
        min-height: 44px; /* Better touch target */
        width: 100%;
    }
    
    /* Textareas on mobile */
    #profile-page #edit-office,
    #profile-page #edit-residence {
        height: 120px; /* Fixed height */
        resize: vertical;
    }
    
    /* Address section on mobile */
    #profile-page .address-section {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
        margin-bottom: 20px;
    }
    
    #profile-page .address-box {
        padding: 15px;
    }
    
    #profile-page .address-box h4 {
        font-size: 1.2rem;
        padding-bottom: 10px;
    }
    
    #profile-page .address-box p {
        font-size: 1rem;
        line-height: 1.5;
    }
    
    /* Save button on mobile */
    #profile-page #save-profile {
        width: 100%;
        padding: 15px;
        font-size: 1rem;
        margin-top: 10px;
    }
}

@media (max-width: 480px) {
    /* Small phones - more compact */
    #profile-page .profile-container {
        padding: 10px;
        margin: 0 5px;
    }
    
    #profile-page .profile-photo {
        width: 100px;
        height: 100px;
    }
    
    #profile-page .profile-info h2 {
        font-size: 1.2rem;
    }
    
    /* Smaller form labels */
    #profile-page .profile-form .form-group label {
        font-size: 0.9rem;
        margin-bottom: 5px;
    }
    
    /* Compact form inputs */
    #profile-page .profile-form input,
    #profile-page .profile-form select {
        padding: 10px;
    }
    
    /* Address boxes smaller */
    #profile-page .address-box {
        padding: 12px;
    }
    
    #profile-page .address-box h4 {
        font-size: 1rem;
    }
    
    #profile-page .address-box p {
        font-size: 0.9rem;
    }
    
    /* Textareas smaller */
    #profile-page #edit-office,
    #profile-page #edit-residence {
        height: 100px;
        padding: 10px;
    }
    
    /* Family members input */
    #profile-page #edit-family-members {
        padding: 10px;
    }
}

/* Fix for profile page grid layout on mobile */
@media (max-width: 768px) {
    /* Override the desktop grid */
    #profile-page .profile-form[style*="grid-template-columns"],
    #profile-page .profile-form {
        grid-template-columns: 1fr !important;
    }
    
    /* Make full-width items actually full width */
    #profile-page .profile-form .form-group.full-width {
        grid-column: 1 !important;
        width: 100%;
    }
}

/* Ensure no horizontal scrolling */
@media (max-width: 768px) {
    #profile-page {
        overflow-x: hidden;
        width: 100%;
    }
    
    #profile-page .container {
        padding: 0;
        margin: 0;
        width: 100%;
        max-width: 100%;
    }
}

/* Touch-friendly improvements */
#profile-page input:focus,
#profile-page select:focus,
#profile-page textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(26, 95, 122, 0.1);
}

/* Prevent text overlap */
@media (max-width: 768px) {
    #profile-page .profile-info h2,
    #profile-page .profile-info p {
        white-space: normal;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}

/* Fix spacing issues */
@media (max-width: 768px) {
    #profile-page .page-title {
        margin-left: 15px;
        margin-right: 15px;
        font-size: 1.5rem;
        padding-bottom: 8px;
    }
    
    #profile-page .profile-form .form-group {
        width: 100%;
        box-sizing: border-box;
    }
}

/* ===== TABLE RESPONSIVE FIXES ===== */
/* Remove all horizontal scrolling from tables */
.table-container,
.members-table,
.gallery-table-container,
.family-card table {
    overflow-x: visible !important;
    -webkit-overflow-scrolling: auto !important;
}

/* Make tables responsive with auto layout */
table {
    width: 100% !important;
    min-width: 100% !important;
    table-layout: auto !important;
}

/* Ensure table cells wrap content properly */
table th,
table td {
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    min-width: auto !important;
    max-width: none !important;
    padding: 10px 12px !important;
    font-size: inherit !important;
}

/* Mobile: Display as horizontal cards */
@media (max-width: 768px) {
  .table-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  
  table, thead, tbody, tr {
    display: block;
    width: 100%;
  }
  
  /* Hide original table structure */
  thead tr {
    display: none;
  }
  
  /* Each row becomes a card */
  tbody tr {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 columns */
    gap: 5px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  }
  
  /* Each cell */
  td {
    display: flex;
    flex-direction: column;
    padding: 3px;
    border: none;
    font-size: 12px;
  }
  
  /* Add labels */
  td:before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 10px;
    color: #666;
    margin-bottom: 2px;
  }
  
  /* Make important cells more prominent */
  td[data-label="Member"] {
    grid-column: 1 / -1; /* Span full width */
    font-weight: bold;
    font-size: 13px;
    color: #2c3e50;
  }
  
  td[data-label="Mobile"] {
    font-weight: bold;
    color: #27ae60;
  }
}

/* For very small screens (phones) */
@media (max-width: 480px) {
    table tbody td {
        padding: 10px 12px !important;
        font-size: 0.9rem !important;
    }
    
    table tbody td:before {
        font-size: 0.85rem !important;
    }
}

/* Special handling for family details tables */
.family-card table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

.family-card .table-container {
    border: 1px solid #eee !important;
    border-radius: 8px !important;
    padding: 0 !important;
    background: white !important;
}

/* Remove all overflow scroll classes */
.no-scroll {
    overflow: visible !important;
}

/* Make the section header a flex container for desktop */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap; /* Allow wrapping on mobile */
}

/* On mobile, stack them vertically */
@media (max-width: 768px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px; /* Space between title and button */
    }
    
    .section-header .btn {
        width: 40%; /* Make button full width on mobile */
        text-align: center;
        margin-top: 10px;
    }
}

/* Hide the separate admin-actions div for desktop */
#gallery-admin-actions {
    display: none;
}

/* MOBILE NAVIGATION FIXES */
/* SUPER COMPACT MOBILE NAV */
@media (max-width: 768px) {
    /* Make navigation very compact */
    .nav-links {
        padding: 90px 0 !important;
        gap: 0 !important;
    }
    
    .nav-links li {
        margin: 0 !important;
        border-bottom: 1px solid rgba(255,255,255,0.1) !important;
    }
    
    .nav-links a {
        padding: 8px 16px !important;
        margin: 0 !important;
        font-size: 0.9rem !important;
        min-height: 40px !important;
    }
    
    .nav-links a i {
        font-size: 0.95rem !important;
        min-width: 24px !important;
    }
    
    /* Reduce hamburger menu size */
    .hamburger {
        padding: 8px !important;
    }
    
    /* Compact user info */
    #user-info {
        padding: 6px 16px !important;
        margin-bottom: 0 !important;
        font-size: 0.85rem !important;
    }
    
    /* Make logout more compact */
    #logout-link {
        padding: 8px 16px !important;
        margin-top: 0 !important;
        font-size: 0.9rem !important;
    }
}

/* Additional fixes for very small screens */
@media (max-width: 480px) {
    .nav-links a {
        padding: 8px 15px !important;
        font-size: 0.95rem !important;
    }
    
    .nav-links a i {
        min-width: 25px !important;
        font-size: 1rem !important;
    }
    
    /* Reduce padding on mobile */
    .nav-links {
        padding: 60px 0 !important;
    }
}


 /* Contact link hover effects */
    .contact-link {
        color: #000 !important;
        text-decoration: none !important;
        transition: color 0.3s ease, text-decoration 0.3s ease;
    }
    
    .contact-link:hover {
        color: var(--primary-color) !important;
        text-decoration: underline !important;
    }
    
    .contact-link:active {
        color: var(--secondary-color) !important;
    }
    
    /* Contact action button hover effects */
    /* Contact link styles */
    .contact-link {
        color: #000 !important;
        text-decoration: none !important;
        transition: color 0.3s ease, text-decoration 0.3s ease;
        margin-left: 8px;
        display: inline-block;
        cursor: pointer;
    }
    
    .contact-link:hover {
        color: #1a7a1af6 !important; /* Primary color */
        text-decoration: none !important;
    }
    
    .contact-link:active,
    .contact-link:focus {
        color: #57cc99 !important; /* Secondary color */
    }
    
    /* Contact action button styles */
    .contact-action-btn {
        background-color: #f0f0f0 !important;
        color: #000 !important;
        padding: 10px 15px !important;
        border-radius: 6px !important;
        text-decoration: none !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        border: 1px solid #ddd !important;
        transition: all 0.3s ease !important;
        cursor: pointer !important;
    }
    
    .contact-action-btn:hover {
        background-color: #1a5f7a !important; /* Primary color */
        color: white !important;
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        text-decoration: none !important;
    }
    
    .contact-action-btn:active,
    .contact-action-btn:focus {
        background-color: #57cc99 !important; /* Secondary color */
        color: white !important;
        transform: translateY(0);
    }
    
    /* Ensure links are visible and clickable */
    a.contact-link,
    a.contact-action-btn {
        pointer-events: auto !important;
        position: relative;
        z-index: 1;
    }
    
    /* Touch device support */
    @media (hover: none) {
        .contact-link:active,
        .contact-link:focus {
            color: #182b80 !important;
            text-decoration: none !important;
        }
        
        .contact-action-btn:active,
        .contact-action-btn:focus {
            background-color: #1a5f7a !important;
            color: white !important;
        }
    }
    
    /* For testing - make sure links are visible */
    .contact-link:after {
        content: '';
        position: absolute;
        width: 100%;
        height: 100%;
        left: 0;
        top: 0;
        z-index: 2;
    }
    