:root {
    --mp-primary: #ff5722;
    --mp-surface: #ffffff;
    --mp-bg: #f4f4f9;
    --mp-text-dark: #1e293b;
    --mp-text-light: #64748b;
    --mp-border-radius: 20px;
    --mp-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* --- Calendar Widget Styles --- */
/* 1. Deep Floating Calendar Container */
.mp-calendar-container {
    background: var(--mp-surface);
    border-radius: 24px; /* Slightly more rounded for a modern app look */
    /* Two-layer shadow for depth: one subtle, one deep */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 20px 25px -5px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 520px;
    padding: 28px;
    margin: 20px auto;
    border: 1px solid rgba(255, 255, 255, 0.8); /* Soft border for glass feel */
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* 2. Enhanced Date Box Hover Glow */
.mp-day:hover:not(.mp-past-date) {
    background: #ffffff;
    border-color: var(--mp-primary);
    transform: translateY(-4px);
    /* Soft glowing shadow on hover */
    box-shadow: 0 8px 16px rgba(255, 87, 34, 0.2); 
}

/* 3. Modal Depth Shadow */
.mp-modal-content {
    background: var(--mp-surface);
    width: 90%;
    max-width: 450px;
    border-radius: 28px;
    /* Extra depth for the modal to make it feel 'closer' to the user */
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.3), 0 18px 36px -18px rgba(0, 0, 0, 0.3);
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Main Calendar Title */
.mp-calendar-main-title {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px dashed #e2e8f0;
}

.mp-calendar-main-title h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    color: var(--mp-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.5px;
}

/* Calendar Header / Navigation */
.mp-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.mp-calendar-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--mp-text-dark);
}

.mp-nav-btn {
    background: #f1f5f9;
    border: none;
    color: var(--mp-text-dark);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
}

.mp-nav-btn:hover:not(.mp-btn-disabled) {
    background: var(--mp-primary);
    color: #fff;
}

.mp-btn-disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Calendar Grid */
.mp-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--mp-text-light);
    margin-bottom: 12px;
}

.mp-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

/* Polished Date Boxes */
.mp-cal-cell {
    min-height: 62px; /* Made slightly taller to match the new width */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 16px; /* Slightly larger date numbers */
    border-radius: 8px;
    transition: all 0.2s ease;
    padding: 4px 1px; /* Magic fix: Reduced left/right padding so text can reach the edges */
    box-sizing: border-box;
    overflow: hidden;
}

.mp-date-num {
    font-weight: 600;
    line-height: 1;
}

.mp-cal-event-badge {
    font-size: 9.5px;
    color: #e11d48;
    margin-top: 4px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    font-weight: 600;
    letter-spacing: -0.3px; /* Magic fix: Pulls the letters just a tiny bit closer together to fit long words */
}

.mp-day {
    color: var(--mp-text-dark);
    cursor: pointer;
    background: #fff;
    border: 1px solid #f1f5f9;
}

.mp-day:hover:not(.mp-past-date) {
    background: rgba(255, 87, 34, 0.05);
    border-color: var(--mp-primary);
    transform: translateY(-2px);
}

/* --- Animated 'Today' Box --- */
.mp-today {
    background: var(--mp-primary);
    color: #ffffff !important;
    border-color: var(--mp-primary);
    box-shadow: 0 4px 12px rgba(255, 87, 34, 0.3);
    animation: pulseClickHint 2s infinite;
    position: relative;
    cursor: pointer;
}

.mp-today .mp-date-num, 
.mp-today .mp-cal-event-badge {
    color: #ffffff !important;
}

/* Hover effect for Today's Date */
.mp-today:hover {
    background: #000000 !important;
    border-color: #000000 !important;
    color: #ffffff !important;
    transform: translateY(-2px);
}

.mp-today:hover .mp-date-num, 
.mp-today:hover .mp-cal-event-badge {
    color: #ffffff !important; 
}

@keyframes pulseClickHint {
    0% { transform: scale(1); box-shadow: 0 4px 12px rgba(255, 87, 34, 0.3); }
    50% { transform: scale(1.06); box-shadow: 0 6px 16px rgba(255, 87, 34, 0.5); }
    100% { transform: scale(1); box-shadow: 0 4px 12px rgba(255, 87, 34, 0.3); }
}

/* Past Dates */
.mp-past-date {
    color: #cbd5e1;
    cursor: not-allowed;
    background: #fafafa;
    border-color: transparent;
    pointer-events: none;
}

