/* ---------------------------------------------------------
   Century Calendar - Complete Stylesheet
   Event date = #B9745E
   Non-event = #EAE1D8
   Event hover = #333C48
   Unified today class: .calendar-day-present-day
--------------------------------------------------------- */

/* Root wrapper & header */
.century-calendar-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    box-sizing: border-box;
}

.calendar-header {
    text-align: center;
    margin-bottom: 30px;
}

.calendar-header h2 {
    font-size: 32px;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: #2c3e50;
}

.calendar-subtitle {
    font-size: 12px;
    letter-spacing: 2px;
    color: #7f8c8d;
    text-transform: uppercase;
    margin: 0;
}

/* Container & layout */
.calendar-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    background: #f8f9fa;
    border: 2px dashed #a8c5d9;
    border-radius: 8px;
    padding: 30px;
}

/* Calendar panel */
.calendar-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

/* Navigation */
.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
}

.calendar-nav h3 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    color: #2c3e50;
    flex: 1;
    text-align: center;
}

.nav-btn {
    background: #34495e;
    color: #fff;
    border: none;
    width: 36px;
    height: 36px;
    min-width: 36px;
    max-width: 36px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: background 0.25s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    outline: none;
}

.nav-btn:hover,
.nav-btn:focus,
.nav-btn:active {
    background: #34495e;
    outline: none;
    box-shadow: none;
}

/* Grid & headers */
.calendar-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.weekday-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    margin-bottom: 10px;
}

.weekday-header div {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #7f8c8d;
    padding: 10px 0;
}

/* Days grid */
.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    min-height: 300px;
}

/* ---------------------------
   Base day cell styling
   Non-event background = #EAE1D8
   --------------------------- */
.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.18s ease, filter 0.18s ease;
    position: relative;
    min-height: 40px;
    background: #EAE1D8;  /* ✅ CORRECT: Default non-event color */
    color: #2c3e50;       /* ✅ CORRECT: Dark text */
    font-weight: 500;
    box-sizing: border-box;
}

.calendar-day:not(.other-month):hover {
    filter: brightness(0.97);
    transform: scale(1.05);
}

/* Other-month days (muted) */
.calendar-day.other-month {
    color: #bdc3c7;
    cursor: default;
    background: transparent;
    transform: none;
    filter: none;
    box-shadow: none;
}

/* ---------------------------
   Today (unified)
   JS should add calendar-day-present-day
   --------------------------- */
.calendar-day-present-day {
    background: #2c3e50 !important;
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.3);
}
/* ---------------------------
   Event-day styling
   base: #B9745E
   hover: #333C48
   --------------------------- */
.calendar-day.has-events {
    background: #B9745E !important; /* event color */
    color: #ffffff !important;
    font-weight: 600;
    border: none !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

/* Hover for event days (explicit dark color) */
.calendar-day.has-events:hover {
    background: #333C48 !important; /* event hover */
    color: #ffffff !important;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}

/* When today is also an event */
.calendar-day-present-day.has-events {
    background: #B9745E !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(51,60,72,0.12);
}

/* ---------------------------
   Selected states
   Selected (non-event) keeps its distinct look
   Selected + has-events keeps event color
   --------------------------- */
.calendar-day.selected {
    background: #2c3e50;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(44,62,80,0.3);
}

/* Ensure selected event day remains event color and shows subtle selection emphasis */
.calendar-day.selected.has-events,
.calendar-day.has-events.selected {
    background: #B9745E !important;
    color: #ffffff !important;
    box-shadow: 0 3px 10px rgba(20,29,38,0.22) !important;
    border: 2px solid rgba(255,255,255,0.10) !important;
}

/* ---------------------------
   Event count badge (top-right)
   white badge, B9745E text for contrast
   --------------------------- */
.calendar-day.has-events::after {
    content: attr(data-event-count);
    position: absolute;
    top: 4px;
    right: 4px;
    background: #ffffff;
    color: #B9745E;
    font-size: 9px;
    font-weight: 700;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    line-height: 1;
    text-align: center;
    box-sizing: border-box;
}

/* Badge remains readable on hover/selected */
.calendar-day.has-events:hover::after,
.calendar-day.selected.has-events::after,
.calendar-day-present-day.has-events::after {
    background: #ffffff;
    color: #B9745E;
}

/* ---------------------------
   Tooltip
   --------------------------- */
.event-tooltip {
    position: fixed;
    background: #ffffff;
    border: 2px solid #B9745E;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10000;
    max-width: 300px;
    display: none;
}

.tooltip-event {
    padding: 6px 0;
    color: #2c3e50;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 1px solid #ecf0f1;
}

.tooltip-event:last-of-type {
    border-bottom: none;
}

.tooltip-more {
    padding: 6px 0;
    color: #7f8c8d;
    font-size: 12px;
    font-style: italic;
    text-align: center;
}

/* ---------------------------
   Events list panel
   --------------------------- */
.events-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
}

.events-list {
    flex: 1;
    overflow-y: auto;
    max-height: 500px;
}

.events-list h4 {
    font-size: 18px;
    color: #2c3e50;
    margin: 0 0 20px 0;
    font-weight: 600;
}

.no-events {
    color: #95a5a6;
    font-style: italic;
    text-align: center;
    padding: 40px 20px;
}

.event-item {
    border-left: 4px solid #3498db;
    padding: 15px;
    margin-bottom: 15px;
    background: #f8f9fa;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.event-item:hover {
    background: #ecf0f1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.event-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 8px;
}

.event-header h5 {
    margin: 0;
    font-size: 16px;
    color: #2c3e50;
    flex: 1;
}

.event-actions {
    display: flex;
    gap: 8px;
}

.event-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    transition: transform 0.2s ease;
}

