* {
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    margin: 0;
    padding: 20px;
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

    body.light-theme {
        background-color: #f4f4f4;
        color: #333;
    }

    body.dark-theme {
        background-color: #1a1a1a;
        color: #f4f4f4;
    }

.container {
    max-width: 800px; /* Increased from 600px for wider desktop view */
    margin: 0 auto;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    transition: background-color 0.3s, color 0.3s;
}

body.light-theme .container {
    background: white;
}

body.dark-theme .container {
    background: #2d2d2d;
    box-shadow: 0 0 10px rgba(255,255,255,0.1);
}

h1 {
    text-align: center;
    margin-bottom: 20px;
    transition: color 0.3s;
}

body.light-theme h1 {
    color: #333;
}

body.dark-theme h1 {
    color: #f4f4f4;
}

.intro, .form-section {
    display: none;
}

    .intro.active, .form-section.active {
        display: block;
    }

    .intro p {
        text-align: center;
        transition: color 0.3s;
    }

body.light-theme .intro p {
    color: #555;
}

body.dark-theme .intro p {
    color: #ccc;
}

.intro .coptic {
    font-size: 18px;
    color: #4CAF50;
    margin-bottom: 10px;
}

.intro .english {
    font-style: italic;
    margin-bottom: 20px;
    transition: color 0.3s;
}

body.light-theme .intro .english {
    color: #777;
}

body.dark-theme .intro .english {
    color: #aaa;
}

.theme-toggle {
    position: fixed;
    top: 10px;
    right: 10px;
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s, color 0.3s;
    z-index: 9999; /* Ensure it stays on top */
}

body.light-theme .theme-toggle {
    background-color: #2196F3;
    color: white;
}

body.dark-theme .theme-toggle {
    background-color: #4CAF50;
    color: #fff;
}

.continue-btn {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    display: block;
    margin: 20px auto 0;
    transition: background-color 0.3s, color 0.3s;
}

body.light-theme .continue-btn {
    background-color: #2196F3;
    color: white;
}

body.dark-theme .continue-btn {
    background-color: #4CAF50;
    color: #fff;
}

.continue-btn:hover,
body.light-theme .theme-toggle:hover {
    background-color: #1976D2;
}

body.dark-theme .theme-toggle:hover,
body.dark-theme .continue-btn:hover {
    background-color: #45a049;
}

.member-section {
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 4px;
    position: relative;
    transition: border-color 0.3s, background-color 0.3s;
}

body.light-theme .member-section {
    border: 1px solid #ddd;
}

body.dark-theme .member-section {
    border: 1px solid #555;
    background-color: #3a3a3a;
}

.form-group {
    margin-bottom: 15px;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

    .form-row .form-group {
        flex: 1;
        margin-bottom: 0;
    }

.phone-email-row .form-group {
    flex: 1;
}

.phone-email-row .phone-group {
    margin-bottom: 0;
}

label {
    display: block;
    margin-bottom: 5px;
    transition: color 0.3s;
}

body.light-theme label {
    color: #555;
}

body.dark-theme label {
    color: #ccc;
}

.required::after {
    content: " *";
    color: #ff4444;
}

input[type="text"],
input[type="tel"],
input[type="email"] {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s, background-color 0.3s, color 0.3s;
}

body.light-theme input[type="text"],
body.light-theme input[type="tel"],
body.light-theme input[type="email"] {
    border: 1px solid #ddd;
    background-color: white;
    color: #333;
}

body.dark-theme input[type="text"],
body.dark-theme input[type="tel"],
body.dark-theme input[type="email"] {
    border: 1px solid #555;
    background-color: #444;
    color: #f4f4f4;
}

input[type="text"]:focus,
input[type="tel"]:focus,
input[type="email"]:focus {
    outline: none;
    box-shadow: 0 0 5px rgba(76,175,80,0.3);
}

body.light-theme input[type="text"]:focus,
body.light-theme input[type="tel"]:focus,
body.light-theme input[type="email"]:focus {
    border-color: #4CAF50;
}

body.dark-theme input[type="text"]:focus,
body.dark-theme input[type="tel"]:focus,
body.dark-theme input[type="email"]:focus {
    border-color: #4CAF50;
}

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.checkbox-group {
    display: flex;
    gap: 15px;
}

.radio-option,
.checkbox-option {
    display: flex;
    align-items: center;
    gap: 5px;
}

.deacon-group {
    margin-top: 10px;
    /*display: none;*/
}

.checkbox-option.disabled label {
    color: #888;
    transition: color 0.3s;
}

body.dark-theme .checkbox-option.disabled label {
    color: #666;
}

.error {
    color: #ff4444;
    font-size: 14px;
    margin-top: 5px;
    display: none;
}

.member-count {
    position: fixed;
    top: 50px;
    right: 10px;
    padding: 8px 15px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 4px;
    font-size: 14px;
    z-index: 1000;
}

.phone-group {
    display: block;
}

/*    .phone-group.hidden {
        display: none;
    }*/

    .phone-group.disabled label {
        color: #888;
        transition: color 0.3s;
    }

body.dark-theme .phone-group.disabled label {
    color: #666;
}

.email-group {
    display: block;
}

/*    .email-group.hidden {
        display: none;
    }*/

    .email-group.disabled label {
        color: #888;
        transition: color 0.3s;
    }

body.dark-theme .email-group.disabled label {
    color: #666;
}

.remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    color: #ff4444;
    cursor: pointer;
    font-size: 18px;
}

.add-btn {
    padding: 10px 40px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    margin-bottom: 15px;
    transition: background-color 0.3s, color 0.3s;
}

body.light-theme .add-btn {
    background-color: #2196F3;
    color: white;
}

body.dark-theme .add-btn {
    background-color: #4CAF50;
    color: #fff;
}

.add-btn:hover {
    background-color: #1976D2;
}

button[type="submit"] {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    font-size: 16px;
    transition: background-color 0.3s, color 0.3s;
}

body.light-theme button[type="submit"] {
    background-color: #4CAF50;
    color: white;
}

body.dark-theme button[type="submit"] {
    background-color: #2196F3;
    color: #fff;
}

button[type="submit"]:hover {
    background-color: #45a049;
}

.footer {
    text-align: center;
    padding: 20px;
    border-top: 1px solid #ddd;
    margin-top: 20px;
    transition: background-color 0.3s, color 0.3s; /* Smooth theme transition */
}

body.light-theme .footer {
    background-color: #f4f4f4;
    color: #777;
}

body.dark-theme .footer {
    background-color: #2d2d2d;
    color: #aaa;
    border-top: 1px solid #555; /* Darker border for dark theme */
}

.footer a {
    margin: 0 10px;
    text-decoration: none;
    transition: color 0.3s;
}

body.light-theme .footer a {
    color: #2196F3; /* Blue from light theme buttons */
}

body.dark-theme .footer a {
    color: #4CAF50; /* Green from dark theme buttons */
}

.footer a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
        max-width: 600px; /* Revert to narrower width on smaller screens */
    }

    h1 {
        font-size: 24px;
    }

    input[type="text"],
    input[type="tel"],
    input[type="email"],
    .add-btn,
    button[type="submit"],
    .continue-btn {
        font-size: 14px;
    }

    .checkbox-group {
        flex-direction: column;
        gap: 10px;
    }

    .member-count {
        top: 60px;
        right: 5px;
        font-size: 12px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

        .form-row .form-group {
            margin-bottom: 15px;
        }

    .phone-email-row {
        flex-direction: column;
        gap: 0;
    }

        .phone-email-row .form-group {
            margin-bottom: 15px;
        }
}


