/* General Body Styles */
body {
    font-family: Arial, sans-serif;
    background-color: #1a1a1a; /* Dark background */
    color: #f0f0f0; /* Light text color */
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh; /* Ensure body takes full viewport height */
    box-sizing: border-box; /* Include padding in element's total width and height */
}

/* Container for content */
.container {
    background-color: #2c2c2c; /* Slightly lighter dark background for container */
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 1000px; /* Max width for wider tables */
    margin-top: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center; /* Center content horizontally */
}

/* Headings */
h2 {
    color: #4CAF50; /* Green for headings */
    text-align: center;
    margin-bottom: 25px;
}

/* Form Group for labels and inputs */
.form-group {
    margin-bottom: 15px;
    width: 100%;
}

label {
    display: block;
    margin-bottom: 5px;
    color: #cccccc;
}

/* Text and Input Field Styling */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
textarea {
    width: calc(100% - 22px); /* Full width minus padding and border */
    padding: 10px;
    border: 1px solid #555;
    border-radius: 5px;
    background-color: #3a3a3a; /* Darker input background */
    color: #f0f0f0; /* Light text color */
    box-sizing: border-box;
    font-size: 1em;
}

/* Buttons */
.button {
    background-color: #4CAF50; /* Green */
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
    text-decoration: none; /* For anchor tags styled as buttons */
    display: inline-block; /* Allows side-by-side buttons */
    margin: 5px; /* Spacing between buttons */
    text-align: center;
}

.button:hover {
    background-color: #45a049; /* Darker green on hover */
}

.button-success {
    background-color: #4CAF50;
}
.button-success:hover {
    background-color: #45a049;
}

.button-warning {
    background-color: #ff9800; /* Orange */
}
.button-warning:hover {
    background-color: #e68a00;
}

.button-danger {
    background-color: #f44336; /* Red */
}
.button-danger:hover {
    background-color: #da190b;
}

/* Message Styling (Success/Error) */
.message {
    margin-top: 20px;
    padding: 10px;
    border-radius: 5px;
    font-weight: bold;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #28a745;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #dc3545;
}

/* Back Link Styling */
.back-link {
    display: block;
    margin-top: 20px;
    color: #87CEEB; /* Light blue */
    text-decoration: none;
    text-align: center;
}

.back-link:hover {
    text-decoration: underline;
}

/* Table Styling */
.table-responsive {
    width: 100%;
    overflow-x: auto; /* Enables horizontal scrolling on small screens */
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: #3a3a3a; /* Darker background for table */
    color: #f0f0f0;
}

th, td {
    padding: 12px;
    border: 1px solid #555; /* Darker border */
    text-align: left;
    white-space: nowrap; /* Prevent text wrapping in table cells */
}

th {
    background-color: #4CAF50; /* Green header */
    color: white;
}

tr:nth-child(even) {
    background-color: #333; /* Slightly different background for even rows */
}

.actions {
    text-align: center;
}

.actions .button {
    padding: 8px 12px; /* Smaller padding for action buttons */
    font-size: 0.9em;
    margin: 3px;
}

/* Pagination Styling */
.pagination {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap; /* Allow pagination links to wrap on smaller screens */
}

.page-link {
    display: inline-block;
    padding: 8px 16px;
    margin: 5px;
    background-color: #4CAF50;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.page-link:hover {
    background-color: #45a049;
}

.page-link.active {
    background-color: #66bb6a; /* Lighter green for active page */
    cursor: default;
}

/* Header Actions (Add New, Logout) */
.header-actions {
    width: 100%;
    display: flex;
    justify-content: flex-end; /* Align to the right */
    gap: 10px; /* Space between buttons */
    margin-bottom: 20px;
    flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
}

/* Search Form */
.search-form {
    width: 100%;
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap; /* Allow search elements to wrap */
    justify-content: center; /* Center search form on small screens */
}

.search-form input[type="text"] {
    flex-grow: 1; /* Allow input to take available space */
    min-width: 200px; /* Minimum width for the input */
}

.search-form button {
    flex-shrink: 0; /* Prevent button from shrinking */
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .container {
        padding: 15px;
        margin-top: 10px;
    }

    h2 {
        font-size: 1.8em;
        margin-bottom: 20px;
    }

    .button {
        padding: 8px 15px;
        font-size: 0.9em;
    }

    th, td {
        padding: 8px;
        font-size: 0.9em;
    }

    .header-actions, .search-form {
        flex-direction: column; /* Stack buttons and search on small screens */
        align-items: stretch; /* Stretch items to full width */
    }

    .header-actions .button, .search-form input[type="text"], .search-form button {
        width: 100%; /* Full width for stacked elements */
        margin: 5px 0; /* Adjust margin for stacking */
    }

    .pagination {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 10px;
    }

    h2 {
        font-size: 1.5em;
    }

    .button {
        font-size: 0.8em;
        padding: 6px 10px;
    }

    th, td {
        font-size: 0.8em;
        padding: 6px;
    }
    .actions .button {
        padding: 5px 8px;
        font-size: 0.8em;
    }
}