.mp-past-date .mp-cal-event-badge {
    color: #cbd5e1;
}

.mp-empty {
    background: transparent;
    border-color: transparent;
    pointer-events: none;
}


/* =========================================
   Modal Overlay (Glassmorphism)
========================================= */
#mp-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#mp-modal-overlay.mp-hidden {
    opacity: 0;
    visibility: hidden;
}

.mp-modal-content {
    background: var(--mp-surface);
    width: 90%;
    max-width: 420px;
    border-radius: var(--mp-border-radius);
    box-shadow: var(--mp-shadow);
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

#mp-modal-overlay.mp-hidden .mp-modal-content {
    transform: scale(0.95) translateY(20px);
}

/* Close Button (Excluded from screenshot) */
#mp-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #f1f5f9;
    border: none;
    color: var(--mp-text-light);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10;
}

#mp-close-btn:hover {
    background: #e2e8f0;
    color: var(--mp-text-dark);
}

/* =========================================
   Capture Area (Content exported to Image)
========================================= */
#mp-capture-area {
    padding: 24px;
    background: #ffffff;
    border-radius: var(--mp-border-radius) var(--mp-border-radius) 0 0;
}

.mp-modal-header {
    padding-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
    text-align: center;
}

.mp-modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: var(--mp-text-dark);
}

.mp-header-date {
    font-size: 14px;
    font-weight: 500;
    color: var(--mp-text-light);
    margin-left: 6px;
    vertical-align: middle;
}

.mp-modal-body {
    padding: 16px 0;
    max-height: 55vh;
    overflow-y: auto;
}

/* Inner Grid & Sections */
.mp-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--mp-text-dark);
    margin: 20px 0 10px 0;
    padding-bottom: 5px;
    border-bottom: 2px solid #e2e8f0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mp-modal-body > .mp-section-title:first-child {
    margin-top: 0;
}

.mp-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.mp-full-width {
    grid-column: span 2;
}

.mp-item {
    background: var(--mp-bg);
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    color: var(--mp-text-dark);
}

.mp-item span {
    font-weight: 600;
    color: var(--mp-text-light);
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    text-transform: uppercase;
}

.mp-highlight {
    margin-top: 16px;
    background: rgba(255, 87, 34, 0.1);
    color: #c0392b;
    padding: 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}

/* Moonfires Branding (Appears in exported image) */
.mp-branding {
    text-align: center;
    padding-top: 16px;
    margin-top: 8px;
    border-top: 2px dashed #e2e8f0;
    font-size: 13px;
    color: var(--mp-text-light);
}

.mp-branding strong {
    color: var(--mp-primary);
    font-size: 15px;
    font-weight: 800;
}

/* =========================================
   Footer & Buttons (Excluded from image)
========================================= */
.mp-modal-footer {
    padding: 16px 24px;
    background: #fafafa;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 12px;
}

.mp-modal-footer button {
    flex: 1;
    padding: 14px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    border: none;
    transition: all 0.2s ease;
}

#mp-copy-btn {
    background: var(--mp-primary);
    color: #fff;
}

#mp-copy-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.mp-btn-secondary {
    background: #e2e8f0;
    color: var(--mp-text-dark);
}

.mp-btn-secondary:hover {
    background: #cbd5e1;
    transform: translateY(-1px);
}

.mp-loader {
    text-align: center;
    color: var(--mp-text-light);
    padding: 20px;
}


/* =========================================
   Layout Wrappers
========================================= */
/* Default (Mobile/Popup view) - Everything stacks normally */
.mp-layout-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* =========================================
   WIDE EXPORT MODE (Triggered only during Image Download)
========================================= */
.mp-export-mode {
    width: 850px !important; /* Force a wide, landscape format */
    max-width: none !important;
    border-radius: 0 !important; /* Sharp corners look better for saved images */
    padding: 40px !important; /* Add more breathing room around the edges */
}

/* Make header bigger for the wide image */
.mp-export-mode .mp-modal-header h3 {
    font-size: 28px;
    margin-bottom: 12px;
}

.mp-export-mode .mp-header-date {
    font-size: 18px;
}

/* Split the content into Two Side-by-Side Columns */
.mp-export-mode .mp-layout-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px; /* Big gap between the left and right columns */
    align-items: start;
}

/* Make the Branding larger and push it down */
.mp-export-mode .mp-branding {
    font-size: 16px;
    margin-top: 30px;
    padding-top: 20px;
}

.mp-export-mode .mp-branding strong {
    font-size: 20px;
}