/* Notification Modal */
.notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0,0,0,0.2);
    z-index: 1000;
    max-width: 400px;
    width: 90%;
    text-align: center;
    transition: opacity 0.3s ease;
    opacity: 0;
    display: none;
    font-weight: bold;
}

body.light-theme .notification.success {
    background-color: #dff0d8;
    color: #3c763d;
    border: 1px solid #d6e9c6;
}

body.dark-theme .notification.success {
    background-color: #2a4b2a;
    color: #dff0d8;
    border: 1px solid #3c763d;
}

body.light-theme .notification.error {
    background-color: #f2dede;
    color: #a94442;
    border: 1px solid #ebccd1;
}

body.dark-theme .notification.error {
    background-color: #4b2a2a;
    color: #f2dede;
    border: 1px solid #a94442;
}

.notification.show {
    opacity: 1;
    display: block;
}

.notification button {
    margin-top: 15px;
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

body.light-theme .notification.success button {
    background-color: #4CAF50;
    color: white;
}

body.dark-theme .notification.success button {
    background-color: #2196F3;
    color: white;
}

body.light-theme .notification.error button {
    background-color: #d9534f;
    color: white;
}

body.dark-theme .notification.error button {
    background-color: #c9302c;
    color: white;
}

.notification button:hover {
    opacity: 0.9;
}

/* Overlay for better focus */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}


