/* Reset defaults */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #1c2526;
    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, "San Francisco", "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    padding: 0;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    color: #ffffff;
    margin-bottom: 15px;
}

h1 {
    font-size: 2em;
    font-weight: 600;
}

h2 {
    font-size: 1.5em;
    font-weight: 500;
}

h3 {
    font-size: 1.25em;
    font-weight: 400;
}

/* Paragraphs and text */
p {
    margin-bottom: 15px;
}

a {
    color: #007aff;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #0066d6;
}

/* Container */
.container {
    min-height: calc(100vh - 60px);
    padding: 80px 20px 20px 20px;
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Forms */
form {
    max-width: 600px;
    margin: 0 auto;
    padding: 30px;
    background-color: #2c3539;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    width: 100%;
}

/* Specific styling for update-form in edit_mac.php */
#update-form {
    max-width: none;
    width: 100%;
    padding: 10px;
    background-color: transparent;
    box-shadow: none;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Center the buttons specifically */
#update-form .button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
}

/* Ensure buttons inherit consistent styling */
#update-form button {
    padding: 10px 20px;
    margin: 0;
}

/* Specific styling for delete-form in del_device.php */
#delete-form {
    max-width: none;
    width: 100%;
    padding: 10px;
    background-color: transparent;
    box-shadow: none;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Center the buttons specifically */
#delete-form .button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
    width: 100%;
    max-width: 1600px; /* Match the table's max-width */
}

/* Ensure buttons inherit consistent styling */
#delete-form button {
    padding: 10px 20px;
    margin: 0;
}

/* Ensure Cancel button stays blue */
#delete-form #cancel-btn {
    background-color: #007aff;
}

#delete-form #cancel-btn:hover {
    background-color: #0066d6;
}

/* Specific styling for upload-form in mass_upload.php */
#upload-form {
    display: inline-block;
    text-align: left;
    padding: 20px;
}

/* Input fields */
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    background-color: #3a4449;
    border: 1px solid #4a5559;
    color: #ffffff;
    padding: 10px;
    margin: 8px 0;
    width: 100%;
    border-radius: 5px;
    font-size: 1em;
    transition: border-color 0.2s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    border-color: #007aff;
    outline: none;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

/* File input styling */
input[type="file"] {
    background-color: #3a4449;
    border: 1px solid #4a5559;
    color: #ffffff;
    padding: 8px;
    border-radius: 5px;
}

input[type="file"]::-webkit-file-upload-button {
    background-color: #007aff;
    border: none;
    color: #ffffff;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
}

/* Buttons */
button,
input[type="submit"],
input[type="button"] {
    background-color: #007aff;
    border: none;
    color: #ffffff;
    padding: 10px 20px;
    margin: 8px 5px 8px 0;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s ease;
}

button:hover,
input[type="submit"]:hover,
input[type="button"]:hover {
    background-color: #0066d6;
}

button:disabled {
    background-color: #4a5559;
    cursor: not-allowed;
}

.delete-btn {
    background-color: #ff3b30;
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    margin: 8px 5px 8px 0;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s ease;
}

.delete-btn:hover {
    background-color: #cc2e26;
}

/* Check All button */
.check-all-btn {
    background-color: #34c759;
    border: none;
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s ease;
}

.check-all-btn:hover {
    background-color: #2ea44f;
}

/* Check All container */
.check-all-container {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    max-width: 1600px; /* Match the table's max-width */
    margin: 10px auto;
}

/* Align Check All button with the Delete column */
.check-all-container .check-all-btn {
    margin-right: 15px; /* Align with the Delete column's padding */
}

/* Table container */
.table-container {
    width: 100%;
    max-width: 1600px; /* Match the table's max-width */
    margin: 0 auto;
    overflow-x: auto; /* Allow horizontal scrolling on small screens */
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background-color: #2c3539;
    border-radius: 5px;
    overflow: hidden;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #3a4449;
}

