/* Content Calendar Public Styles */

/* Ensure parent containers don't clip the calendar */
.entry-content,
.post-content,
.page-content,
.site-content,
.content-area,
article.page,
article.post,
.inside-article {
    overflow: visible !important;
}

.cc-public-container {
    width: 100%;
    max-width: 1800px;
    margin-left: auto;
    margin-right: auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    box-sizing: border-box;
}

/* Ensure the calendar is centered within its parent container */
.cc-public-container *,
.cc-public-container *::before,
.cc-public-container *::after {
    box-sizing: border-box;
}

/* Force the WordPress theme content area to be wide enough */
.cc-public-container {
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100vw - 100px);
    max-width: 1800px;
}

/* Password Form */
.cc-password-form {
    max-width: 400px;
    margin: 50px auto;
    padding: 40px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.cc-password-form h2 {
    margin: 0 0 10px 0;
    color: #1d2327;
}

.cc-password-form p {
    color: #666;
    margin-bottom: 20px;
}

.cc-form-group {
    margin-bottom: 15px;
}

.cc-form-group input[type="text"],
.cc-form-group input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e1e1;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.cc-form-group input[type="text"]:focus,
.cc-form-group input[type="password"]:focus {
    outline: none;
    border-color: #2271b1;
}

.cc-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.cc-btn-primary {
    background: #2271b1;
    color: #fff;
    width: 100%;
    padding: 12px 20px;
}

.cc-btn-primary:hover {
    background: #135e96;
}

.cc-error {
    color: #d63638;
    margin-top: 15px;
    font-size: 14px;
}

/* Calendar Layout */
.cc-public-calendar {
    display: flex;
    gap: 20px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.cc-public-sidebar {
    width: 180px;
    flex-shrink: 0;
}

.cc-public-main {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    width: 0; /* Forces flex item to respect flex-basis */
}

/* Filters */
.cc-public-filters {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.cc-public-filters h3 {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: #1d2327;
}

.cc-filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    cursor: pointer;
    font-size: 13px;
    color: #50575e;
}

.cc-filter-item:hover {
    color: #1d2327;
}

.cc-filter-item input {
    margin: 0;
}

.cc-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* Calendar Header */
.cc-calendar-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    background: #fff;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e5e5;
}

.cc-calendar-header h2 {
    margin: 0;
    font-size: 20px;
    min-width: 140px;
    text-align: center;
    color: #1d2327;
    flex-shrink: 1;
}

.cc-nav-btn {
    background: #f0f0f0 !important;
    border: 1px solid #ccc !important;
    padding: 8px 15px !important;
    flex-shrink: 0;
    min-width: 40px;
    color: #000 !important;
    font-weight: bold !important;
    font-size: 18px !important;
    line-height: 1;
}

.cc-nav-btn:hover {
    background: #ddd !important;
    color: #000 !important;
}

#cc-prev-month,
#cc-next-month {
    color: #000 !important;
    font-size: 18px !important;
}

.cc-today-btn {
    background: #2271b1;
    color: #fff;
    margin-left: auto;
    flex-shrink: 0;
}

.cc-today-btn:hover {
    background: #135e96;
}

.cc-history-btn {
    background: #8e44ad;
    color: #fff;
    margin-left: 10px;
    flex-shrink: 0;
}

.cc-history-btn:hover {
    background: #7d3c98;
}

/* Calendar Grid */
.cc-calendar-grid {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    width: 100%;
    table-layout: fixed;
}

.cc-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f6f7f7;
    border-bottom: 1px solid #e1e1e1;
    width: 100%;
}

.cc-weekdays > div {
    padding: 12px;
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    color: #50575e;
    text-transform: uppercase;
    overflow: hidden;
    min-width: 0;
}

.cc-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    width: 100%;
}

.cc-day {
    min-height: 100px;
    border-right: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
    padding: 8px;
    background: #fff;
    transition: background 0.2s;
    overflow: hidden;
    min-width: 0;
}

.cc-day:nth-child(7n) {
    border-right: none;
}

.cc-day.cc-other-month {
    background: #fafafa;
}

.cc-day.cc-other-month .cc-day-number {
    color: #c3c4c7;
}