/* Family Detailed Page */
.family-details {
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

body.light-theme .family-details {
    background: white;
    color: #333;
}

body.dark-theme .family-details {
    background: #2d2d2d;
    color: #f4f4f4;
    box-shadow: 0 0 10px rgba(255,255,255,0.1);
}

.family-details h2 {
    text-align: center;
    margin-bottom: 20px;
}

.member-card {
    border: 1px solid #ddd;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 4px;
}

body.dark-theme .member-card {
    border-color: #555;
    background-color: #3a3a3a;
}

.member-card h3 {
    margin: 0 0 10px;
}

.member-card p {
    margin: 5px 0;
}

.attendance {
    margin-top: 10px;
}

.qr-code {
    text-align: center;
    margin-bottom: 20px;
}

    .qr-code img {
        max-width: 200px;
        height: auto;
    }

/* Loading Spinner Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
}

/* Spinner */
.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3; /* Light gray for light theme */
    border-top: 5px solid #4CAF50; /* Green for light theme success color */
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

body.dark-theme .spinner {
    border: 5px solid #333; /* Dark gray for dark theme */
    border-top: 5px solid #2196F3; /* Blue for dark theme success color */
}

/* Animation */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Logout CSS file */
.logout-btn {
    background-color: #ff4444;
    color: white;
}

body.dark-theme .logout-btn {
    background-color: #c9302c;
}

.logout-btn:hover {
    background-color: #cc3333;
}

body.dark-theme .logout-btn:hover {
    background-color: #a62828;
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

    .summary-table th, .summary-table td {
        border: 1px solid #ddd;
        padding: 8px;
        text-align: center;
    }

body.dark-theme .summary-table th, body.dark-theme .summary-table td {
    border-color: #555;
}

.summary-table th {
    background-color: #f2f2f2;
}

body.dark-theme .summary-table th {
    background-color: #3a3a3a;
}

.search-form {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

    .search-form input[type="text"] {
        padding: 8px;
        width: 300px;
        border-radius: 4px;
    }

    .search-form button {
        padding: 8px 15px;
        border: none;
        border-radius: 4px;
        cursor: pointer;
    }

body.light-theme .search-form button {
    background-color: #2196F3;
    color: white;
}

body.dark-theme .search-form button {
    background-color: #4CAF50;
    color: #fff;
}

.member-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 auto;
    max-width: 1200px;
}

    .member-table th, .member-table td {
        border: 1px solid #ddd;
        padding: 8px;
        text-align: left;
    }

body.dark-theme .member-table th, body.dark-theme .member-table td {
    border-color: #555;
}

.member-table th {
    background-color: #f2f2f2;
}

body.dark-theme .member-table th {
    background-color: #3a3a3a;
}

.filter-row input {
    width: 100%;
    padding: 4px;
    border: none;
    background: transparent;
}

body.dark-theme .filter-row input {
    color: #f4f4f4;
}



.family-list {
    max-width: 800px;
    margin: 0 auto;
}

.family-item {
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    padding: 10px;
}

body.dark-theme .family-item {
    border-color: #555;
    background-color: #3a3a3a;
}

.family-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.family-members {
    display: none;
    margin-top: 10px;
}

    .family-members.show {
        display: block;
    }

.member-detail {
    padding: 5px 0;
}



.paging-controls {
    text-align: center;
    margin-top: 20px;
}

    .paging-controls a {
        padding: 8px 12px;
        margin: 0 5px;
        text-decoration: none;
        border-radius: 4px;
    }

body.light-theme .paging-controls a {
    background-color: #2196F3;
    color: white;
}

body.dark-theme .paging-controls a {
    background-color: #4CAF50;
    color: #fff;
}

.paging-controls a.disabled {
    background-color: #ccc;
    cursor: not-allowed;
}