/* Florida Racing Event Calendar - Public Styles */

/* Universal viewport constraint */
.frec-calendar,
.frec-calendar * {
    max-width: 100vw;
    box-sizing: border-box;
}

/* Body class for events page */
body.frec-events-page .entry-content {
    max-width: none;
}

body.frec-events-page .entry-title {
    margin-bottom: 2rem;
}

/* Base Calendar Styles */
.frec-calendar {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-sizing: border-box;
    position: relative;
}

/* Ensure calendar container doesn't overflow */
.frec-calendar * {
    box-sizing: border-box;
}

/* Prevent any element from causing horizontal overflow */
.frec-calendar,
.frec-calendar-header,
.frec-calendar-grid,
.frec-weekdays,
.frec-days,
.frec-days .frec-day,
.frec-day-events,
.frec-event-item-month {
    max-width: 100%;
    overflow-wrap: break-word;
}

.frec-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #f57514 0%, #d65a0f 100%);
    color: white;
    flex-wrap: wrap;
    gap: 15px;
}

.frec-calendar-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

/* Filters */
.frec-calendar-filters {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.frec-filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.frec-filter-group label {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.9);
}

.frec-filter {
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.9rem;
}

.frec-filter::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.frec-filter:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.2);
}

/* Filter Buttons */
.frec-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.frec-apply-filters {
    background: rgba(255, 255, 255, 0.9);
    color: #000000;
}

.frec-apply-filters:hover {
    background: #fff;
    transform: translateY(-1px);
}

.frec-clear-filters {
    background: transparent;
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.frec-clear-filters:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.8);
    color: white;
}

/* Loading and Error States */
.frec-loading,
.frec-error {
    text-align: center;
    padding: 3rem;
    color: #666;
    font-style: italic;
}