.cc-day.cc-today {
    background: #f0f7ff;
}

.cc-day-number {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
    color: #1d2327;
}

.cc-today .cc-day-number {
    background: #2271b1;
    color: #fff;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cc-day-events {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    width: 100%;
    overflow: hidden;
}

/* Event Items */
.cc-event-item {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    color: #fff;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: transform 0.2s, opacity 0.2s;
    min-width: 0;
    max-width: 100%;
    display: block;
    box-sizing: border-box;
}

.cc-event-item:hover {
    transform: translateX(2px);
    opacity: 0.9;
}

.cc-event-item.cc-viral-high::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    background: #fff;
    border-radius: 50%;
    margin-right: 4px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.cc-more-events {
    font-size: 11px;
    color: #666;
    padding: 2px 4px;
}

/* Event Detail Modal */
.cc-modal {
    display: none;
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.cc-modal-content {
    background: #fff;
    margin: 10% auto;
    padding: 30px;
    width: 90%;
    max-width: 450px;
    border-radius: 12px;
    position: relative;
}

.cc-modal-close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 24px;
    color: #666;
    cursor: pointer;
}

.cc-modal-close:hover {
    color: #000;
}

.cc-modal h2 {
    margin: 0 0 15px 0;
    color: #1d2327;
}

.cc-detail-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
}

.cc-category-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    color: #fff;
}

#cc-detail-description {
    color: #50575e;
    line-height: 1.6;
}

/* Day Detail Modal */
.cc-day-modal-content {
    max-width: 550px;
}

.cc-day-modal-content h2 {
    font-size: 18px;
    border-bottom: 1px solid #e1e1e1;
    padding-bottom: 15px;
}

#cc-day-modal-events {
    max-height: 400px;
    overflow-y: auto;
}

.cc-day-event-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.cc-day-event-item:hover {
    background: #f6f7f7;
}

.cc-day-event-color {
    width: 4px;
    min-height: 40px;
    border-radius: 2px;
    flex-shrink: 0;
}

.cc-day-event-info {
    flex: 1;
    min-width: 0;
}

.cc-day-event-delete {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 26px;
    background: #f6f7f7;
    color: #d63638;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
}

.cc-day-event-item:hover .cc-day-event-delete {
    opacity: 1;
}

.cc-day-event-delete:hover {
    background: #d63638;
    color: #fff;
    border-color: #d63638;
}

.cc-day-event-title {
    font-weight: 600;
    font-size: 14px;
    color: #1d2327;
    margin-bottom: 4px;
}

.cc-day-event-category {
    font-size: 12px;
    color: #646970;
}

.cc-day-event-desc {
    font-size: 12px;
    color: #50575e;
    margin-top: 4px;
}

.cc-viral-badge {
    background: #d63638;
    color: #fff;
    font-size: 9px;
    padding: 2px 5px;
    border-radius: 3px;
    font-weight: 600;
    margin-left: 6px;
    vertical-align: middle;
}

.cc-no-events {
    text-align: center;
    color: #646970;
    padding: 30px 20px;
}

/* Priority Star */
.cc-star {
    color: #ffd700;
    font-size: 10px;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.3);
}

.cc-event-item.cc-priority {
    box-shadow: inset 0 0 0 1px rgba(255, 215, 0, 0.5);
}

.cc-priority-star-badge {
    color: #ffd700;
    font-size: 14px;
    margin-right: 4px;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.3);
}

/* Edit Modal Styles */
.cc-edit-modal-content {
    max-width: 550px;
    padding: 30px 35px;
}

.cc-edit-modal-content h2 {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e1e1e1;
}

.cc-edit-form-group {
    margin-bottom: 20px;
}

.cc-edit-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
    margin-bottom: 6px;
}

.cc-edit-form-group input[type="date"],
.cc-edit-form-group select,
.cc-edit-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e1e1e1;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.cc-edit-form-group input[type="date"]:focus,
.cc-edit-form-group select:focus,
.cc-edit-form-group textarea:focus {
    outline: none;
    border-color: #2271b1;
}

.cc-edit-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.cc-priority-group {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e1e1e1;
    margin-bottom: 0;
}

