/* --- Root Variables --- */
:root {
    /* Primary Colors */
    --primary-color: #007bff;
    --primary-hover: #0056b3;

    /* Semantic Colors */
    --danger-color: #dc3545;
    --danger-hover: #c82333;
    --success-color: #28a745;
    --success-hover: #218838;

    /* Grayscale Colors */
    --light-gray: #f8f9fa;
    --gray: #6c757d;
    --dark-gray: #343a40;
    --border-color: #dee2e6;

    /* Shadows */
    --card-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    --button-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --button-hover-shadow: 0 6px 12px rgba(0, 0, 0, 0.2); /* Adjusted for more pronounced hover */
}

/* --- Global Styles --- */
body {
    font-family: 'Inter', sans-serif;
    background-color: #f4f7f6;
    color: var(--dark-gray);
    margin: 0;
    padding: 20px;
    line-height: 1.6;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    box-sizing: border-box; /* Ensures padding doesn't add to total width/height */
}

/* button header used in Admin side pages */
.search-form {
    margin-bottom: 0; /* Ensures it stays in the row */
}

/* New CSS for the form wrapping just the Logout button */
.logout-button-form {
    display: flex; /* Make this form a flex container */
    align-items: center; /* Vertically centers the button within the form */
    flex-shrink: 0; /* Prevents the logout button form from shrinking if space is tight */
}


/* --- Layout Containers --- */
.container {
    width: 100%;
    max-width: 500px;
    text-align: center;
}


.admin-container {
    max-width: 100%;
}


/* --- Header --- */
header h1 {
    font-weight: 700;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.1rem;
    color: var(--gray);
    margin-bottom: 2rem;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap; /* Allows items to wrap on smaller screens */
}

/* --- Card --- */
.card {
    background-color: #ffffff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    text-align: left;
}

/* --- Form Elements --- */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.form-group input[type="text"],
.form-group input[type="email"], /* Added common input types */
.form-group input[type="password"] {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 1rem;
    box-sizing: border-box;
}

/* --- Search Bar --- */
.search-form {
    flex-grow: 1;
    max-width: 500px; /* Limits search bar width in admin header */
    display: flex;
}

.search-form input[type="text"] {
    flex-grow: 1;
    padding: 10px 15px;
    border-radius: 8px 0 0 8px; /* Rounded only on the left */
    border: 1px solid var(--border-color);
    font-size: 1rem;
    border-right: none; /* Blends with the button */
}

.search-form button {
    padding: 10px 20px;
    border-radius: 0 8px 8px 0; /* Rounded only on the right */
    border: 1px solid var(--primary-color); /* Consistent border for button */
    background-color: var(--primary-color);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    border-left: none; /* Blends with the input */
}

.search-form button:hover {
    background-color: var(--primary-hover);
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 20px; /* More rounded pill shape */
    border: none;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    color: #ffffff;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: var(--button-shadow); /* Applied to all general buttons */
}

.btn:hover {
    box-shadow: var(--button-hover-shadow); /* Consistent hover shadow */
}

.btn-primary {
    background-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-start {
    background-color: var(--success-color);
}

.btn-start:hover {
    background-color: var(--success-hover);
}

.btn-start:disabled {
    background-color: #94d3a2; /* Lighter shade of success for disabled */
    cursor: not-allowed;
    box-shadow: none; /* No shadow when disabled */
}

.btn-stop {
    background-color: var(--danger-color);
}

.btn-stop:hover {
    background-color: var(--danger-hover);
}

.btn-stop:disabled {
    background-color: #f19ba3; /* Lighter shade of danger for disabled */
    cursor: not-allowed;
    box-shadow: none; /* No shadow when disabled */
}

.btn-delete {
    background-color: var(--danger-color);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.btn-delete:hover {
    background-color: var(--danger-hover);
}

/* Modern Logout Button */
.btn-logout {
    background-color: var(--danger-color);
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 30px; /* More pronounced pill shape */
    border: 2px solid var(--danger-color);
    font-size: 1rem;
    font-weight: bold;
   /* text-transform: uppercase; */
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--button-shadow); /* Uses consistent button shadow variable */
}

.btn-logout:hover {
    background-color: transparent;
    color: var(--danger-color);
    border-color: var(--danger-color);
    box-shadow: 0 6px 12px rgba(220, 53, 69, 0.3); /* Specific hover shadow for logout */
}

.btn-logout:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.2);
}