.frec-loading-state {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.frec-loading-state::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f57514;
    border-top: 4px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.frec-loading {
    background: url('data:image/svg+xml;charset=utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 50 50"%3E%3Cpath fill="%23666" d="M25 5A20 20 0 1 0 25 45A20 20 0 1 0 25 5M25 10A15 15 0 1 1 25 40A15 15 0 1 1 25 10"%3E%3C/path%3E%3Cpath fill="%23f57514" d="M25 5A20 20 0 0 1 45 25H40A15 15 0 0 0 25 10Z"%3E%3CanimateTransform attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="1s" repeatCount="indefinite"/%3E%3C/path%3E%3C/svg%3E') no-repeat center top;
    padding-top: 5rem;
}

.frec-error {
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin: 1rem;
}

/* Venue Links - Remove underline */
.frec-venue a,
.frec-meta-item a[href*="google.com/maps"] {
    text-decoration: none !important;
    color: #f57514;
    font-weight: 500;
}

.frec-venue a:hover,
.frec-meta-item a[href*="google.com/maps"]:hover {
    text-decoration: underline !important;
    color: #d45a00;
}

/* List View */
.frec-list-view .frec-events-container {
    padding: 20px 0;
}

.frec-events-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.frec-event-item {
    display: flex;
    gap: 20px;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    transition: all 0.3s ease;
    background: transparent;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.frec-event-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(135deg, #f57514 0%, #d65a0f 100%);
}

.frec-event-item:hover {
    border-color: #f57514;
    box-shadow: 0 8px 25px rgba(245, 117, 20, 0.15);
    transform: translateY(-3px);
}

.frec-event-date {
    flex-shrink: 0;
    text-align: center;
    padding: 20px 15px;
    background: linear-gradient(135deg, #f57514 0%, #d65a0f 100%);
    color: white;
    border-radius: 12px;
    min-width: 110px;
    box-shadow: 0 4px 12px rgba(245, 117, 20, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.frec-month {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
    margin-bottom: 2px;
}

.frec-day {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin: 6px 0;
}

.frec-year {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
}

.frec-time {
    display: block;
    font-size: 0.75rem;
    margin-top: 8px;
    opacity: 0.9;
    font-weight: 600;
}

/* Add to Calendar button in date section */
.frec-add-calendar-date {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    width: 100%;
    text-align: center;
}

.frec-add-calendar-date:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-1px);
}

.frec-event-details {
    flex: 1;
    padding-left: 10px;
}

.frec-event-title {
    margin: 0 0 12px 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: #000000;
    line-height: 1.3;
}

.frec-event-title a,
.frec-event-details-full h2 a {
    color: inherit;
    text-decoration: none !important;
    transition: color 0.3s ease;
    position: relative;
}

.frec-event-title a:hover,
.frec-event-details-full h2 a:hover {
    color: #f57514;
}

.frec-event-title a[target="_blank"]::after,
.frec-event-details-full h2 a[target="_blank"]::after {
    content: "🔗";
    font-size: 0.7em;
    margin-left: 6px;
    opacity: 0.6;
    transition: opacity 0.3s ease;
    text-decoration: none !important;
    text-decoration-line: none !important;
    text-decoration-style: none !important;
    display: inline-block;
}

.frec-event-title a[target="_blank"]:hover::after,
.frec-event-details-full h2 a[target="_blank"]:hover::after {
    opacity: 1;
}

.frec-event-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 15px;
    font-size: 0.95rem;
    color: #666;
}

.frec-event-meta span {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-weight: 400;
    line-height: 1.4;
}

.frec-event-meta span strong {
    color: #333;
    font-weight: 600;
    min-width: 90px;
    flex-shrink: 0;
}

.frec-event-meta span small {
    color: #888;
    font-weight: 400;
}

.frec-categories strong::before {
    content: "🏁 ";
}

.frec-icon {
    width: 16px;
    height: 16px;
    opacity: 0.8;
}

.frec-category {
    background: linear-gradient(135deg, #f57514 0%, #d65a0f 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(245, 117, 20, 0.3);
}

/* Unified category badge color */
.frec-category-drag,
.frec-category-road,
.frec-category-oval,
.frec-category-karting,
.frec-category-autocross { 
    background: linear-gradient(135deg, #f57514 0%, #d65a0f 100%);
    color: white; 
}

.frec-event-description {
    color: #555;
    line-height: 1.6;
    margin-bottom: 20px;
    font-size: 0.95rem;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #f57514;
}

.frec-event-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.frec-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.5px;
}

.frec-btn-primary {
    background: linear-gradient(135deg, #f57514 0%, #d65a0f 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(245, 117, 20, 0.3);
}

.frec-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 117, 20, 0.4);
    background: linear-gradient(135deg, #d65a0f 0%, #f57514 100%);
    color: white;
    text-decoration: none;
}

.frec-btn-secondary {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.frec-btn-secondary:hover {
    background: linear-gradient(135deg, #20c997 0%, #28a745 100%);
    color: white;
    border: none;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

/* Month View */
.frec-month-view .frec-calendar-header {
    justify-content: center;
    position: relative;
}

.frec-month-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    position: relative;
}

.frec-month-title {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 600;
    color: #000000;
    text-align: center;
}

.frec-nav-btn {
    position: absolute;
    background: #f57514;
    border: 2px solid #d65a0f;
    color: white;
    width: auto;
    min-width: 80px;
    height: 36px;
    padding: 0 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(245, 117, 20, 0.3);
}

.frec-nav-btn .arrow {
    font-size: 1rem;
    font-weight: bold;
}

.frec-prev { 
    left: 20px; 
}

.frec-next { 
    right: 20px; 
}

.frec-nav-btn:hover {
    background: #d65a0f;
    border-color: #b8500d;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 117, 20, 0.4);
}

.frec-nav-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(245, 117, 20, 0.3);
}

.frec-nav-btn:disabled {
    background: #ccc;
    border-color: #bbb;
    color: #888;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.frec-nav-btn:disabled:hover {
    background: #ccc;
    border-color: #bbb;
    transform: none;
    box-shadow: none;
}

.frec-calendar-grid {
    padding: 20px 0;
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.frec-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    margin-bottom: 10px;
    width: 100%;
    box-sizing: border-box;
}

.frec-weekday {
    padding: 15px;
    text-align: center;
    font-weight: 600;
    color: #666;
    background: #f8f9fa;
    border-radius: 4px;
}

.frec-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.frec-days .frec-day {
    background: white;
    padding: 12px 8px;
    min-height: 100px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    flex-direction: column;
    font-size: 1rem;
    font-weight: normal;
    overflow: hidden;
    box-sizing: border-box;
    min-width: 0; /* Prevent flex items from overflowing */
}

.frec-days .frec-day:hover {
    background: #f8f9fa;
}

.frec-day.frec-other-month {
    background: #f8f9fa;
    color: #999;
}

.frec-day.frec-other-month:hover {
    background: #f0f0f0;
}

.frec-day-number {
    font-weight: 600;
    color: #000000;
    margin-bottom: 8px;
    font-size: 1rem;
    text-align: center;
    min-width: 0;
    overflow: hidden;
    flex-shrink: 0;
}

.frec-day-events {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    overflow: hidden;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.frec-event-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f57514;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.frec-event-dot:hover {
    transform: scale(1.2);
}

/* Event text items for month view - unified color */
.frec-event-item-month {
    display: block;
    width: 100%;
    max-width: 100%;
    margin-bottom: 2px;
    padding: 2px 4px;
    background: #f57514;
    color: white;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.7rem;
    line-height: 1.1;
    text-align: left;
    box-sizing: border-box;
    min-width: 0;
    overflow: hidden;
}

.frec-event-item-month:hover {
    background: #d65a0f;
    transform: scale(1.02);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.frec-event-text {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

/* Unified color for all event items - no category-specific colors */
.frec-event-item-month.frec-category-drag,
.frec-event-item-month.frec-category-road,
.frec-event-item-month.frec-category-oval,
.frec-event-item-month.frec-category-karting,
.frec-event-item-month.frec-category-autocross,
.frec-event-item-month.frec-category-drift,
.frec-event-item-month.frec-category-other { 
    background: #f57514; 
}

/* Unified hover states for all categories */
.frec-event-item-month.frec-category-drag:hover,
.frec-event-item-month.frec-category-road:hover,
.frec-event-item-month.frec-category-oval:hover,
.frec-event-item-month.frec-category-karting:hover,
.frec-event-item-month.frec-category-autocross:hover,
.frec-event-item-month.frec-category-drift:hover,
.frec-event-item-month.frec-category-other:hover { 
    background: #d65a0f; 
}

/* Event Tooltip */
.frec-event-tooltip {
    position: absolute;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 8px 12px;
    font-size: 0.85rem;
    z-index: 1000;
    display: none;
    max-width: 200px;
    pointer-events: none;
}

.frec-tooltip-content strong {
    display: block;
    color: #000000;
    margin-bottom: 4px;
    font-weight: 600;
}

.frec-tooltip-hint {
    color: #666;
    font-size: 0.75rem;
    font-style: italic;
}

/* Event Popup Styles */
.frec-event-details-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.frec-popup-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.frec-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.frec-popup-close:hover {
    background: #5a6268;
}

.frec-popup-body {
    padding: 30px 25px 25px;
}

.frec-event-details-full h2 {
    margin: 0 0 20px 0;
    color: #000000;
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.3;
}

.frec-event-meta-full {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #f57514;
    margin-bottom: 20px;
}

.frec-meta-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.95rem;
    line-height: 1.4;
}

.frec-meta-item strong {
    color: #333;
    font-weight: 600;
    min-width: 100px;
    flex-shrink: 0;
}

.frec-event-actions-full {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    border-top: 1px solid #e0e0e0;
    padding-top: 20px;
}

/* Grid View */
.frec-grid-view .frec-events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.frec-grid-view .frec-event-item {
    flex-direction: column;
    height: auto; /* Allow dynamic height based on content */
    display: flex; /* Ensure flexbox layout */
}

.frec-grid-view .frec-event-date {
    width: 100%;
    align-self: stretch;
    min-width: auto;
    padding: 10px 15px;
    margin-bottom: 15px;
    flex-shrink: 0; /* Prevent date section from shrinking */
    text-align: center;
    border-radius: 8px 8px 0 0; /* Round only top corners for better fit */
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 4px !important;
}

/* Grid view specific - make date and time inline using flex */
.frec-grid-view .frec-event-date .frec-month,
.frec-grid-view .frec-event-date .frec-day,
.frec-grid-view .frec-event-date .frec-year,
.frec-grid-view .frec-event-date .frec-time {
    display: block !important;
    margin: 0 !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
}

/* Target any spans within grid view date sections */
.frec-grid-view .frec-event-date span {
    display: block !important;
    margin: 0 !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
}

.frec-grid-view .frec-event-date .frec-day {
    font-size: 1.2rem !important;
    font-weight: 700 !important;
}

.frec-grid-view .frec-event-date .frec-month {
    font-size: 1.2rem !important;
}

.frec-grid-view .frec-event-date .frec-year {
    font-size: 1.2rem !important;
}

.frec-grid-view .frec-event-date .frec-time {
    font-size: 1.2rem !important;
    margin-left: 8px !important;
}

.frec-grid-view .frec-event-details {
    flex: 1; /* Allow details to grow and fill remaining space */
    display: flex;
    flex-direction: column;
    padding-left: 0; /* Remove left padding for grid view */
}

.frec-grid-view .frec-event-actions {
    margin-top: auto; /* Push actions to bottom */
    padding-top: 15px; /* Add some space above actions */
}

/* Grid view specific calendar dropdown positioning */
.frec-grid-view .frec-calendar-dropdown {
    position: relative;
}

.frec-grid-view .frec-calendar-options {
    position: absolute !important;
    top: 100% !important;
    bottom: auto !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    margin-top: 5px !important;
    margin-bottom: 0 !important;
    z-index: 1002 !important;
}

/* Override other positioning classes in grid view */
.frec-grid-view .frec-calendar-options.frec-dropdown-above,
.frec-grid-view .frec-calendar-options.frec-dropdown-below,
.frec-grid-view .frec-calendar-options.frec-dropdown-right-side,
.frec-grid-view .frec-calendar-options.frec-dropdown-right,
.frec-grid-view .frec-calendar-options.frec-dropdown-left {
    position: absolute !important;
    top: 100% !important;
    bottom: auto !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    margin-top: 5px !important;
    margin-bottom: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* No Events Message */
.frec-no-events {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.frec-no-events p {
    margin: 0;
    font-size: 1.1rem;
}

/* Add to Calendar Styles */
.frec-add-to-calendar {
    margin-top: 10px;
}

.frec-add-calendar-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(40, 167, 69, 0.3);
}

.frec-add-calendar-btn.frec-add-calendar-inline {
    padding: 3px 6px;
    font-size: 0.65rem;
    margin-left: 8px;
    border-radius: 3px;
    box-shadow: 0 1px 4px rgba(40, 167, 69, 0.3);
    vertical-align: middle;
}

.frec-add-calendar-btn:hover {
    background: linear-gradient(135deg, #20c997 0%, #28a745 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.frec-add-calendar-btn.frec-add-calendar-inline:hover {
    transform: translateY(-0.5px);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.4);
}

.frec-calendar-dropdown {
    position: relative;
    z-index: 1001;
}

.frec-calendar-options {
    position: absolute;
    left: 0;
    right: auto;
    background: #ffffff !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 6px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
    padding: 12px;
    min-width: 200px;
    z-index: 1002;
    animation: dropdownSlideIn 0.2s ease-out;
    
    /* Prevent cutoff on mobile */
    max-width: calc(100vw - 20px);
}

/* Desktop positioning adjustments */
.frec-calendar-options.frec-dropdown-above {
    top: auto;
    bottom: 100%;
    margin-bottom: 5px;
    background: #ffffff !important;
    border: 1px solid #e0e0e0 !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
}

.frec-calendar-options.frec-dropdown-below {
    top: 100%;
    bottom: auto;
    margin-top: 5px;
    margin-bottom: 0;
    background: #ffffff !important;
    border: 1px solid #e0e0e0 !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
}

.frec-calendar-options.frec-dropdown-right-side {
    position: absolute;
    top: -20px;
    bottom: auto;
    left: 100%;
    right: auto;
    margin-left: 15px;
    margin-bottom: 0;
    z-index: 1002;
    background: #ffffff !important;
    border: 1px solid #e0e0e0 !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
    /* Position to the right side of the button */
}

.frec-calendar-options.frec-dropdown-right {
    left: auto;
    right: 0;
    background: #ffffff !important;
    border: 1px solid #e0e0e0 !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
}

.frec-calendar-options.frec-dropdown-left {
    left: 0;
    right: auto;
    background: #ffffff !important;
    border: 1px solid #e0e0e0 !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
}

/* Mobile-specific positioning - centered and upward */
.frec-calendar-options.frec-dropdown-mobile-center {
    position: absolute;
    left: 50%;
    right: auto;
    bottom: 100%;
    top: auto;
    transform: translateX(-50%);
    margin-bottom: 10px;
    z-index: 1003;
    max-width: calc(100vw - 20px);
    width: 220px;
    padding: 12px;
    border-radius: 6px;
    background: #ffffff !important;
    border: 1px solid #e0e0e0 !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
}

.frec-calendar-options.frec-dropdown-mobile-above {
    position: absolute;
    bottom: 100%;
    top: auto;
    margin-bottom: 10px;
    z-index: 1003;
    max-width: calc(100vw - 20px);
    width: 220px;
    padding: 12px;
    border-radius: 6px;
    background: #ffffff !important;
    border: 1px solid #e0e0e0 !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
}

.frec-calendar-options.frec-dropdown-mobile-below {
    position: absolute;
    top: 100%;
    bottom: auto;
    margin-top: 10px;
    z-index: 1003;
    max-width: calc(100vw - 20px);
    width: 220px;
    padding: 12px;
    border-radius: 6px;
    background: #ffffff !important;
    border: 1px solid #e0e0e0 !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
}

/* Mobile horizontal positioning */
.frec-calendar-options.frec-dropdown-mobile-center {
    left: 50%;
    transform: translateX(-50%);
}

/* Ensure mobile centered dropdowns work with above/below positioning */
.frec-calendar-options.frec-dropdown-mobile-center.frec-dropdown-mobile-above,
.frec-calendar-options.frec-dropdown-mobile-center.frec-dropdown-mobile-below {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
}

/* Ensure mobile centered dropdowns work with above/below positioning */
.frec-calendar-options.frec-dropdown-mobile-center.frec-dropdown-mobile-above,
.frec-calendar-options.frec-dropdown-mobile-center.frec-dropdown-mobile-below {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
}

/* Mobile backdrop for better visibility - removed to match desktop styling */

/* Legacy mobile centering (fallback) */
.frec-calendar-options.frec-dropdown-center {
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    top: 50% !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    max-width: calc(100vw - 40px);
    min-width: 240px;
    width: 280px;
    padding: 16px;
    border-radius: 8px;
    background: #ffffff !important;
    border: 1px solid #e0e0e0 !important;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.25) !important;
    z-index: 1003 !important;
}

/* Mobile backdrop for dropdown */
/* Removed backdrop effects to match clean desktop styling */

/* Mobile backdrop overlay for center dropdown */
.frec-calendar-options.frec-dropdown-center::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5) !important;
    z-index: -1;
}

@keyframes dropdownSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.frec-calendar-options h4 {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #000000;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 8px;
}

.frec-calendar-option {
    display: block;
    padding: 8px 10px;
    margin-bottom: 4px;
    text-decoration: none;
    color: #000000;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    font-weight: 500;
}

.frec-calendar-option:hover {
    background: #f8f9fa;
    color: #f57514;
    text-decoration: none;
    transform: translateX(3px);
}

.frec-calendar-close {
    background: #6c757d;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 3px;
    font-size: 0.75rem;
    cursor: pointer;
    margin-top: 8px;
    width: 100%;
    transition: background 0.2s ease;
}

.frec-calendar-close:hover {
    background: #5a6268;
}

/* Desktop Design - Force upward positioning and remove fixed heights */
@media (min-width: 769px) {
    .frec-calendar-options {
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        position: absolute !important;
        top: auto !important;
        bottom: 100% !important;
        margin-bottom: 5px !important;
        margin-top: 0 !important;
    }
    
    /* Force all dropdown classes to position upward on desktop */
    .frec-calendar-options.frec-dropdown-below,
    .frec-calendar-options.frec-dropdown-above,
    .frec-calendar-options.frec-dropdown-right-side,
    .frec-calendar-options.frec-dropdown-right,
    .frec-calendar-options.frec-dropdown-left {
        top: auto !important;
        bottom: 100% !important;
        margin-bottom: 5px !important;
        margin-top: 0 !important;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .frec-calendar {
        margin: 0 10px;
        border-radius: 6px;
        overflow: hidden;
        width: calc(100% - 20px); /* Account for margin */
        max-width: calc(100vw - 20px); /* Prevent viewport overflow */
    }
    
    .frec-calendar-header {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
        overflow: hidden;
    }
    
    .frec-calendar-filters {
        width: 100%;
        justify-content: center;
        flex-direction: column;
        gap: 8px;
        flex-wrap: nowrap;
    }
    
    .frec-filter-group {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        width: 100%;
        justify-content: space-between;
    }
    
    .frec-filter-group:last-child {
        flex-direction: row;
        justify-content: center;
        gap: 8px;
        margin-top: 8px;
    }
    
    .frec-filter-group:last-child .frec-btn {
        flex: 1;
        max-width: 120px;
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .frec-filter-group label {
        font-size: 0.8rem;
        white-space: nowrap;
        min-width: 70px;
        flex-shrink: 0;
    }
    
    .frec-filter {
        flex: 1;
        padding: 8px;
        font-size: 16px; /* Prevent zoom on iOS */
        border-radius: 4px;
    }
    
    /* Month view improvements for mobile */
    .frec-month-navigation {
        padding: 10px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        background: #f8f9fa;
    }
    
    .frec-month-title {
        font-size: 1.2rem;
        flex: 1;
        text-align: center;
        margin: 0 10px;
    }
    
    .frec-nav-btn {
        position: static;
        width: auto;
        min-width: 60px;
        height: 32px;
        padding: 0 8px;
        font-size: 0.7rem;
        border-radius: 4px;
        gap: 2px;
    }
    
    /* Calendar grid mobile optimization */
    .frec-calendar-grid {
        padding: 8px;
        width: 100%;
        overflow: hidden;
        box-sizing: border-box;
    }
    
    .frec-weekdays {
        margin-bottom: 5px;
        gap: 1px;
        width: 100%;
        overflow: hidden;
    }
    
    .frec-weekday {
        padding: 6px 2px;
        font-size: 0.75rem;
        font-weight: 600;
        min-width: 0; /* Prevent overflow */
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .frec-days {
        gap: 1px;
        width: 100%;
        overflow: hidden;
    }
    
    .frec-days .frec-day {
        min-height: 60px;
        padding: 3px 2px;
        font-size: 0.85rem;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        overflow: hidden;
        min-width: 0; /* Critical for preventing overflow */
        max-width: 100%; /* Ensure doesn't exceed container */
    }
    
    .frec-day-number {
        font-size: 0.8rem;
        margin-bottom: 3px;
        font-weight: 600;
        text-align: center;
    }
    
    .frec-day-events {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 1px;
        overflow: hidden;
        width: 100%;
        min-width: 0; /* Prevent overflow */
    }
    
    /* Mobile styles for event text items */
    .frec-event-item-month {
        font-size: 0.55rem;
        padding: 1px 2px;
        margin-bottom: 1px;
        border-radius: 2px;
        line-height: 1.1;
        min-height: 12px;
        display: flex;
        align-items: center;
        overflow: hidden;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        min-width: 0; /* Prevent overflow */
    }
    
    .frec-event-text {
        line-height: 1;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 100%;
        max-width: 100%;
        min-width: 0; /* Prevent overflow */
        display: block;
    }
    
    .frec-event-dot {
        width: 6px;
        height: 6px;
    }
    
    /* List and grid view mobile improvements */
    .frec-event-item {
        flex-direction: row;
        gap: 12px;
        padding: 15px 8px;
        margin-bottom: 12px;
        align-items: flex-start;
    }
    
    .frec-event-date {
        flex-shrink: 0;
        min-width: auto;
        padding: 12px;
        margin-bottom: 0;
    }
    
    .frec-add-calendar-date {
        font-size: 0.5rem;
        padding: 2px 4px;
        margin-top: 4px;
    }
    
    .frec-event-details {
        flex: 1;
        padding-left: 0;
    }
    
    .frec-event-meta {
        grid-template-columns: 1fr;
        gap: 6px;
        align-items: flex-start;
    }
    
    .frec-event-meta span {
        flex-direction: column;
        align-items: flex-start;
        gap: 3px;
    }
    
    .frec-event-meta span strong {
        min-width: auto;
        font-size: 0.85rem;
    }
    
    .frec-event-actions {
        justify-content: flex-start;
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .frec-btn {
        padding: 10px 16px;
        font-size: 0.85rem;
        min-width: 100px;
        text-align: center;
    }
    
    .frec-events-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 12px 0;
    }
    
    /* Popup improvements for mobile */
    .frec-popup-content {
        width: 95%;
        max-height: 90vh;
        margin: 0 auto;
    }
    
    .frec-popup-body {
        padding: 25px 20px 20px;
    }
    
    .frec-event-details-full h2 {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }
    
    .frec-event-meta-full {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .frec-meta-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .frec-meta-item strong {
        min-width: auto;
    }
    
    .frec-event-actions-full {
        flex-direction: column;
        gap: 10px;
        padding-top: 15px;
    }
    
    .frec-event-actions-full .frec-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Mobile calendar dropdown adjustments - centered and upward positioning */
    .frec-add-calendar-btn {
        width: 100%;
        justify-content: center;
        padding: 10px 16px;
        font-size: 0.8rem;
        font-weight: 600;
    }

    .frec-add-calendar-btn.frec-add-calendar-inline {
        width: auto;
        padding: 6px 10px;
        font-size: 0.7rem;
        margin-left: 6px;
        display: inline-block;
    }
    
    /* Mobile dropdown styling */
    .frec-calendar-options {
        min-width: 220px;
        width: 260px;
        padding: 14px;
        border-radius: 8px;
        background: #ffffff !important;
        border: 1px solid #e0e0e0 !important;
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2) !important;
    }
    
    .frec-calendar-options h4 {
        font-size: 1rem;
        margin: 0 0 14px 0;
        padding-bottom: 10px;
        text-align: center;
        font-weight: 600;
    }
    
    .frec-calendar-option {
        padding: 10px 12px;
        margin-bottom: 6px;
        font-size: 0.85rem;
        border-radius: 6px;
        font-weight: 500;
    }
    
    .frec-calendar-close {
        padding: 8px 12px;
        font-size: 0.8rem;
        margin-top: 10px;
        border-radius: 4px;
        font-weight: 600;
    }
    
    /* Make meta items wrap better on mobile */
    .frec-meta-item {
        flex-wrap: wrap;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .frec-calendar {
        margin: 0 5px;
        border-radius: 4px;
        font-size: 14px; /* Base font size for very small screens */
        width: calc(100% - 10px); /* Account for margin */
        max-width: calc(100vw - 10px); /* Prevent viewport overflow */
    }
    
    .frec-calendar-header {
        padding: 8px;
        gap: 8px;
    }
    
    .frec-calendar-title {
        font-size: 1rem;
        text-align: center;
    }
    
    .frec-filter-group label {
        font-size: 0.75rem;
        min-width: 60px;
    }
    
    .frec-filter {
        padding: 6px;
        font-size: 14px;
    }
    
    /* Very compact month view */
    .frec-month-navigation {
        padding: 8px 5px;
    }
    
    .frec-month-title {
        font-size: 1rem;
        margin: 0 5px;
    }
    
    .frec-nav-btn {
        min-width: 50px;
        height: 28px;
        font-size: 0.65rem;
        padding: 0 6px;
    }
    
    .frec-calendar-grid {
        padding: 3px 2px;
        width: 100%;
        overflow: hidden;
    }
    
    .frec-weekday {
        padding: 4px 1px;
        font-size: 0.7rem;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .frec-days .frec-day {
        min-height: 45px;
        padding: 2px 1px;
        font-size: 0.8rem;
        min-width: 0;
        max-width: 100%;
        overflow: hidden;
    }
    
    .frec-day-number {
        font-size: 0.75rem;
        margin-bottom: 2px;
    }
    
    /* Very small screens - even more compact event text */
    .frec-event-item-month {
        font-size: 0.5rem;
        padding: 0.5px 1px;
        margin-bottom: 0.5px;
        border-radius: 1px;
        line-height: 1;
        min-height: 9px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow: hidden;
        box-sizing: border-box;
    }
    
    .frec-event-text {
        line-height: 0.9;
        font-weight: 700; /* Make text bolder for better readability */
        font-size: 0.5rem;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* List view optimizations for very small screens */
    .frec-events-container {
        padding: 8px 0;
    }
    
    .frec-event-item {
        padding: 12px 6px;
        margin-bottom: 8px;
        gap: 8px;
    }
    
    .frec-event-title {
        font-size: 1rem;
        line-height: 1.2;
        margin-bottom: 8px;
    }
    
    .frec-event-date {
        padding: 8px;
        min-width: 80px;
    }
    
    .frec-add-calendar-date {
        font-size: 0.45rem;
        padding: 1px 3px;
        margin-top: 3px;
    }
    
    .frec-day {
        font-size: 1.4rem;
    }
    
    .frec-month,
    .frec-year {
        font-size: 0.7rem;
    }
    
    .frec-time {
        font-size: 0.65rem;
    }
    
    .frec-event-meta span {
        font-size: 0.8rem;
    }
    
    .frec-event-description {
        font-size: 0.85rem;
        line-height: 1.4;
        padding: 10px;
    }
    
    .frec-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
        min-width: 80px;
        min-height: 40px; /* Improved touch targets */
    }
    
    /* Improve touch targets */
    .frec-view-details,
    .frec-btn-primary {
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Popup improvements for very small screens */
    .frec-popup-content {
        width: 96%;
        max-height: 92vh;
        margin: 2vh auto;
    }
    
    .frec-popup-close {
        width: 32px;
        height: 32px;
        font-size: 1.1rem;
        top: 10px;
        right: 10px;
    }
    
    .frec-popup-body {
        padding: 15px 10px 10px;
    }
    
    .frec-event-details-full h2 {
        font-size: 1.3rem;
        margin-bottom: 12px;
    }
    
    .frec-event-meta-full {
        padding: 10px;
        margin-bottom: 15px;
        gap: 8px;
    }
    
    .frec-meta-item {
        font-size: 0.8rem;
    }
    
    /* Very small calendar dropdown */
    
    /* Very small screens - stack button below on tiny devices */
    .frec-add-calendar-btn.frec-add-calendar-inline {
        margin-left: 0;
        margin-top: 4px;
        font-size: 0.55rem;
        padding: 3px 6px;
    }
    
    /* Ensure consistent popup styling on very small screens */
    .frec-calendar-options {
        width: 180px;
        min-width: 180px;
        padding: 10px;
        background: #ffffff !important;
        border: 1px solid #e0e0e0 !important;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
    }
    
    .frec-calendar-options h4 {
        font-size: 0.85rem;
        margin-bottom: 10px;
    }
    
    .frec-calendar-option {
        padding: 7px 8px;
        font-size: 0.75rem;
        margin-bottom: 3px;
    }
    
    .frec-calendar-close {
        padding: 5px 8px;
        font-size: 0.7rem;
        margin-top: 6px;
    }
    
    .frec-meta-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    /* Calendar dropdown positioning handled by JavaScript on small screens */
}
