:root {
    --log-accent: #f27c11;
    --log-accent-hover: #ca5c0a;
    --log-accent-soft: rgba(242, 124, 17, 0.2);
    --log-button-text: #ffffff;
}

/* ==========================================================================
   Combined Diary and Adventure Log Styles
   ========================================================================== */

/* Calendar Styles */
.calendar {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    table-layout: fixed; /* This ensures equal column widths */
}

.calendar th, .calendar td {
    border: 1px solid #555555;
    padding: 10px;
    text-align: center;
    vertical-align: middle;
    position: relative;
    width: 14.28%; /* 100% / 7 days = 14.28% */
    min-width: 100px; /* Minimum width to prevent too narrow cells */
}

.calendar th {
    background-color: #3a3a3a;
    color: #f8f9fa;
    white-space: nowrap; /* Prevent day names from wrapping */
    overflow: hidden; /* Hide overflow text */
    text-overflow: ellipsis; /* Show ellipsis for overflow */
}

.calendar td {
    aspect-ratio: 1; /* Make cells square */
    height: 100px; /* Fixed height for cells */
}

.calendar td.has-event {
    color: #ffffff;
}

.calendar td a {
    color: inherit;
    text-decoration: none;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    text-align: center;
    padding: 5px;
    box-sizing: border-box;
}