th {
    background-color: #3a4449;
    font-weight: 600;
}

tr:hover {
    background-color: #354045;
}

/* Lists */
ul, ol {
    margin: 15px 0 15px 20px;
}

li {
    margin-bottom: 8px;
}

/* Menu */
.menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 10px 20px;
    background-color: #2c3539;
    z-index: 1000;
    height: 60px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.menu a,
.menu button {
    background-color: #3a4449;
    padding: 8px 15px;
    border-radius: 5px;
    text-decoration: none;
    color: #ffffff;
    font-size: 0.9em;
    transition: background-color 0.2s ease;
}

.menu a:hover,
.menu button:hover {
    background-color: #354045;
}

/* Miscellaneous */
label {
    display: block;
    margin: 8px 0 4px;
    font-weight: 500;
    color: #e0e0e0;
}

.required {
    color: #ff3b30;
}

input[type="checkbox"] {
    margin-right: 8px;
}

hr {
    border: none;
    border-top: 1px solid #3a4449;
    margin: 20px 0;
}

/* Error and success messages */
.error {
    color: #ff3b30;
    margin: 10px 0;
    text-align: center;
}

.success {
    color: #34c759;
    margin: 10px 0;
    text-align: center;
}

.rate-limit-error {
    transition: opacity 0.5s ease;
}

.rate-limit-error.fade-out {
    opacity: 0;
}

/* Error message overlay */
#error-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #ff3b30;
    color: #ffffff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    text-align: center;
    transition: opacity 0.5s ease;
}

/* Success message overlay */
#success-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #34c759;
    padding: 20px;
    color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    text-align: center;
}

/* Search container for edit_mac.php, find_mac.php, and view_logs.php */
.search-container {
    margin: 20px 0;
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

/* Ensure body > .search-container stays centered */
body > .search-container {
    padding-top: 70px;
}

/* Search input */
.search-input {
    width: 80%;
    font-size: 1.5em;
}

/* Specific styling for view_logs.php and view_edits.php search input */
.main-content .search-container #search:not(.search-input) {
    width: 300px;
    margin: 0;
}

/* Specific styling for edit_mac.php, find_mac.php, and find_rejected_mac.php search input */
body > .search-container #search,
.main-content .search-container #search.search-input,
.main-content .search-container #search {
    width: 75%;
}

/* Styling for limit dropdown in find_mac.php and find_rejected_mac.php */
#limit {
    width: 100px;
}

/* Buttons in search-container */
.search-container button {
    padding: 10px 20px;
    margin: 0;
}

/* Button group */
.button-group {
    display: flex;
    gap: 10px;
}

/* Style #results separately */
#results {
    margin: 20px auto;
    width: 100%;
    max-width: 1200px;
    text-align: center;
    padding: 20px 0 0;
}

/* Wider #results for del_device.php */
body:has(.del-results-table) #results {
    max-width: 1600px; /* Allow a wider table */
    padding: 20px; /* Ensure consistent spacing */
}

/* Main content */
.main-content {
    padding: 70px 20px 20px 20px;
    text-align: center;
}

/* Results table for find_mac.php, edit_mac.php, mass_upload_results.php */
.results-table {
    width: 100% !important;
    min-width: 100%;
    margin: 10px 0;
    table-layout: fixed;
}

/* Explicit column widths for results-table */
.results-table th,
.results-table td {
    width: 14%;
    word-wrap: break-word;
}

/* Adjust Delete column */
.results-table th:nth-child(6),
.results-table td:nth-child(6) {
    width: 10%;
}

/* Specific styling for del_device.php results table */
.del-results-table {
    width: 100%;
    min-width: 1200px; /* Ensure a minimum width */
    max-width: 1600px;
    margin: 0 auto; /* Center the table */
    table-layout: auto; /* Let columns size based on content */
}

