*,
*::before,
*::after {
    box-sizing: border-box;
    /* ✅ ADDED */
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    /* Stack the content and footer */
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    color: #333;
}

footer {
    background: linear-gradient(90deg, #508D4E, #1A5319);
    padding: 1%;
    text-align: center;
    width: 100%;
    color: white;
    position: relative;
    bottom: 0;
}
main {
    flex-grow: 1;
    /* Take up the remaining space in the body */
}

header {
    background: linear-gradient(90deg, #508D4E, #1A5319);
    padding: 2%;
    text-align: center;
    color: white;
    position: relative;
    width: 100%;
  
}

header h1 {
    margin: 0;
    margin-top: 1%;
}

header p {
    font-size: 1.2em;
}

.auth-section {
    font-size: 1.0em;
    text-align: right;
    color: rgb(255, 251, 216);
    margin-right: 10%;
}

.auth-section a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    padding: 8px 12px;
    transition: color 0.3s ease-in-out, background-color 0.3s ease-in-out;
}

.auth-section a:hover {
    color: #1A5319 !important;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    padding: 8px 12px;
}

.search-container {
    display: flex;
    justify-content: flex-end;
    margin: 20px auto;
    width: 90%;
    flex-wrap: wrap;
    /* ✅ ADDED to avoid overflow on small screens */
}

.search-container input {
    padding: 10px;
    width: 50%;
    max-width: 400px;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin-right: 10px;
    text-align: center;
}

.search-container button {
    padding: 10px 20px;
    background: #28a745;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    width: 30%;
}

.search-container button:hover {
    background: #218838;
}

table {
    width: 90%;
    margin: 20px auto;
    border-collapse: collapse;
    background: white;
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    /* ✅ ADDED to avoid overflow */
}

th,
td {
    padding: 12px;
    text-align: center;
    border: 1px solid #ddd;
    word-wrap: break-word;
    /* ✅ Helpful for long content */
}

th {
    background: #508D4E;
    color: white;
}

.pagination {
    text-align: center;
    margin: 20px 0;
    flex-wrap: wrap;
    /* ✅ ADDED if buttons ever overflow */
}

.pagination button {
    padding: 8px 12px;
    margin: 5px;
    border: none;
    background: #205A1F;
    color: white;
    cursor: pointer;
    border-radius: 5px;
}

.pagination button:hover {
    background: #508D4E;
}

/* Dropdown container */
.dropdown {
    display: inline-block;
    position: relative;
}

.dropbtn {
    color: white;
    text-decoration: none;
    font-weight: bold;
    padding: 8px 12px;
    transition: color 0.3s ease-in-out, background-color 0.3s ease-in-out;
}

.dropbtn:hover {
    color: #218838!important;
    background-color: rgba(255, 255, 255, 0.91);
    border-radius: 5px;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: #333;
    min-width: 100px;
    z-index: 1;
    border-radius: 5px;
}

.dropdown-content a {
    color: white;
    padding: 10px 16px;
    display: block;
    text-align: left;
    text-decoration: none;
}

.dropdown-content a:hover {
    background-color: #444;
}

.dropdown:hover .dropdown-content {
    display: block;
}

@media (max-width: 768px) {

    .container-banner {
        height: 200px;
    }

    .card {
        flex-direction: column;
        gap: 15px;
    }

    .card div {
        flex: 1 1 100%;
        min-width: unset;
    }

    .section h2,
    .section h3 {
        font-size: 1.4em;
    }

    .section p,
    .section li {
        font-size: 1em;
    }

    .dropdown-content {
        right: 0;
        min-width: 140px;
    }
}

@media (max-width: 480px) {
    .search-container {
        width: auto;
        margin: 10px 10px 0 auto; /* Align to top right */
        justify-content: flex-end;
        flex-wrap: nowrap;
        gap: 5px;
    }

    .search-container input {
        padding: 5px;
        font-size: 0.8em;
        width: 100px;
    }

    .search-container button {
        padding: 5px 10px;
        font-size: 0.8em;
        width: auto;
    }

    /* Horizontally scrollable table container */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 10px;
    }

    table {
        min-width: 600px; /* Force horizontal scroll if content overflows */
        width: 100%;
    }
    header {
        padding: 5%;
    }
    header h1 {
        font-size: 1.2em;
    }

    header p {
        font-size: 0.9em;
    }

    .auth-section {
        font-size: 0.6em; /* Even smaller font size */
        margin-right: 0;
    }

    .section h2 {
        font-size: 1.2em;
    }

    .section p,
    .section li {
        font-size: 0.9em;
    }

    .container {
        padding: 0.3rem;
    }

    footer {
        padding: 1%;
        font-size: 0.80em;
    }

    .card div {
        width: 100%; /* Make card take full width on small screens */
        padding: 5px; /* Reduce padding further */
    }
    
    td {
        font-size: 0.75em;
    }

    table, th{
        font-size: 0.85em;
    }
    .pagination, .pagination button  {
      font-size:0.70em;
}
}