.cc-priority-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal !important;
}

.cc-priority-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
}

.cc-priority-star {
    color: #ffd700;
    font-size: 18px;
}

.cc-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e1e1e1;
}

.cc-edit-actions .cc-btn {
    padding: 12px 24px;
    font-size: 14px;
}

.cc-btn-secondary {
    background: #f6f7f7;
    color: #1d2327;
    border: 1px solid #e1e1e1;
}

.cc-btn-secondary:hover {
    background: #e1e1e1;
}

/* History Modal Styles */
.cc-history-modal-content {
    max-width: 650px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.cc-history-modal-content h2 {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e1e1e1;
}

.cc-history-loading {
    text-align: center;
    padding: 40px 20px;
    color: #646970;
    font-style: italic;
}

.cc-history-events {
    max-height: 55vh;
    overflow-y: auto;
    padding-right: 10px;
}

.cc-history-event-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #f9f9f9;
    transition: background 0.2s;
}

.cc-history-event-item:hover {
    background: #f0f0f0;
}

.cc-history-event-year {
    min-width: 50px;
    font-weight: 700;
    font-size: 14px;
    color: #8e44ad;
    padding-top: 2px;
}

.cc-history-event-content {
    flex: 1;
    min-width: 0;
}

.cc-history-event-text {
    font-size: 14px;
    color: #1d2327;
    line-height: 1.5;
}

.cc-usa-flag {
    margin-right: 4px;
}

.cc-milestone-badge {
    display: inline-block;
    margin-top: 6px;
    padding: 3px 8px;
    background: #f39c12;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
}

.cc-history-add-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 20px;
    font-weight: 700;
    line-height: 30px;
    background: #27ae60;
    color: #fff;
    border-radius: 50%;
}

.cc-history-add-btn:hover {
    background: #219a52;
}

/* Add History Event Modal */
.cc-add-history-modal-content {
    max-width: 500px;
}

.cc-add-history-modal-content .cc-edit-form-group input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e1e1e1;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.cc-add-history-modal-content .cc-edit-form-group input[type="text"]:focus {
    outline: none;
    border-color: #2271b1;
}

/* Read-Only Event Modal (for viewers) */
.cc-readonly-modal-content {
    max-width: 500px;
}

.cc-readonly-modal-content h2 {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e1e1e1;
}

.cc-readonly-detail {
    padding: 10px 0;
}

.cc-readonly-row {
    padding: 10px 0;
    font-size: 14px;
    color: #50575e;
    border-bottom: 1px solid #f0f0f0;
}

.cc-readonly-row:last-child {
    border-bottom: none;
}

.cc-readonly-row strong {
    color: #1d2327;
    margin-right: 8px;
}

.cc-priority-indicator {
    color: #f39c12;
    font-weight: 600;
}

/* Viewer mode - subtle visual cue that items are read-only */
.cc-day-event-item.cc-viewer-mode {
    cursor: pointer;
}

.cc-day-event-item.cc-viewer-mode::after {
    content: 'View';
    font-size: 10px;
    color: #999;
    margin-left: auto;
    padding-left: 10px;
    opacity: 0;
    transition: opacity 0.2s;
}

.cc-day-event-item.cc-viewer-mode:hover::after {
    opacity: 1;
}

/* Day Modal Actions */
.cc-day-modal-actions {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e1e1e1;
    text-align: center;
}

.cc-day-modal-actions .cc-btn-history {
    background: #8e44ad;
    color: #fff;
    padding: 10px 20px;
    font-size: 14px;
}

.cc-day-modal-actions .cc-btn-history:hover {
    background: #7d3c98;
}

/* Responsive - Large screens (1400px and below) */
@media (max-width: 1400px) {
    .cc-public-container {
        width: calc(100vw - 40px);
        padding: 15px;
    }

    .cc-public-sidebar {
        width: 160px;
    }

    .cc-day {
        min-height: 90px;
        padding: 6px;
    }

    .cc-event-item {
        font-size: 10px;
        padding: 3px 6px;
    }
}

