/* style.css */

/* Basic Reset & Body Styles */
body {
    font-family: "Inter", sans-serif; /* Using Inter as per instructions */
    margin: 0;
    padding: 0;
    background-color: #f4f7f6;
    color: #333;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Container for main content */
.container {
    max-width: 960px;
    margin: 20px auto;
    padding: 20px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
    flex-grow: 1; /* Allows container to grow and fill available space */
}

/* Header Styles */
.header {
    background-color: #2a6f5e; /* Original color */
    color: #ffffff;
    padding: 20px 0;
    text-align: center;
    border-bottom: 5px solid #1a4f41;
}

.header h1 {
    margin: 0;
    font-size: 2.5em;
    font-weight: 700;
}

/* Navigation Bar */
.navbar {
    background-color: #3e8e7a;
    padding: 10px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap; /* Allows items to wrap on smaller screens */
}

.navbar ul li {
    margin: 0 15px;
}

.navbar ul li a {
    color: #ffffff;
    text-decoration: none;
    font-weight: bold;
    padding: 8px 15px;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.navbar ul li a:hover,
.navbar ul li a.active {
    background-color: #1a4f41;
}

/* Forms Styling */
.form-card {
    background-color: #f9f9f9;
    padding: 25px; /* More padding than the duplicate */
    border-radius: 10px; /* Larger radius than the duplicate */
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid #ddd; /* Added from duplicate, useful for form cards */
    margin-top: 20px;
}

.form-group {
    margin-bottom: 15px;
    text-align: left; /* Added from duplicate, good for form alignment */
}

.form-group label {
    display: block;
    margin-bottom: 8px; /* Slightly more margin than the duplicate */
    font-weight: bold;
    color: #555;
}

.form-group input[type="date"],
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group textarea,
.form-group select {
    width: calc(100% - 20px); /* Account for padding */
    padding: 10px;
    border: 1px solid #ddd; /* Consistent border */
    border-radius: 6px; /* Slightly larger radius */
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.form-group input[type="date"]:focus,
.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="tel"]:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: #3e8e7a;
    outline: none;
    box-shadow: 0 0 0 3px rgba(62, 142, 122, 0.2);
}

/* Buttons */
.button-primary {
    background-color: #3e8e7a; /* Original color */
    color: white;
    padding: 12px 25px; /* Larger padding */
    border: none;
    border-radius: 8px; /* Larger radius */
    cursor: pointer;
    font-size: 1.1em; /* Slightly larger font */
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.2s ease;
    display: inline-block; /* For better padding/margin control */
    margin-top: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.button-primary:hover {
    background-color: #2a6f5e; /* Darker hover state */
    transform: translateY(-2px);
}

.button-secondary {
    background-color: #6c757d;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
    margin-right: 10px; /* Added from duplicate, good for spacing between buttons */
}

.button-secondary:hover {
    background-color: #5a6268;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: #ffffff;
    border-radius: 8px;
    overflow: hidden; /* Ensures rounded corners on table */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

table th,
table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
    text-align: left;
}

table th {
    background-color: #f0f0f0;
    font-weight: bold;
    color: #555;
    text-transform: uppercase;
    font-size: 0.9em;
}

table tr:nth-child(even) {
    background-color: #f9f9f9;
}

table tr:hover {
    background-color: #eef2f1;
}

/* Links */
a {
    color: #3e8e7a;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #2a6f5e;
    text-decoration: underline;
}

/* Messages */
.message {
    padding: 15px; /* Larger padding */
    margin-bottom: 20px;
    border-radius: 8px; /* Larger radius */
    font-weight: bold;
    text-align: center;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Sections for dashboard/admin */
.section-title {
    color: #2a6f5e;
    font-size: 1.8em;
    margin-top: 30px;
    margin-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}

/* Footer Styles */
.footer {
    text-align: center;
    padding: 20px;
    background-color: #2a6f5e; /* Original color */
    color: #ffffff;
    margin-top: 30px;
    border-top: 5px solid #1a4f41;
    margin-top: auto; /* Ensures footer sticks to the bottom */
}

/* Utility classes */
.text-center {
    text-align: center;
}
.margin-top-20 {
    margin-top: 20px;
}

/* User List (assuming this is a specific component, not general styling) */
.user-list {
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.user-list h3 {
    margin-bottom: 15px;
    color: #2a6f5e; /* Adjusted to match primary theme color */
}

.user-list ul {
    list-style: none;
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 5px;
    background-color: #fefefe;
}

.user-list li {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-list li:last-child {
    border-bottom: none;
}

.user-list li span {
    font-weight: normal;
    color: #555;
}


/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        padding: 15px;
    }

    .header h1 {
        font-size: 2em;
    }

    .navbar ul {
        flex-direction: column;
    }

    .navbar ul li {
        margin: 5px 0;
    }

    .form-group input[type="date"],
    .form-group input[type="text"],
    .form-group input[type="password"],
    .form-group input[type="email"],
    .form-group input[type="tel"],
    .form-group textarea,
    .form-group select {
        width: 100%; /* Full width on smaller screens */
    }

    table, thead, tbody, th, td, tr {
        display: block;
    }

    /* Hide table headers (but not display: none;, for accessibility) */
    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    table tr {
        border: 1px solid #ccc;
        margin-bottom: 15px;
        border-radius: 8px;
        overflow: hidden;
    }

    table td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%; /* Adjust as needed for label */
        text-align: right;
    }

    table td:last-child { /* Specific for the last column (Actions) to prevent double border if no content after */
        border-bottom: none;
    }

    table td:before {
        /* Now like a table header */
        position: absolute;
        /* Top/left values mimic padding */
        top: 6px;
        left: 6px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        color: #555;
    }

    /* Labels for the dependants table */
    .dependants-table td:nth-of-type(1):before { content: "ID"; }
    .dependants-table td:nth-of-type(2):before { content: "User ID"; }
    .dependants-table td:nth-of-type(3):before { content: "Full Name"; }
    .dependants-table td:nth-of-type(4):before { content: "IC Number"; }
    .dependants-table td:nth-of-type(5):before { content: "D.O.B"; }
    .dependants-table td:nth-of-type(6):before { content: "Relationship"; }
    .dependants-table td:nth-of-type(7):before { content: "Created At"; }
    .dependants-table td:nth-of-type(8):before { content: "Actions"; }
    
    /* Labels for the simple dependants table */
    .dependants-simple-table td:nth-of-type(1):before { content: "Name"; }
    .dependants-simple-table td:nth-of-type(2):before { content: "IC Number"; }
    .dependants-simple-table td:nth-of-type(3):before { content: "D.O.B"; }
    .dependants-simple-table td:nth-of-type(4):before { content: "Relationship"; }
    .dependants-simple-table td:nth-of-type(5):before { content: "Actions"; }

    /* Labels for the payments table */
    .payments-table td:nth-of-type(1):before { content: "Amount"; }
    .payments-table td:nth-of-type(2):before { content: "Bill Code"; }
    .payments-table td:nth-of-type(3):before { content: "Status"; }
    .payments-table td:nth-of-type(4):before { content: "Payment Date"; }
    .payments-table td:nth-of-type(5):before { content: "Actions"; }

    /* Labels for admin.php user table */
    /* Assuming the admin user table gets the class 'admin-users-table' */
    .admin-users-table td:nth-of-type(1):before { content: "ID"; }
    .admin-users-table td:nth-of-type(2):before { content: "Full Name"; }
    .admin-users-table td:nth-of-type(3):before { content: "IC Number"; }
    .admin-users-table td:nth-of-type(4):before { content: "D.O.B"; }
    .admin-users-table td:nth-of-type(5):before { content: "Address"; }
    .admin-users-table td:nth-of-type(6):before { content: "Phone"; }
    .admin-users-table td:nth-of-type(7):before { content: "Email"; }
    .admin-users-table td:nth-of-type(8):before { content: "Role"; }
    .admin-users-table td:nth-of-type(9):before { content: "Status"; }
    .admin-users-table td:nth-of-type(10):before { content: "Expiry Date"; }
    .admin-users-table td:nth-of-type(11):before { content: "Created At"; }
    .admin-users-table td:nth-of-type(12):before { content: "Actions"; }
}