/* General Body Styles */
body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #f9f9f9;
    color: #333;
}

/* Main Container for Centering Content */
.container {
    max-width: 800px; /* Reverted to the original wider layout */
    margin: 40px auto;
    padding: 0 20px;
}

/* Header Section */
header {
    text-align: center;
    margin-bottom: 40px;
}

.profile-pic {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: contain;
    border: 3px solid #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background-color: white;
}

h1 {
    margin: 10px 0 5px;
    font-size: 2.2em;
}

.bio {
    font-size: 1.1em;
    color: #555;
    margin-top: 0;
}

/* Section Styling */
h2 {
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-size: 1.6em;
}

/* Navigation Ribbon */
nav {
    background-color: #eaf6ff;
    width: 100%;
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
}

nav ul li {
    margin: 0 20px;
}

nav ul li a {
    text-decoration: none;
    color: #333;
    font-weight: bold;
    font-size: 1.1em;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

nav ul li a:hover {
    background-color: #d0e9fc;
}

/* Publication and other lists */
.publication-list, .news-list, .teaching-list {
    list-style: none;
    padding-left: 0;
}

.publication-item, .news-list li, .teaching-list li {
    margin-bottom: 20px;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 50px;
    padding: 20px 0;
    border-top: 1px solid #eee;
    color: #888;
}

/* Page Navigation System */
main > section.page {
    display: none;
}
main > section.page.active {
    display: block;
}

/* NEW: Custom Tooltip for instant hover feedback */
.tooltip {
    display: none;
    position: absolute;
    background-color: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.9em;
    z-index: 3000;
    pointer-events: none; /* So it doesn't block mouse events on elements underneath */
}

/* --- MODIFIED & NEW CALENDAR STYLES --- */

#calendar-container {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

#calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

#calendar-header button {
    background: #f0f0f0;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.2em;
}

/* CORRECTED: Changed .calendar-grid to #calendar-grid to match the HTML ID */
.calendar-weekdays, #calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
}

.calendar-weekdays div {
    font-weight: bold;
    padding: 10px 0;
    color: #777;
}

.calendar-day {
    padding: 10px 5px;
    border-top: 1px solid #f0f0f0;
    min-height: 120px; /* Reverted to smaller height */
    position: relative;
    display: flex;
    flex-direction: column;
}

.day-number {
    font-weight: bold;
    margin-bottom: 5px;
    align-self: flex-start;
}

.calendar-day.past-day, .calendar-day.unbookable-day {
    background-color: #fafafa;
    color: #ccc;
}
.calendar-day.unbookable-day .time-slots {
    display: none; /* Hide time slots for unbookable future days */
}

.time-slots {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.time-slot {
    background: #e0f7fa;
    border: 1px solid #b2ebf2;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    width: 100%;
}

.time-slot.reserved {
    background-color: #ffcc80; /* Orange for reserved */
    border-color: #ffb74d;
}

/* Styles for the editor panel */
.name-list-panel {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.name-list-content {
    background: white;
    padding: 25px;
    border-radius: 8px;
    width: 90%;
    max-width: 450px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5em;
    background: none;
    border: none;
    cursor: pointer;
}

#name-list-editor {
    width: 100%;
    margin: 15px 0;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1em;
    box-sizing: border-box; /* Important for padding */
}

#save-name-list {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    align-self: flex-end; /* Pushes button to the right */
}
#save-name-list:hover {
    background: #0056b3;
}



/* --- LOGIN MODAL STYLES --- */
/* The Modal (background) */
.modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6); /* Black w/ opacity */
}

/* Modal Content/Box */
.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 25px;
    border: 1px solid #888;
    width: 80%;
    max-width: 400px;
    border-radius: 8px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-content h2 {
    margin-top: 0;
}

/* The Close Button */
.modal-content .close-button {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
}

.modal-content .close-button:hover,
.modal-content .close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* --- LOGIN/LOGOUT LINK STYLES --- */
#login-prompt-container .login-link,
#login-prompt-container .logout-link {
    color: #007bff;
    text-decoration: underline;
    cursor: pointer;
}

.change-password-link {
    color: #007bff;
    text-decoration: underline;
    cursor: pointer;
}

/* --- NEW STYLES FOR FLOATING LABELS --- */
/* A container to hold the icon and the input wrapper */
.input-container {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 25px;
}
.change-password-container {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 25px;
}

/* Style for the icons */
.input-container .icon {
    font-size: 1.2em;
    color: #ccc;
    margin-right: 15px;
    transform: translateY(-3px); /* Adjust this value to precisely move the icon */
    transition: color 0.3s;
}
.change-password-container .icon {
    font-size: 1.2em;
    color: #ccc;
    margin-right: 15px;
    transform: translateY(-3px); /* Adjust this value to precisely move the icon */
    transition: color 0.3s;
}

/* Wrapper for the input field and its label */
.input-wrapper {
    position: relative;
    width: 100%;
}
.change-password-wrapper {
    position: relative;
    width: 100%;
}

/* Style for the actual input field */
.input-wrapper input {
    width: 100%;
    border: none;
    border-bottom: 2px solid #ccc;
    padding: 10px 0 5px 2px; /* Reduced bottom padding */
    font-size: 1em;
    background: transparent;
    outline: none;
    transition: border-bottom-color 0.3s;
}
.change-password-wrapper input {
    width: 100%;
    border: none;
    border-bottom: 2px solid #ccc;
    padding: 10px 0 5px 2px; /* Reduced bottom padding */
    font-size: 1em;
    background: transparent;
    outline: none;
    transition: border-bottom-color 0.3s;
}

/* The floating label */
.placeholder-label {
    position: absolute;
    top: 50%;
    left: 5px;
    transform: translateY(-50%);
    font-size: 1.2em;
    color: #999;
    pointer-events: none; /* So clicks go to input */
    transition: all 0.2s ease;
}

/* When input is focused or has a value, move the label */
.input-wrapper input:focus + .placeholder-label,
.input-wrapper input:not(:placeholder-shown) + .placeholder-label {
    top: -6px; /* Moves the label up */
    left: 3px;
    font-size: 0.7em; /* Shrinks the font even smaller */
    color: #999; /* Changed to fixed color */
    transform: translateY(0%);
}
.change-password-wrapper input:focus + .placeholder-label,
.change-password-wrapper input:not(:placeholder-shown) + .placeholder-label {
    top: -6px; /* Moves the label up */
    left: 3px;
    font-size: 0.7em; /* Shrinks the font even smaller */
    color: #999; /* Changed to fixed color */
    transform: translateY(0%);
}

#login-button {
    background: #007bff;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    width: 101%; /* Making the button match the width of the inputs */
    align-self: center;
}
#save-new-password-button {
    background: #007bff;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    width: 101%; /* Making the button match the width of the inputs */
    align-self: center;
}

#login-button:hover {
    background: #0056b3;
}
#change-password-button:hover {
    background: #0056b3;
}




button.loading {
  background: #ccc !important;
  color: #666 !important;
  cursor: not-allowed;
  position: relative;
}

button.loading::after {
  content: "";
  border: 2px solid #f3f3f3;
  border-top: 2px solid #333;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  margin-left: 8px;
  vertical-align: middle;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