/* Adjust column widths for del-results-table */
.del-results-table th,
.del-results-table td {
    width: auto; /* Remove fixed percentage */
    min-width: 150px; /* Ensure columns have enough space */
    padding: 12px 15px;
}

/* Keep Delete column narrower */
.del-results-table th:nth-child(6),
.del-results-table td:nth-child(6) {
    min-width: 80px; /* Smaller for checkbox */
    width: 80px; /* Fixed width for alignment */
}

/* Style for added/skipped rows */
.added-row {
    background-color: #1a3c1a;
}

.skipped-row {
    background-color: #3c1a1a;
}

.added-row:hover {
    background-color: #2a5c2a;
}

.skipped-row:hover {
    background-color: #5c2a2a;
}

/* Pagination */
.pagination {
    text-align: center;
    margin: 20px 0;
}

/* Responsive design */
@media (max-width: 768px) {
    .menu {
        position: static;
        flex-wrap: wrap;
        justify-content: center;
        margin-bottom: 20px;
        height: auto;
    }

    .container,
    .search-container,
    .main-content {
        padding: 20px;
    }

    form,
    .results-table {
        max-width: 100%;
        margin: 0 10px;
    }

    #update-form {
        padding: 10px;
    }

    #delete-form {
        padding: 10px;
    }

    .search-input {
        width: 100%;
    }

    #search {
        width: 100%;
    }

    .search-container {
        flex-direction: column;
        align-items: stretch;
    }

    body > .search-container {
        padding-top: 20px;
    }

    .search-container button {
        margin: 5px 0;
    }

    #limit {
        width: 100%;
    }

    body {
        padding: 0;
    }

    .results-table th,
    .results-table td {
        width: auto;
    }

    #results {
        width: 100%;
        margin: 10px 0;
        padding: 10px 0;
    }

    /* Responsive adjustments for del-results-table */
    .del-results-table {
        min-width: 100%;
        max-width: 100%;
    }

    .del-results-table th,
    .del-results-table td {
        min-width: 100px;
    }

    .del-results-table th:nth-child(6),
    .del-results-table td:nth-child(6) {
        min-width: 60px;
        width: 60px;
    }

    #delete-form .button-group {
        max-width: 100%;
    }

    /* Responsive adjustments for check-all-container */
    .check-all-container {
        margin-right: 0;
    }

    .check-all-container .check-all-btn {
        margin-right: 10px;
    }

    .table-container {
        overflow-x: auto;
    }
}

/* Accessibility */
input:focus,
button:focus,
a:focus {
    outline: 2px solid #007aff;
    outline-offset: 2px;
}

/* Logs table for view_logs.php */
.logs-table {
    width: 100%;
    margin: 10px auto;
}

.logs-table th,
.logs-table td {
    padding: 10px;
    text-align: left;
}

/* Edits table for view_edits.php */
.edits-table {
    width: 100%;
    margin: 10px auto;
}

.edits-table th,
.edits-table td {
    padding: 10px;
    text-align: left;
}

/* Render newlines in the Username column (5th column) */
.edits-table th:nth-child(5),
.edits-table td:nth-child(5) {
    white-space: pre-line; /* Render \n as line breaks */
}

/* Render newlines in the Notes column (6th column) */
.edits-table th:nth-child(6),
.edits-table td:nth-child(6) {
    white-space: pre-line; /* Render \n as line breaks */
}

/* Style h2 */
h2 {
    font-size: 1.5em;
    font-weight: 500;
    margin-bottom: 15px;
}

/* Profile info */
.profile-info {
    margin-bottom: 20px;
}

.profile-info p {
    margin: 5px 0;
}

/* Password form */
.password-form {
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
    background-color: #2c3539;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.password-form input[type="password"],
.password-form input[type="text"] {
    display: block;
    width: 100%;
    margin: 10px 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .password-form {
        max-width: 100%;
        margin: 0 10px;
    }
}