/* Responsive - Medium screens (1200px and below) */
@media (max-width: 1200px) {
    .cc-public-container {
        width: calc(100vw - 30px);
        padding: 10px;
    }

    .cc-public-sidebar {
        width: 140px;
    }

    .cc-public-calendar {
        gap: 15px;
    }

    .cc-day {
        min-height: 80px;
        padding: 5px;
    }

    .cc-day-number {
        font-size: 13px;
    }

    .cc-event-item {
        font-size: 9px;
        padding: 2px 5px;
    }

    .cc-calendar-header {
        padding: 10px 15px;
        gap: 10px;
    }

    .cc-calendar-header h2 {
        font-size: 18px;
        min-width: 150px;
    }

    .cc-btn {
        padding: 8px 15px;
        font-size: 13px;
    }
}

/* Responsive - Tablets (1024px and below) */
@media (max-width: 1024px) {
    .cc-public-container {
        width: calc(100vw - 20px);
        padding: 10px;
    }

    .cc-public-calendar {
        flex-direction: column;
    }

    .cc-public-sidebar {
        width: 100%;
    }

    .cc-public-filters {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        padding: 15px;
    }

    .cc-public-filters h3 {
        width: 100%;
        margin-bottom: 5px;
    }

    .cc-filter-item {
        padding: 4px 10px;
        background: #f6f7f7;
        border-radius: 20px;
    }

    .cc-calendar-grid {
        width: 100%;
    }

    .cc-day {
        min-height: 80px;
        padding: 4px;
    }

    .cc-day-number {
        font-size: 12px;
    }

    .cc-event-item {
        font-size: 9px;
        padding: 2px 4px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .cc-weekdays > div {
        padding: 8px 4px;
        font-size: 10px;
    }

    .cc-calendar-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .cc-calendar-header h2 {
        font-size: 18px;
        min-width: auto;
        flex: 0 0 auto;
    }
}

/* Responsive - Small tablets and large phones (768px and below) */
@media (max-width: 768px) {
    .cc-public-container {
        width: calc(100vw - 16px);
        padding: 8px;
    }

    .cc-calendar-header {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px;
    }

    .cc-calendar-header h2 {
        font-size: 16px;
        min-width: auto;
    }

    .cc-nav-btn {
        padding: 6px 12px !important;
        font-size: 16px !important;
    }

    .cc-today-btn,
    .cc-history-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .cc-today-btn {
        margin-left: auto;
    }

    .cc-day {
        min-height: 65px;
        padding: 3px;
    }

    .cc-day-number {
        font-size: 11px;
        margin-bottom: 3px;
    }

    .cc-today .cc-day-number {
        width: 22px;
        height: 22px;
        font-size: 11px;
    }

    .cc-event-item {
        font-size: 8px;
        padding: 2px 3px;
        border-radius: 2px;
    }

    .cc-weekdays > div {
        padding: 6px 2px;
        font-size: 9px;
    }

    .cc-more-events {
        font-size: 9px;
    }

    .cc-day-events {
        gap: 2px;
    }
}

/* Responsive - Mobile phones (480px and below) */
@media (max-width: 480px) {
    .cc-public-container {
        width: 100vw;
        padding: 5px;
        left: 50%;
        transform: translateX(-50%);
    }

    .cc-public-filters {
        padding: 10px;
        gap: 6px;
    }

    .cc-filter-item {
        padding: 3px 8px;
        font-size: 11px;
    }

    .cc-calendar-header {
        padding: 8px;
        gap: 6px;
    }

    .cc-calendar-header h2 {
        font-size: 14px;
    }

    .cc-nav-btn {
        padding: 5px 10px !important;
        font-size: 14px !important;
        min-width: 32px;
    }

    .cc-today-btn,
    .cc-history-btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    .cc-day {
        min-height: 55px;
        padding: 2px;
    }

    .cc-day-number {
        font-size: 10px;
        margin-bottom: 2px;
    }

    .cc-today .cc-day-number {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }

    .cc-event-item {
        font-size: 7px;
        padding: 1px 2px;
        border-radius: 2px;
    }

    .cc-weekdays > div {
        padding: 5px 1px;
        font-size: 8px;
    }

    .cc-more-events {
        font-size: 8px;
    }

    .cc-day-events {
        gap: 1px;
    }
}