.calendar td.has-event a {
    background-color: var(--log-accent);
    color: var(--log-button-text);
    border: 2px solid var(--log-accent-hover);
    border-radius: 5px;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease-in-out;
    justify-content: center;
    align-items: center;
    position: relative;
    display: flex;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

.calendar td.has-event a:hover {
    background-color: var(--log-accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    color: var(--log-button-text);
}

.diary-calendar td.has-event > a,
.diary-calendar td.has-event > a:visited,
.diary-calendar td.has-event > a:hover,
.diary-calendar td.has-event > a:focus-visible {
    color: #ffffff !important;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}

.calendar td.has-event a:hover::after {
    content: attr(data-event-count) " entries";
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: var(--log-button-text);
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 4;
}

.calendar td.current-date a {
    background-color: #28a745;
    color: var(--log-button-text);
    border: 2px solid #1e7e34;
    font-weight: bold;
}

.calendar td.current-date.has-event a {
    background-color: #28a745;
    color: var(--log-button-text);
    border: 2px solid #1e7e34;
}

/* Calendar Navigation */
.calendar-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    gap: 10px;
}

.calendar-navigation span {
    padding: 0 15px;
    color: #f8f9fa;
    font-size: 1.5em;
    min-width: 200px;
    text-align: center;
    display: inline-block;
    width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-navigation a {
    min-width: 150px;
    text-align: center;
    display: inline-block;
    padding: 8px 15px;
    text-decoration: none;
    border-radius: 5px;
    background-color: var(--log-accent);
    color: var(--log-button-text);
    border: 2px solid var(--log-accent-hover);
    transition: all 0.3s ease;
}

.calendar-navigation a:hover {
    background-color: var(--log-accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.diary-calendar-navigation .diary-calendar-nav,
.diary-calendar-navigation .diary-calendar-nav:visited {
    background-color: var(--log-accent);
    border: 2px solid var(--log-accent-hover);
    color: #ffffff !important;
    font-weight: 600;
}

.diary-calendar-navigation .diary-calendar-nav:hover,
.diary-calendar-navigation .diary-calendar-nav:focus-visible {
    background-color: var(--log-accent-hover);
    border-color: var(--log-accent-hover);
    color: #ffffff !important;
}

/* Calendar Mode Toggle */
.calendar-mode-toggle {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

body .calendar-mode-toggle form button.btn-base[type="submit"] {
    padding: 10px 20px;
    font-size: 1.1em;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #3b3b3b !important;
    border: 2px solid #565656 !important;
    color: #f5f1e8 !important;
}

body .calendar-mode-toggle form button.btn-primary[type="submit"] {
    border-color: var(--log-accent) !important;
}

body .calendar-mode-toggle form button.btn-secondary[type="submit"] {
    border-color: #565656 !important;
}

body .calendar-mode-toggle form button.btn-base[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

body .calendar-mode-toggle form button.btn-primary[type="submit"]:hover {
    background: #484848 !important;
}

/* CSV Buttons Container */
.csv-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 10px;
    gap: 10px;
}

.csv-buttons button {
    min-width: 200px;
}

.csv-buttons .btn-save,
body .csv-buttons button.log-action-button[type="submit"] {
    background: #2f714b !important;
    background-image: none !important;
    border-color: #4c996b !important;
    color: #ffffff !important;
}

.csv-buttons .btn-save:hover,
body .csv-buttons button.log-action-button[type="submit"]:hover {
    background: #2f714b !important;
    border-color: #4c996b !important;
    color: #ffffff !important;
}

/* Event Table Styles */
.event-table {
    width: 100%;
    margin-top: 20px;
    scroll-margin-top: 200px;
}

.event-table th {
    background-color: #3a3a3a;
    color: #f8f9fa;
    padding: 12px;
}

.event-table td {
    padding: 12px;
    word-wrap: break-word;
}

.event-table .entry-cell {
    cursor: pointer;
    transition: all 0.2s ease;
}

.event-table .entry-cell:hover {
    background-color: var(--log-accent-soft);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.event-table tr {
    transition: background-color 0.2s;
}

.event-table tr:nth-child(even) {
    background-color: #3a3a3a;
}

.event-table tr.speaker-even {
    background-color: #1a1a1a;
}

.event-table tr.speaker-odd {
    background-color: #2d2d2d;
}

/* Column widths for event table */
.col-context { width: 55%; }
.col-people { width: 20%; }
.col-gamets { width: 15%; }
.col-time { width: 10%; font-family: monospace; font-size: 0.9em; }

/* Location change row styles */
.location-change-row {
    background-color: #2c3e50;
    color: #ecf0f1;
    font-weight: bold;
    text-align: center;
    padding: 8px;
}

.location-change-row td {
    background-color: #34495e
}

/* Main container padding */
main.container {
    padding-bottom: 40px;
    padding-left: 10px;
    max-width: 1600px;
}

/* People List Styles */
.people-list {
    background-color: #3a3a3a;
    border-radius: 8px;
    padding: 20px;
    margin: 20px auto;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 100%;
}

.people-search {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border: 2px solid #555555;
    border-radius: 6px;
    background-color: #4a4a4a;
    color: #f8f9fa;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.people-search:focus {
    outline: none;
    border-color: var(--log-accent);
}

.people-list form {
    margin: 8px 0;
}

.people-item-container {
    display: flex;
    gap: 8px;
    align-items: stretch;
    margin: 8px 0;
}

body .people-list form button.people-item[type="submit"] {
    width: 100%;
    padding: 12px 20px;
    background: #3b3b3b !important;
    border: 2px solid #565656 !important;
    border-radius: 6px;
    color: #f5f1e8 !important;
    font-size: 16px;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

body .people-list form button.people-item[type="submit"]:hover {
    background: #484848 !important;
    border-color: var(--log-accent) !important;
    transform: translateX(5px);
}

.people-count {
    background-color: var(--log-accent);
    color: var(--log-button-text);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
}

.pdf-export-btn,
.pdf-export-btn:visited {
    padding: 10px 18px;
    background-color: var(--log-accent) !important;
    border: 2px solid var(--log-accent-hover) !important;
    border-radius: 6px;
    color: #ffffff !important;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.pdf-export-btn:hover,
.pdf-export-btn:focus-visible {
    background-color: var(--log-accent-hover) !important;
    border-color: var(--log-accent-hover) !important;
    color: #ffffff !important;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.pdf-export-btn:active {
    transform: scale(0.98);
}

/* Calendar Container */
.calendar-container {
    transition: all 0.3s ease-in-out;
}

.calendar-container.hidden {
    display: none;
}

/* Modal Styles */
.modal-container {
    position: fixed !important;
    top: 80px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background-color: #3a3a3a;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    margin-bottom: 40px !important;
    max-width: 800px !important;
    width: 90% !important;
}

/* Form field spacing */
.modal-body label {
    display: block;
    margin-top: 15px;
    color: rgb(242, 124, 17);
    font-weight: bold;
}

.modal-body small {
    max-height: calc(100vh - 300px);
    overflow-y: auto;
    padding-right: 15px;
}

.modal-body input[type="text"],
.modal-body textarea {
    width: 100%;
    margin-bottom: 15px;
    height: 400px;
}

.modal-footer {
    position: sticky;
    bottom: 0;
    background: #3a3a3a;
    border-top: 1px solid #4a4a4a;

} 

.conf-item textarea {
    min-height: 600px;
}

/* Entry Modal Styles */
@font-face {
    font-family: 'SkyrimBooks_Handwritten_Bold';
    src: url('/HerikaServer/ui/css/font/SkyrimBooks_Handwritten_Bold-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backdrop-filter: blur(5px);
    display: none;
    z-index: 1000;
    overflow: hidden;
}

body.modal-open {
    overflow: hidden;
}

#entryModal .modal-container {
    background: transparent;
    max-width: 1600px !important;
    width: 98% !important;
    padding: 0 !important;
    height: calc(100vh - 220px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#entryModal .entry-content {
    background: url('/HerikaServer/ui/images/paper.jpg') center/cover;
    padding: 40px;
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
    color: #000;
    font-family: SkyrimBooks_Handwritten_Bold, Arial, sans-serif !important;
    font-size: 1.2em;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.diary-audio-button {
    background: var(--log-accent, #f27c11) !important;
    background-image: none !important;
    border: 1px solid var(--log-accent-hover, #ff963d) !important;
    border-radius: 4px;
    color: #fff !important;
    cursor: pointer;
    font-weight: 600;
    padding: 6px 10px;
}

.diary-audio-button:hover:not(:disabled) {
    background: var(--log-accent-hover, #ff963d) !important;
}

.diary-audio-button:disabled {
    cursor: wait;
    opacity: 0.7;
}

#entryModal .diary-audio-controls {
    align-items: center;
    background: #202024;
    border: 1px solid rgba(242, 124, 17, 0.55);
    border-top: 0;
    border-radius: 0 0 6px 6px;
    display: flex;
    gap: 12px;
    padding: 10px 14px;
}

.diary-audio-status {
    color: #ddd;
    font-size: 0.9rem;
}

#entryModal .entry-content::-webkit-scrollbar {
    width: 8px;
}

#entryModal .entry-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

#entryModal .entry-content::-webkit-scrollbar-thumb {
    background: rgba(242, 124, 17, 0.5);
    border-radius: 4px;
}

#entryModal .modal-backdrop {
    background-color: rgba(0, 0, 0, 0.2);
}

#editModal .modal-backdrop {
    background-color: rgba(0, 0, 0, 0.5);
}
