/* A modern, dark, tech-inspired theme */

body {
    background-color: #121212;
    color: #e0e0e0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.container {
    width: 80%;
    max-width: 960px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: #1e1e1e;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* --- Navigation --- */
nav {
    background-color: #1e1e1e;
    padding: 1rem 0;
    border-bottom: 1px solid #333;
    text-align: center;
}

nav a {
    color: #bb86fc; /* A nice techy purple */
    text-decoration: none;
    font-size: 1.2rem;
    margin: 0 15px;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

nav a:hover, nav a:focus {
    background-color: #bb86fc;
    color: #121212;
}

/* --- Typography --- */
h1, h2, h3 {
    color: #03dac6; /* A contrasting teal/cyan */
    margin-top: 0;
}

p {
    margin-bottom: 1rem;
}

a {
    color: #bb86fc;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: #e0e0e0;
    font-weight: bold;
}

input[type="checkbox"] {
    width: auto;
    height: 1rem;
    width: 1rem;
    vertical-align: middle;
}

input[type="email"],
input[type="password"],
input[type="text"],
select,
input[type="number"],
textarea,
.readonly-textarea {
    width: 100%;
    box-sizing: border-box; /* Ensures padding doesn't affect width */
    padding: 0.75rem;
    background-color: #333;
    border: 1px solid #555;
    border-radius: 5px;
    color: #e0e0e0;
    font-size: 1rem;
}

input[type="color"] {
    padding: 0.25rem;
    height: 3rem;
    width: 6rem;
}

.form-check {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.form-check label {
    margin-bottom: 0; /* Override default label margin */
    margin-left: 0.5rem;
    font-weight: normal; /* Make it less prominent than main labels */
}

button {
    background-color: #bb86fc;
    color: #121212;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

button:disabled {
    background-color: #555;
    cursor: not-allowed;
}

.btn-danger {
    background-color: #cf6679; /* Material Design error color */
    color: #121212;
}

.btn-secondary {
    background-color: #333;
    color: #e0e0e0;
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
}

.label-with-button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.button-group {
    display: flex;
    gap: 0.5rem;
}

.feedback {
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.invalid {
    color: #cf6679; /* Material Design error color */
}

.valid {
    color: #03dac6; /* Matches heading color */
}

/* --- Flash Messages --- */
.flash-messages {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0;
}

.flash {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 5px;
    border: 1px solid transparent;
}

.flash.success {
    color: #121212;
    background-color: #03dac6;
    border-color: #03dac6;
}

.flash.error {
    color: #121212;
    background-color: #cf6679;
    border-color: #cf6679;
}

/* --- Calendar --- */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.calendar-header h1 {
    margin: 0;
}

.calendar-nav a {
    font-size: 2rem;
    color: #bb86fc;
    text-decoration: none;
    padding: 0 1rem;
}

.calendar-grid {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.calendar-grid th, .calendar-grid td {
    border: 1px solid #333;
    padding: 0.5rem;
    text-align: right;
    vertical-align: top;
    height: 6rem;
}

.calendar-grid th {
    height: auto;
    text-align: center;
    font-weight: bold;
    color: #03dac6;
}

.day-number {
    font-size: 1.1rem;
    font-weight: bold;
}

.other-month .day-number {
    color: #555;
    opacity: 0.6;
}

.today {
    background-color: rgba(187, 134, 252, 0.15);
}

.create-event-main-btn {
    display: block;
    margin: 0 auto 2rem auto;
    font-size: 1.1rem;
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal {
    background-color: #1e1e1e;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    position: relative;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.modal-body {
    overflow-y: auto;
    /* Add some space between the content and the scrollbar */
    padding-right: 1rem;
}

#clash-confirm-modal .modal-body {
    max-height: 40vh; /* Limit height and allow scrolling */
    overflow-y: auto;
}

.modal-footer {
    border-top: 1px solid #333;
    padding-top: 1rem;
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.modal-header h2 {
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: #e0e0e0;
    font-size: 2.5rem;
    cursor: pointer;
    line-height: 1;
}

.hidden {
    display: none !important;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

/* --- Event Display --- */
.events-container {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}

/* Ensure modals can stack on top of each other */
#view-day-modal-overlay, #view-event-modal-overlay {
    z-index: 1000;
}

#modal-overlay { /* Create/Edit Modal */
    z-index: 1010;
}

#clash-confirm-modal-overlay {
    z-index: 1015;
}

#delete-confirm-modal-overlay {
    z-index: 1020;
}

.event-pill {
    color: #121212;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: filter 0.2s ease;
}

.event-pill:hover {
    filter: brightness(1.2);
}

.event-time {
    font-weight: bold;
    margin-right: 4px;
}

.more-events-link {
    font-size: 0.8rem;
    font-weight: bold;
    margin-top: 4px;
    text-align: left;
}

/* --- View Day Modal --- */
.view-day-event-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.view-day-event-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #333;
}

.view-day-event-item:last-child {
    border-bottom: none;
}

/* --- View Event Modal --- */
.event-details-list {
    margin: 0;
}

.event-details-list dt {
    font-weight: bold;
    color: #03dac6;
    margin-top: 1rem;
}

.event-details-list dt:first-child {
    margin-top: 0;
}

.event-details-list dd {
    margin-left: 0;
    color: #e0e0e0;
}

.readonly-textarea {
    background-color: transparent;
    border: none;
    color: #e0e0e0;
    padding: 0;
    font-family: inherit;
    resize: none;
}

.ai-comment-section {
    margin-top: 1.5rem;
    border-top: 1px solid #333;
    padding-top: 1rem;
}

.ai-comment-section #clash-comments-display {
    margin-top: 0.75rem;
    width: 100%; /* Ensure it fills the space */
}