body {
    background-color: #eff3ff; /* Same as admin bg */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

.header-wrapper {
    background-color: transparent;
    box-shadow: none;
    padding-bottom: 10px;
    margin-bottom: 0;
    width: 100%;
}

.header {
    padding: 15px 0;
    text-align: center;
}

.header img {
    vertical-align: middle;
    margin: 0 10px;
}

.header h1 {
    display: inline-block;
    vertical-align: middle;
    font-size: 1.5rem;
    margin: 0;
    color: #2c3e50;
    font-weight: 700;
}

.public-container {
    width: 100%;
    max-width: 1500px;
    padding: 20px;
    box-sizing: border-box;
    margin: 0 auto;
    padding-bottom: 60px;
    flex: 1;
}

/* Search & Filter Styling */
.search-filter-container {
    background-color: #CAD7FF;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    margin-bottom: 40px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.search-filter-container form {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    align-items: center;
}

.search-box-wrapper {
    flex: 1 1 300px;
    min-width: 250px;
    max-width: 100%;
}

.filter-dept-wrapper {
    flex: 1 1 250px;
    min-width: 200px;
}

.filter-limit-wrapper {
    flex: 0 1 150px;
    min-width: 120px;
}

.filter-btn-wrapper {
    flex: 0 0 auto;
    display: flex;
    gap: 10px;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 50px;
    font-size: 16px;
    box-sizing: border-box;
}

.form-control:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.btn-submit {
    padding: 12px 25px;
    background-color: #1ecbe1;
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.3s;
}

.btn-submit:hover {
    background-color: #E1341E;
}

/* Card Grid Styling */
.card-grid {
    display: flex; /* Changed from grid to flex for better control */
    flex-wrap: wrap;
    gap: 30px;
    justify-content: center;
    margin-bottom: 40px;
}

.public-card {
    background-image: url('lux1.jpg');
    background-size: cover;
    background-position: center;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 30px 20px;
    color: white;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: auto; /* Allow height to grow */
    min-height: 400px; /* Ensure minimum height */
    z-index: 1;
    width: 300px; /* Fixed width */
    max-width: 100%;
    margin-bottom: 30px; /* Explicit margin bottom */
}

.public-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.3);
    z-index: 10;
}

.public-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0,50,100,0.7), rgba(0,20,60,0.9));
    z-index: 1;
}

.public-card-content {
    position: relative;
    z-index: 2;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.card-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid rgba(255,255,255,0.8);
    margin-bottom: 15px;
    background-color: #f0f0f0;
    flex-shrink: 0; /* Prevent photo from shrinking */
}

.card-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.3;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    word-wrap: break-word; /* Handle long names */
    max-width: 100%;
}

.card-position {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 10px;
    color: #fafafa;
    word-wrap: break-word;
    max-width: 100%;
}

.card-department {
    font-size: 1rem;
    margin-bottom: 15px;
    color: #fafafa;
    word-wrap: break-word;
    max-width: 100%;
}

.card-info {
    font-size: 0.9rem;
    margin-bottom: 5px;
    color: #fafafa;
    word-break: break-all; /* Ensure long emails/urls break */
}

.card-item, .card-position, .card-department, .card-info {
    color: #eeeeee;
}

.card-info a {
    color: #fafafa;
    text-decoration: none;
}



.card-info a:hover {
    text-decoration: underline;
}

.spacer {
    flex-grow: 1;
    min-height: 15px; /* Ensure at least some gap */
}

.btn-vcard {
    display: inline-block;
    padding: 10px 25px;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    margin-top: 20px;
    transition: background-color 0.2s, transform 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

.btn-vcard:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

/* Pagination Styling */
.pagination-container {
    display: flex;
    justify-content: center;
    margin-top: 60px;
    gap: 5px;
    flex-wrap: wrap;
    position: relative;
    z-index: 5; /* Ensure it sits above non-hovered cards */
    padding: 10px 0;
    width: 100%;
}

.footer {
    width: 100%;
    text-align: center;
    padding: 20px 0;
    margin-top: auto;
    color: #777;
    font-size: 0.9em;
    position: relative;
    z-index: 5;
}

/* Back to Top */
#backToTopBtn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 30px;
    z-index: 99;
    border: none;
    outline: none;
    background-color: #3498db;
    color: white;
    cursor: pointer;
    padding: 15px;
    border-radius: 10px;
    font-size: 18px;
    transition: background-color 0.3s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

#backToTopBtn:hover {
    background-color: #555;
}

@media (max-width: 600px) {
    .header h1 {
        display: block;
        margin-top: 10px;
    }
    
    .card-grid {
        display: block; /* Stack vertically on mobile */
        text-align: center;
    }
    
    .public-card {
        width: 100%;
        max-width: 350px;
        margin: 0 auto 30px auto; /* Centered with bottom margin */
        height: auto;
    }
}