/* --- Alerts --- */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    border: 1px solid transparent;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

/* --- Table --- */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--light-gray);
    font-weight: 600;
    text-align: center; /* Generally table headers are centered */
    position: relative;
}

th a {
    color: var(--dark-gray);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex; /* Allows icon/text alignment for sortable headers */
    align-items: center;
    gap: 4px; /* Space between text and sort icon, if any */
}

th a:hover {
    text-decoration: underline;
}

tbody tr:hover {
    background-color: var(--light-gray);
}

/* --- Pagination --- */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem; /* Increased margin for better separation */
    gap: 5px;
}

.pagination a,
.pagination span { /* Applied to both links and span for current page */
    display: inline-block;
    margin: 0 4px;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease; /* Added color and border-color to transition */
}

.pagination a:hover {
    background-color: var(--primary-hover);
    color: #ffffff;
    border-color: var(--primary-hover);
}

.pagination .current-page { /* Specific class for the active page */
    background-color: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
    cursor: default; /* Indicates it's not clickable */
}

/* --- Timer Styles --- */
.timer-card {
    text-align: center;
}

.stopwatch-display {
    font-family: 'Roboto Mono', monospace;
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--dark-gray);
}

.timer-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
}

.final-time {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* --- Footer --- */
footer {
    margin-top: 2rem;
    font-size: 0.9rem;
    text-align: center; /* Typically footer text is centered */
    color: var(--gray); /* Applied directly for consistency */
}

footer a {
    color: var(--gray);
    text-decoration: none; /* Remove default underline */
}

footer a:hover {
    text-decoration: underline; /* Add underline on hover */
}

/* --- Mobile Enhancements --- */
@media (max-width: 768px) {
    body {
        padding: 15px; /* Slightly less padding on mobile */
    }

    header h1 {
        font-size: 2rem; /* Smaller heading on mobile */
    }

    header form input[type="text"],
    .search-form input[type="text"] { /* Combined for consistency */
        width: 100%;
        margin-bottom: 10px;
        border-radius: 8px; /* Full rounded corners when stacked */
    }

    header form button,
    .search-form button { /* Combined for consistency */
        width: 100%;
        border-radius: 8px; /* Full rounded corners when stacked */
        margin-top: 5px; /* Space between input and button */
    }

    .search-form input[type="text"],
    .search-form button {
        border-left: 1px solid var(--border-color); /* Restore full border */
        border-right: 1px solid var(--primary-color); /* Restore full border */
    }

    .admin-container {
        padding: 1rem;
    }

    table {
        font-size: 0.85rem; /* Smaller font for tables on mobile */
    }

    th, td {
        padding: 8px 10px; /* Reduced padding for table cells */
    }

    .timer-controls {
        grid-template-columns: 1fr; /* Stack buttons vertically on mobile */
    }

    .admin-header {
        flex-direction: column; /* Stack header elements */
        align-items: stretch; /* Stretch items to full width */
    }

    .btn-logout {
        width: 100%; /* Make logout button full width on mobile */
    }
}

        .success-actions {
            margin-top: 1.5rem;
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }
        .action-button {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.75rem;
            padding: 12px 24px;
            border-radius: 8px;
            border: 1px solid transparent;
            font-size: 1rem;
            font-weight: 600;
            text-decoration: none;
            cursor: pointer;
            transition: all 0.2s ease;
            width: 100%;
            box-sizing: border-box;
        }
        .action-button .action-icon {
            width: 20px;
            height: 20px;
        }
        
        /* Copy Button */
        .btn-copy {
            background-color: #e9ecef;
            color: #495057;
            border-color: #dee2e6;
        }
        .btn-copy:hover {
            background-color: #dee2e6;
            border-color: #ced4da;
        }

        /* Go to Link Button */
        .btn-go {
            background-color: var(--primary-color);
            color: #ffffff;
        }
        .btn-go:hover {
            background-color: var(--primary-hover);
        }

        /* Register Another Button */
        .btn-register-another {
            background-color: transparent;
            color: var(--primary-color);
            border-color: var(--primary-color);
            margin-top: 1rem;
        }
        .btn-register-another:hover {
             background-color: #f8f9fa;
        }
