/* Shared Layout */
body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    height: 100vh;
    background-color: #ffffff;
}

.page-header {
    color: #2563eb;
    font-size: 28px;
    font-weight: bold;
    letter-spacing: 2px;
    margin-bottom: 30px;
}

.section-header {
    color: #000000;
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 20px;
}

/* The Sidebar */
.sidebar {
    width: 250px;
    background-color: #ffffff;
    color: white;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.sidebar h2 {
    margin-top: 0;
    font-size: 24px;
    letter-spacing: 2px;
    margin-bottom: 30px;
}

.sidebar-title {
    color: #2563eb;
    font-weight: bold;
}

/* Card-Style Links */
.nav-link {
    display: block;
    /* Forces the link to act like a full-width box instead of text */
    color: #1d1d1d;
    text-decoration: none;
    padding: 12px 15px;
    /* Gives the card physical height and width */
    font-size: 16px;
    margin-bottom: 10px;
    /* Separates the cards from each other */
    border-radius: 16px;
    /* Rounded corners */
    border: 1px solid transparent;
    /* Invisible border to prevent layout shift on hover */
    transition: all 0.2s ease-in-out;
    /* Makes the hover effect smooth instead of instant */
    background-color: transparent;
}

/* When the mouse hovers over an inactive card */
.nav-link:hover {
    border: 1px solid #2563eb;
    /* Lighter gray to show it's clickable */
    color: #1d1d1d;
}

/* The currently active page card */
.active {
    background-color: #2563eb;
    /* ALPHV blue */
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    /* Drops a tiny shadow behind the active card */
}

/* Make active card not respond to hover */
.active:hover {
    border: 1px solid #2563eb;
    color: white;
}

/* Form Elements & Labels */
label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}

input,
select {
    padding: 12px 16px;
    /* Larger, softer touch target */
    margin: 0 0 20px 0;
    width: 100%;
    max-width: 100%;
    display: block;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    box-sizing: border-box;
    background-color: #f9fafb;
    /* Slightly off-white background */
    font-size: 15px;
    color: #111827;
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
    /* Subtle inner shadow for depth */
}

/* The "Focus" State - Guides the user's eye */
input:focus,
select:focus {
    outline: none;
    border-color: #2563eb;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
    /* Soft ALPHV blue glow */
}

/* Customizing the Select Dropdown Arrow */
select {
    appearance: none;
    /* Deletes the default browser arrow */
    -webkit-appearance: none;
    /* For Safari */
    -moz-appearance: none;
    /* For Firefox */

    /* Injects a crisp, custom SVG chevron arrow */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234b5563' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 16px center;
    /* Pins it exactly 16px from the right edge */
    background-size: 16px;
    /* Scales the icon */
    padding-right: 40px;
    /* Prevents long text from typing over the icon */
}

/* Specific fix for the login card input width */
.login-card input {
    max-width: 100%;
}

/* Buttons */
button {
    padding: 12px 20px;
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

/* Button Micro-interactions */
button:hover {
    background-color: #1d4ed8;
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
    /* Slight visual lift effect on hover */
}

button:active {
    transform: translateY(1px);
    /* Physically 'pushes' the button down on click */
    box-shadow: none;
}

.logout-btn {
    margin-top: auto;
    padding: 12px 15px;
    background-color: #dc2626;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 12px;
    text-align: center;
    font-weight: bold;
    transition: background-color 0.2s ease;
}

.logout-btn:hover {
    background-color: #b91c1c;
}

/* Main Content Area & Cards */
.main-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.main-content.center {
    justify-content: center;
    align-items: center;
}

/* Used for login page */
.admin-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 0px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    width: 100%;
    max-width: 1000px;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 350px;
}

/* Tables */
table {
    width: 100%;
    text-align: left;
    border-collapse: collapse;
    margin-top: 15px;
    table-layout: fixed;
    /* Forces the browser to respect our strict widths */
}

th,
td {
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 5px;
    /* Truncate long text instead of breaking the layout */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

th {
    color: #4b5563;
}

/* Assign strict percentages to each column so they never shift.
  (Adjust these percentages based on user.html vs admin.html needs)
*/
th:nth-child(1) {
    width: 25%;
}

/* Timestamp */
th:nth-child(2) {
    width: 20%;
}

/* Name */
th:nth-child(3) {
    width: 15%;
}

/* Shape */
th:nth-child(4) {
    width: 15%;
}

/* Color */
th:nth-child(5) {
    width: 25%;
}

/* Actions */

/* Shapes */
.shape {
    margin: 0 auto;
}

.square {
    width: 40px;
    height: 40px;
}

.circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.triangle {
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-bottom: 40px solid;
}

/* Utilities */
#errorMessage,
#statusMessage {
    margin-top: 15px;
    font-weight: bold;
    font-size: 14px;
}

/* Pagination Controls */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px 0 6px;
    border-top: 1px solid #e5e7eb;
    margin-top: 12px;
}

.page-btn {
    padding: 8px 18px;
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
    min-width: 90px;
}

.page-btn:hover:not(:disabled) {
    background-color: #1d4ed8;
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
}

.page-btn:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: none;
}

.page-btn:disabled {
    background-color: #93c5fd;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

.page-info {
    font-size: 14px;
    color: #374151;
    font-weight: 500;
    min-width: 140px;
    text-align: center;
}

.page-total {
    color: #9ca3af;
    font-weight: 400;
    margin-left: 4px;
}

/* Sortable Table Headers */
th.sortable {
    cursor: pointer;
    user-select: none;
    /* Prevents text selection on rapid double-clicks */
    white-space: nowrap;
    transition: color 0.15s ease;
}

th.sortable:hover {
    color: #2563eb;
}

th.sort-active {
    color: #2563eb;
    border-bottom: 2px solid #2563eb;
}

/* The ↕ / ↑ / ↓ character next to the column label */
.sort-indicator {
    font-size: 11px;
    margin-left: 4px;
    opacity: 0.45;
    /* Dim on inactive columns */
    transition: opacity 0.15s ease;
}

th.sort-active .sort-indicator {
    opacity: 1;
    /* Full brightness on the active column */
}

th.sortable:hover .sort-indicator {
    opacity: 0.8;
}