.event-actions button:hover {
    transform: scale(1.12);
}

.event-description {
    margin: 0;
    color: #555;
    font-size: 14px;
    line-height: 1.5;
}

.add-event-btn {
    background: #c17854;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    margin-top: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.25s ease;
}

.add-event-btn:hover {
    background: #a66647;
}

/* ---------------------------
   Modal
   --------------------------- */
.event-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-sizing: border-box;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #7f8c8d;
    line-height: 1;
}

.modal-close:hover {
    color: #2c3e50;
}

.modal-content h3 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 24px;
}

/* Form groups */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.btn-cancel,
.btn-save {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-cancel {
    background: #ecf0f1;
    color: #2c3e50;
}

.btn-cancel:hover {
    background: #bdc3c7;
}

.btn-save {
    background: #3498db;
    color: white;
}

.btn-save:hover {
    background: #2980b9;
}

/* ---------------------------
   Responsive Rules - keep your original behaviour, tuned for Elementor
   (includes tablet, mobile landscape, mobile portrait, and extra-small)
   --------------------------- */

/* Tablet (up to 1024px) */
@media (max-width: 1024px) {
    .century-calendar-wrapper {
        padding: 15px;
    }

    .calendar-container {
        gap: 20px;
        padding: 20px;
    }

    .calendar-section,
    .events-section {
        padding: 15px;
    }

    .calendar-day {
        font-size: 13px;
        min-height: 38px;
    }

    .weekday-header div {
        font-size: 13px;
        padding: 8px 0;
    }
}

/* Mobile landscape & small tablets (up to 768px) */
@media (max-width: 768px) {
    .century-calendar-wrapper {
        padding: 5px;
    }

    .calendar-header {
        margin-bottom: 15px;
    }

    .calendar-header h2 {
        font-size: 20px;
    }

    .calendar-subtitle {
        font-size: 10px;
        letter-spacing: 1.5px;
    }

    /* stack vertically */
    .calendar-container {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 10px;
    }

    .calendar-section {
        order: 1;
        padding: 10px;
    }

    .events-section {
        order: 2;
        max-height: 400px;
        padding: 10px;
    }

    .calendar-nav {
        margin-bottom: 10px;
    }

    .calendar-nav h3 {
        font-size: 16px;
    }

    .nav-btn {
        width: 28px;
        height: 28px;
        min-width: 28px;
        max-width: 28px;
        font-size: 16px;
    }

    .calendar-grid {
        gap: 5px;
    }

    .weekday-header {
        gap: 3px;
        margin-bottom: 5px;
    }

    .weekday-header div {
        font-size: 11px;
        padding: 5px 0;
    }

    .calendar-days {
        gap: 3px;
        min-height: 200px;
    }

    .calendar-day {
        font-size: 12px;
        min-height: 28px;
        border-radius: 50%;
    }

    .calendar-day.has-events::after {
        width: 12px;
        height: 12px;
        font-size: 7px;
        top: 1px;
        right: 1px;
    }

    .events-list {
        max-height: 250px;
    }

    .events-list h4 {
        font-size: 14px;
        margin-bottom: 10px;
    }

    .event-item {
        padding: 10px;
        margin-bottom: 10px;
    }

    .event-header h5 {
        font-size: 13px;
    }

    .event-description {
        font-size: 12px;
    }

    .event-actions button {
        font-size: 13px;
    }

    .add-event-btn {
        padding: 8px 16px;
        font-size: 12px;
        margin-top: 10px;
    }

    .modal-content {
        width: auto;
        padding: 15px;
    }

    .modal-close {
        font-size: 22px;
        top: 8px;
        right: 12px;
    }

    .modal-content h3 {
        font-size: 16px;
        margin-bottom: 12px;
    }

    .form-group {
        margin-bottom: 12px;
    }

    .form-group label {
        font-size: 12px;
    }

    .form-group input,
    .form-group textarea {
        font-size: 12px;
        padding: 8px;
    }

    .event-tooltip {
        max-width: 180px;
        font-size: 11px;
        padding: 8px 10px;
    }

    .tooltip-event {
        font-size: 11px;
        padding: 3px 0;
    }
}

/* Mobile portrait (up to 480px) */
@media (max-width: 480px) {
    .century-calendar-wrapper {
        padding: 2px;
    }

    .calendar-header {
        margin-bottom: 10px;
    }

    .calendar-header h2 {
        font-size: 18px;
    }

    .calendar-subtitle {
        font-size: 8px;
        letter-spacing: 1px;
    }

    .calendar-container {
        gap: 10px;
        padding: 8px;
        border: 1px dashed #a8c5d9;
    }

    .calendar-section,
    .events-section {
        padding: 8px;
    }

    .calendar-nav {
        margin-bottom: 8px;
    }

    .calendar-nav h3 {
        font-size: 14px;
    }

    .nav-btn {
        width: 26px;
        height: 26px;
        min-width: 26px;
        max-width: 26px;
        font-size: 14px;
    }

    .calendar-grid {
        gap: 5px;
    }

    .weekday-header {
        gap: 2px;
        margin-bottom: 5px;
    }

    .weekday-header div {
        font-size: 9px;
        padding: 4px 0;
    }

    .calendar-days {
        gap: 2px;
        min-height: 180px;
    }

    .calendar-day {
        font-size: 10px;
        min-height: 25px;
        border-radius: 50%;
    }

    .calendar-day.has-events {
        border-width: 1.5px;
    }

    .calendar-day.has-events::after {
        width: 10px;
        height: 10px;
        font-size: 6px;
        top: 1px;
        right: 1px;
    }

    .events-section {
        max-height: 300px;
    }

    .events-list {
        max-height: 230px;
    }

    .events-list h4 {
        font-size: 13px;
        margin-bottom: 8px;
    }

    .no-events {
        padding: 20px 10px;
        font-size: 12px;
    }

    .event-item {
        padding: 8px;
        margin-bottom: 8px;
        border-left-width: 3px;
    }

    .event-header {
        flex-direction: column;
        gap: 6px;
    }

    .event-header h5 {
        font-size: 12px;
    }

    .event-actions {
        align-self: flex-end;
    }

    .event-description {
        font-size: 11px;
        line-height: 1.4;
    }

    .add-event-btn {
        padding: 6px 12px;
        font-size: 11px;
        margin-top: 10px;
    }

    .event-modal {
        padding: 5px;
    }

    .modal-content {
        width: 100%;
        max-width: 100%;
        padding: 12px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-close {
        font-size: 20px;
        top: 6px;
        right: 10px;
    }

    .modal-content h3 {
        font-size: 16px;
        margin-bottom: 10px;
        padding-right: 25px;
    }

    .form-group {
        margin-bottom: 10px;
    }

    .form-group label {
        font-size: 11px;
        margin-bottom: 5px;
    }

    .form-group input,
    .form-group textarea {
        font-size: 11px;
        padding: 6px;
    }

    .form-group textarea {
        min-height: 70px;
    }

    .form-actions {
        margin-top: 10px;
        gap: 6px;
    }

    .btn-cancel,
    .btn-save {
        padding: 6px 12px;
        font-size: 11px;
        flex: 1;
    }

    .event-tooltip {
        max-width: 150px;
        font-size: 10px;
        padding: 6px 8px;
    }

    .tooltip-event {
        font-size: 10px;
        padding: 2px 0;
    }

    .tooltip-more {
        font-size: 9px;
    }
}

/* Extra-small devices (< 320px) */
@media (max-width: 320px) {
    .century-calendar-wrapper {
        padding: 2px;
    }

    .calendar-header h2 {
        font-size: 16px;
    }

    .calendar-nav h3 {
        font-size: 12px;
    }

    .nav-btn {
        width: 24px;
        height: 24px;
        min-width: 24px;
        max-width: 24px;
        font-size: 12px;
    }

    .weekday-header div {
        font-size: 8px;
    }

    .calendar-day {
        font-size: 9px;
        min-height: 22px;
    }

    .events-list h4 {
        font-size: 12px;
    }

    .event-header h5 {
        font-size: 11px;
    }
}

/* Touch-only devices: disable hover scale to avoid jumpiness */
@media (hover: none) {
    .calendar-day:not(.other-month):hover,
    .calendar-day.has-events:hover {
        transform: none;
        filter: none;
    }
}

.month-date-group {
    margin-bottom: 18px;
}

.month-date-label {
    display: block;
    font-size: 13px;
    color: #B9745E;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid #f0e8e4;
    letter-spacing: 0.3px;
}

/* End of file */
