/* CSS Variables for consistent styling */
:root {
    --mcw-romantic-red: #db3535;
    --mcw-romantic-pink: #db3535;
    --mcw-romantic-coral: #db3535;
    --mcw-romantic-rose: #db3535;
    --mcw-romantic-burgundy: #db3535;
    --mcw-romantic-shadow: rgba(219, 53, 53, 0.3);
    --mcw-romantic-light-shadow: rgba(219, 53, 53, 0.2);
    --mcw-romantic-hover-shadow: rgba(219, 53, 53, 0.5);
    --mcw-romantic-active: #333;
    --mcw-cancel-gray-light: #6c757d;
    --mcw-cancel-gray-medium: #6c757d;
    --mcw-cancel-gray-dark: #ffffff;
    --mcw-cancel-shadow: rgba(108, 117, 125, 0.2);
    --mcw-cancel-hover-shadow: rgba(108, 117, 125, 0.4);
    --mcw-reset-sky-light: #66D9FF;
    --mcw-reset-sky-medium: #00BFFF;
    --mcw-reset-sky-dark: #0095CC;
    --mcw-reset-shadow: rgba(0, 191, 255, 0.3);
    --mcw-reset-hover-shadow: rgba(0, 191, 255, 0.5);
}

/**************************************** 
 * Container & Days
*****************************************/
#egw-itinerary-container {
    width: 100%;
    margin: 0 0 60px 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative; /* Add this to make it a positioning context */
}

.egw-itinerary-day {
    border: 1px solid #ddd;
    padding: 15px;
    margin-bottom: 20px;
    background: #fff;
    border-radius: 6px;

    /* Changed from 35em to 100% so it doesn't overflow on small screens: */
    max-width: 800px;

    display: flex;
    justify-content: center;
    flex-direction: column;
    direction: ltr;
}

.egw-itinerary-day h3 {
    text-align: center;
    margin-bottom: 20px;
}

.egw-itinerary-timeline {
    position: relative;
    width: 100%; /* ensure it scales down on small screens */
}

/* إضافة خط تايم لاين متصل في الخلفية */
.egw-itinerary-timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 10px;
    bottom: 80px; /* Stop before the last event area */
    width: 2px;
    background-color: #db3535;
    transform: translateX(-50%);
    z-index: 1;
}

/****************************************
 * Events
*****************************************/
.egw-itinerary-event {
  display: grid;
  grid-template-columns: 1fr 40px 1fr;
  align-items: start;
  margin: 0;
  padding: 10px 5px;
  transition: background-color 0.3s, transform 0.3s;
  min-height: 80px;
}

/* If user toggles 'highlight' */
.egw-itinerary-event.highlighted {
    background-color: #fffd8f;
    border-radius: 15px;
    padding: 15px 8px;
    margin: 0;
    box-shadow: 0 2px 5px rgba(255, 253, 143, 0.3);
}

/* For auto-sort transitions */
.egw-itinerary-events {
    position: relative;
    direction: ltr;
}

/****************************************
 * Left Column: time + duration
*****************************************/
.egw-option-time-wrapper {
    display: flex;
    flex-direction: row;
    gap: 15px;
    align-items: center;
    justify-content:space-around;
    padding-top: 5px;
    width: 100%;
}
.egw-time-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-sizing: border-box;
    justify-content: flex-start;
}

#egw-itinerary-container .egw-event-time {
    width: 160px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid #ddd;
    padding: 5px 8px;
    font-size: 1.1em;
    font-weight: 500;
    text-align: center;
    margin: 0;
    box-sizing: border-box;
    color: #333;
    transition: border-color 0.2s ease;
}
#egw-itinerary-container .egw-event-time:focus {
    border-bottom-color: var(--mcw-romantic-red);
    outline: none;
}
#egw-itinerary-container .egw-event-time::-webkit-calendar-picker-indicator {
    display: none;
    -webkit-appearance: none;
}
#egw-itinerary-container .egw-event-time::-webkit-inner-spin-button,
#egw-itinerary-container .egw-event-time::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.egw-duration {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
    font-size: 0.85em;
    color: #666;
    white-space: nowrap;
}
#egw-itinerary-container .egw-event-duration {
    width: 30px;
    height: 25px;
    font-size: 0.85em;
    border: 0;
    border-bottom: 2px solid #ddd;
    background: transparent;
    text-align: center;
    box-sizing: border-box;
    padding: 2px 3px;
    margin: 0;
}
#egw-itinerary-container .egw-event-duration::-webkit-inner-spin-button,
#egw-itinerary-container .egw-event-duration::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/****************************************
 * Center Column: timeline
*****************************************/
.egw-timeline-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: relative;
}

/* Replace the drag-handle with event-icon */
.egw-event-icon {
    position: relative;
    font-size: 1.2em;
    line-height: 1;
    background: white;
    border: 2px solid #db3535;
    border-radius: 50%;
    padding: 13px;
    cursor: pointer; /* Change to pointer since it's clickable */
    transition: background-color 0.2s;
    z-index: 2;
    margin: 0;
    top:20px;
}

.egw-event-icon:hover {
    background: #db353512;
}

/* Icon Selection Popup */
.egw-icon-popup {
    display: none;
    position: absolute;
    z-index: 1000;
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 10px;
    max-width: 315px;
    text-align: center;
}

.egw-icon-popup.show {
    display: block;
}

.egw-icon-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
}

.egw-icon-option {
    font-size: 1.2em;
    padding: 8px;
    cursor: pointer;
    border-radius: 4px;
}

.egw-icon-option:hover {
    background-color: #f0f0f0;
}

.egw-icon-popup-title {
    margin-bottom: 10px;
    font-size: 0.9em;
    color: #555;
    text-align: center;
}

.egw-timeline-line {
    /* إخفاء الخط المنفصل لكل حدث لأن لدينا خط متصل في الخلفية */
    display: none;
}

/****************************************
 * Right Column: title + ellipsis
*****************************************/
.egw-details-wrapper {
    margin: 0;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    /* remove fixed width to avoid cutting on mobile */
    width: auto;
    padding-top: 5px;
}

#egw-itinerary-container .egw-event-title {
    flex: 1;
    font-size: 1em;
    background: transparent;
    border: 0;
    /*border-bottom: 2px solid #db3535;*/
    /*padding: 4px 6px;*/
    box-sizing: border-box;
    margin-bottom: 0;
    /* allow vertical wrapping */
    white-space: normal;
    word-wrap: break-word;
    max-width: 160px;
    direction: rtl;
    min-height: 20px;
    resize: none;
    overflow: hidden;
    font-family: inherit;
    line-height: 1.4;
}

/* Styles for editable title display */
.egw-event-title-display {
    flex: 1;
    font-size: 1em;
    background: transparent;
    border: 1px dashed transparent;
    border-bottom: 1px solid #ddd;
    padding: 8px;
    box-sizing: border-box;
    margin-bottom: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-width: 160px;
    direction: rtl;
    min-height: 24px;
    line-height: 1.5;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    font-family: inherit;
    border-radius: 4px;
}

.egw-event-title-display:hover {
    border-color: #ccc;
    border-bottom-color: var(--mcw-romantic-red);
    background-color: #f9f9f9;
}

.egw-event-title-display.empty {
    color: #999;
    font-style: italic;
}

.egw-event-title-display.editing {
    display: none;
}

.egw-event-title-textarea {
    display: none;
    flex: 1;
    font-size: 1em;
    background: #fff;
    border: 2px solid #3498db;
    padding: 8px;
    box-sizing: border-box;
    margin-bottom: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-width: 160px;
    direction: rtl;
    min-height: 24px;
    resize: none;
    overflow: hidden;
    line-height: 1.5;
    font-family: inherit;
    border-radius: 3px;
    outline: none;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

.egw-event-title-textarea.editing {
    display: block;
}

/****************************************
 * Ellipsis for highlight/delete
*****************************************/
.egw-options-btn {
    position: relative;
    cursor: pointer;
}

/* Hidden by default; visible on hover/focus */
.egw-ellipsis {
    font-size: 1.2em;
    line-height: 1;
    user-select: none;
    visibility: visible; /* Make visible by default for mobile */
    color: #999;
    transition: color 0.2s ease;
}

.egw-itinerary-event:hover .egw-ellipsis,
.egw-itinerary-event:focus-within .egw-ellipsis {
    visibility: visible;
    color: #666;
}

.egw-options-menu {
    position: absolute;
    top: 25px;
    right: 0;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    display: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    z-index: 999;
    min-width: fit-content;
    text-align: right;
}
.egw-options-menu.menu-visible {
    display: block;
}
.egw-options-menu ul {
    margin: 0;
    padding: 0;
    list-style: none;
}
.egw-options-menu li {
    color: black;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.9em;
    white-space: nowrap;
}
.egw-options-menu li:hover {
    background: #f0f0f0;
}

.egw-options-menu li:last-child {
    border-bottom: none;
}

.egw-event-title-display,
.egw-event-title-textarea {
    font-size: 0.9em;
    padding: 5px 6px;
    min-height: 40px;
}

.egw-timeline-line {
    display: none; /* نبقيه مخفي حتى على الموبايل */
}

.egw-itinerary-timeline::before {
    width: 2px; /* نحافظ على نفس العرض */
}

/****************************************
 * Day-level "إضافة مناسبة" button
*****************************************/
.egw-add-event-btn-wrapper {
    display: flex;
    justify-content: center;
    margin: 10px 0;
}

/* Reset and Add Button Styles */
#egw-reset-btn,
#egw-add-event-btn-top,
#egw-delete-all-events,
.egw-add-event-btn-bottom,
.egw-settings-btn {
    background: var(--mcw-romantic-red) !important;
    color: white !important;
    border: none !important;
    border-radius: 25px !important;
    padding: 12px 30px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    min-width: 120px !important;
    box-shadow: 0 4px 15px var(--mcw-romantic-shadow) !important;
    position: relative !important;
    overflow: hidden !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    margin: 5px !important;
    direction: rtl;
}

#egw-reset-btn:hover,
#egw-add-event-btn-top:hover,
#egw-delete-all-events:hover,
.egw-add-event-btn:hover,
.egw-add-event-btn-bottom:hover,
.egw-settings-btn:hover {
    background: var(--mcw-romantic-active) !important;
    box-shadow: 0 6px 20px var(--mcw-romantic-hover-shadow) !important;
    transform: translateY(-2px) !important;
}

.egw-plus-icon {
    font-size: 18px;
    margin-right: 5px;
    color: #fff !important;
}

.egw-plus-text {
    font-size: 14px;
    color: #fff !important;
}

#egw-reset-btn:hover .egw-plus-icon,
#egw-reset-btn:hover .egw-plus-text,
#egw-add-event-btn-top:hover .egw-plus-icon,
#egw-add-event-btn-top:hover .egw-plus-text,
#egw-delete-all-events:hover .egw-delete-icon,
#egw-delete-all-events:hover .egw-plus-text,
#egw-settings-btn:hover .fas,
#egw-settings-btn:hover .egw-plus-text {
    color: #fff !important;
}

.egw-plus-btn .egw-options-menu {
    top: 35px;
    right: 0;
    min-width: 110px;
}


#egw-reset-modal{
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

#egw-reset-modal-msg{
    background: #fff; max-width: 400px; margin: 100px auto; padding: 20px; border-radius: 6px; text-align: center;
}

#egw-reset-yes{
    background:#db3535;
    border:none;
    color:white;
}

#egw-reset-no{
    background:white;
    border:1px solid black;
    
}

#egw-reset-no,
#egw-reset-yes{
       margin:0 6px;
       border-radius:4px;
       min-width:40px;
}

/****************************************
 * Saving Indicators
*****************************************/
#egw-saving-indicator, 
#egw-save-error {
    position: fixed;
    top: 10px;
    right: 10px;
    padding: 8px 15px;
    border-radius: 4px;
    display: none; /* Hidden by default */
    z-index: 10000;
    font-size: 0.9em;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#egw-saving-indicator {
    background: #d1ecf1; /* Light blue */
    color: #0c5460;
    border: 1px solid #bee5eb;
}

#egw-save-error {
    background: #f8d7da; /* Light red */
    color: #721c24;
    border: 1px solid #f5c6cb;
}

@media (max-width: 480px) {
    .egw-event-icon {
        top: 10px;
    }
    .egw-itinerary-day{
        width: 100%;
        padding: 0 5px;
    }
    
    .egw-itinerary-timeline{
        padding: 0;
    }
    
    .egw-itinerary-event {
        display: grid;
        grid-template-columns: 45% 10% 45%;
        gap: 0;
        margin-bottom: 20px;
        padding: 8px 3px;
        align-items: flex-start;
        min-height: 80px;
    }
    
    .egw-itinerary-event.highlighted {
        padding: 12px 5px;
        margin: 12px 0;
    }
    

    
    .egw-time-wrapper {
        justify-content: start;
        width: 100%;
        align-items: center;
    }
    
    #egw-itinerary-container .egw-event-time {
        font-size: 0.9em;
        width: 100%;
        max-width: 120px;
        padding: 4px 6px;
    }
    
    .egw-duration {
        font-size: 0.8em;
        margin-top: 2px;
    }
    
    #egw-itinerary-container .egw-event-duration {
        width: 25px;
        height: 20px;
        font-size: 0.8em;
    }
    
    .egw-timeline-center {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 100%;
        padding-top: 10px;
    }
    
    .egw-details-wrapper {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        width: 100%;
        padding-top: 5px;
    }
    
    #egw-itinerary-container .egw-event-title,
    .egw-event-title-display,
    .egw-event-title-textarea {
        max-width: 100%;
        width: 100%;
        font-size: 0.9em;
        text-align: right;
    }
    
    .egw-options-btn{
        min-width: 5%;
        margin-top: 5px;
        align-self: flex-start;
    }
    
    /* Fix options menu positioning on mobile */
    .egw-options-menu {
        right: auto;
        left: 0;
        transform: translateX(0);
    }
    
    /* Make sure options button is always visible on mobile */
    .egw-ellipsis {
        visibility: visible !important;
        color: #666 !important;
        font-size: 1.2em;
        padding: 6px;
        margin: -6px;
        border-radius: 4px;
        transition: background-color 0.2s ease;
    }
    
    .egw-ellipsis:active,
    .egw-ellipsis:focus {
        background-color: rgba(219, 53, 53, 0.1);
    }
    
    /* Make options menu items more touch-friendly */
    .egw-options-menu li {
        padding: 12px 16px;
        font-size: 1em;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .egw-options-menu li:last-child {
        border-bottom: none;
    }
    
    .egw-timeline-line {
        display: none;
    }
    
    .egw-itinerary-timeline::before {
        width: 2px;
    }
}

/* Add these responsive fixes for the icon popup */
@media (max-width: 480px) {
    .egw-icon-popup {
        position: fixed;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%);
        max-width: 280px;
        width: 90%;
        z-index: 10000;
    }
    
    .egw-icon-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 8px;
    }
    
    .egw-icon-option {
        padding: 6px;
        font-size: 1.1em;
    }
}

/* Add these styles at an appropriate location in the CSS file */

/* Style for the "none" icon option in the picker */
.egw-none-icon {
    border: 1px dashed #ccc;
    background-color: #f8f8f8;
}

/* Visual indicator for the empty placeholder in the picker */
.egw-empty-placeholder {
    width: 100%;
    height: 100%;
    min-height: 20px;
    position: relative;
}

.egw-empty-placeholder::before {
    content: "✕";
    color: #ccc;
    font-size: 0.8em;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Style for icon elements with no content */
.egw-icon-empty {
    border-style: dashed;
    border-color: #ccc;
    background-color: #f8f8f8;
}

/* Time Conflict Notification */
.egw-time-conflict-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: none;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.egw-time-conflict-notification.show {
    display: block;
    transform: translateX(0);
}

.egw-notification-content {
    background-color: #fff;
    border: 1px solid #ff6b6b;
    border-radius: 4px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
    min-width: 300px;
    max-width: 400px;
}

.egw-notification-content p {
    margin: 0;
    color: #333;
    font-size: 14px;
    line-height: 1.4;
}

.egw-notification-close {
    position: absolute;
    top: 5px;
    left: 5px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #999;
    padding: 0;
    line-height: 1;
}

.egw-notification-close:hover {
    color: #333;
}

/* --- Notification System --- */
#egw-notification-container {
    position: fixed;
    bottom: 20px;
    right: 20px; /* Changed back to right */
    z-index: 10001;
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* Changed to end for RTL on right side */
    gap: 8px;
    pointer-events: none;
}

.egw-notification {
    direction: rtl;
    padding: 12px 15px;
    border-radius: 4px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    color: #333;
    font-size: 13px;
    min-width: 200px;
    max-width: 300px;
    opacity: 0;
    transform: translateX(100%); /* Changed for RTL on right side */
    transition: opacity 0.3s ease, transform 0.3s ease;
    cursor: pointer;
    position: relative;
    pointer-events: auto;
    border-bottom-width: 4px;
    border-bottom-style: solid;
}

/* Notification Types - More prominent bottom borders */
.egw-notification.success {
    border-bottom-color: #28a745;
}

.egw-notification.error {
    border-bottom-color: #dc3545;
}

.egw-notification.warning {
    border-bottom-color: #ffc107;
}

.egw-notification.info {
    border-bottom-color: #17a2b8;
}

.egw-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.egw-notification.hide {
    opacity: 0;
    transform: translateX(100%); /* Changed for RTL on right side */
}

/* Top buttons container */
.egw-top-buttons-container {
    width: 100%;
    max-width: 100%;
    border: 1px solid #ddd;
    padding: 15px;
    margin-bottom: 20px;
    background: #fff;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    gap: 5px;
    top: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    top:100px;
    max-width: 450px;
    direction: ltr;
}   

/* Add focus styles for the buttons when sticky */
.egw-top-buttons-container.is-sticky {
    border-color: #ccc;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* --- Add Event Modal Styles --- */
#egw-add-event-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10010; /* High z-index */
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
}

.egw-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
}

.egw-modal-content {
    position: relative;
    background: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 300px;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: none;
    z-index: 1;
    direction: rtl; /* Right-to-left for Arabic */
}

#egw-add-event-modal .egw-modal-content h3,
#egw-add-event-modal .egw-modal-content h4,
#egw-edit-event-modal .egw-modal-content h3,
#egw-edit-event-modal .egw-modal-content h4 {
    margin-top: 0;
    margin-bottom: 10px;
    text-align: center;
    color: var(--mcw-romantic-red);
    font-size: 20px;
    font-weight: 600;
}

.egw-modal-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.egw-modal-field {
    display: flex;
    flex-direction: column;
}

.egw-modal-field label {
    margin-bottom: 5px;
    font-size: 0.9em;
    color: #555;
}

.egw-modal-field input[type="time"],
.egw-modal-field input[type="number"],
.egw-modal-field input[type="text"],
.egw-modal-field select {
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    box-sizing: border-box;
    width: 100%;
    text-align: right; /* Align text to right for Arabic */
    direction: rtl;
}

/* Specific style for time input */
.egw-modal-field input[type="time"] {
    text-align: right;
    direction: rtl;
}

/* Specific style for icon select */
.egw-modal-field select#egw-modal-icon {
    text-align: right;
    font-size: 1em;
    direction: rtl;
}

.egw-modal-actions {
    display: flex;
    justify-content: center; /* Align buttons to the end (left in RTL) */
    gap: 10px;
    margin-top: 15px;
}

/* Mobile responsive styles for modal actions */
@media (max-width: 480px) {
    .egw-modal-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .egw-modal-actions button {
        width: 100% !important;
        min-width: auto !important;
    }
}

.egw-modal-actions button {
    background: var(--mcw-romantic-red) !important;
    color: white !important;
    border: none !important;
    border-radius: 20px !important;
    padding: 8px 20px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    min-width: 80px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
    position: relative !important;
    overflow: hidden !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    margin: 2px !important;
}

#egw-modal-ok-btn {
    background: var(--mcw-romantic-red) !important;
    color: white !important;
    border: none !important;
}

#egw-modal-ok-btn:hover {
    background: var(--mcw-romantic-active) !important;
    box-shadow: 0 6px 20px var(--mcw-romantic-hover-shadow) !important;
    transform: translateY(-2px) !important;
}

#egw-modal-cancel-btn {
    background: var(--mcw-cancel-gray-medium) !important;
    color: white !important;
    border: none !important;
}

#egw-modal-cancel-btn:hover {
    background: var(--mcw-cancel-gray-dark) !important;
    box-shadow: 0 6px 20px var(--mcw-cancel-hover-shadow) !important;
    transform: translateY(-2px) !important;
}

/* Show modal */
#egw-add-event-modal.show {
    display: flex;
}

/* Sync Button Base Styles */
.egw-sync-btn {
    background-color: #98FB98;
    border: 1px solid #90EE90;
    width: 40px;
    height: 40px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
    overflow: visible;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.egw-sync-btn:hover {
    opacity: 1;
}

.egw-sync-btn.syncing,
.egw-sync-btn.waiting,
.egw-sync-btn.error,
.egw-sync-btn.indexeddb,
.egw-sync-btn.local {
    opacity: 1;
}

/* SVG Icon Base Styles */
.egw-sync-btn svg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
}

.mcw-cloud-icon,
.mcw-check-icon,
.mcw-rotate-icon,
.mcw-database-icon {
    opacity: 0;
    position: absolute;
    transition: opacity 0.2s ease;
}

/* Waiting State - Red */
.egw-sync-btn.waiting {
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.egw-sync-btn.waiting .mcw-cloud-icon {
    opacity: 1;
    stroke: #721c24;
}

/* Error State - Red */
.egw-sync-btn.error {
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.egw-sync-btn.error .mcw-cloud-icon {
    opacity: 1;
    stroke: #721c24;
}

/* IndexedDB State - Purple */
.egw-sync-btn.indexeddb {
    background-color: #e6e6fa;
    border-color: #d8bfd8;
}

.egw-sync-btn.indexeddb .mcw-database-icon {
    opacity: 1;
    stroke: #4b0082;
}

/* LocalStorage State - Yellow */
.egw-sync-btn.local {
    background-color: #fff9c4;
    border-color: #fff176;
}

.egw-sync-btn.local .mcw-cloud-icon {
    opacity: 1;
    stroke: #856404;
}

/* Success State - Green */
.egw-sync-btn.success {
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.egw-sync-btn.success .mcw-cloud-icon,
.egw-sync-btn.success .mcw-check-icon {
    opacity: 1;
    stroke: #155724;
}

/* Default State */
.egw-sync-btn:not(.waiting):not(.syncing):not(.error):not(.indexeddb):not(.local) .mcw-cloud-icon,
.egw-sync-btn:not(.waiting):not(.syncing):not(.error):not(.indexeddb):not(.local) .mcw-check-icon {
    opacity: 1;
}

/* Syncing State - Blue */
.egw-sync-btn.syncing {
    background-color: #cce5ff;
    border-color: #b8daff;
}

.egw-sync-btn.syncing .mcw-rotate-icon,
.egw-sync-btn.syncing .mcw-cloud-icon {
    opacity: 1;
    stroke: #004085;
}

.egw-sync-btn.syncing .mcw-rotate-icon {
    animation: egw-sync-rotate 1.5s linear infinite;
    transform-origin: center;
}

@keyframes egw-sync-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Reset modal styles */
#egw-reset-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

#egw-reset-modal-msg {
    background: #fff;
    max-width: 400px;
    margin: 100px auto;
    padding: 20px;
    border-radius: 6px;
    text-align: center;
}

/* Reset and Add Button Styles */
#egw-reset-btn,
#egw-add-event-btn-top,
#egw-delete-all-events,
.egw-add-event-btn-bottom {
    direction: rtl;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 5px;
    background-color: #f8f8f8;
    border: 1px dashed #ccc;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #3498db;
    margin: 0;
}

/* #egw-reset-btn:hover,
#egw-add-event-btn-top:hover,
#egw-delete-all-events:hover,
.egw-add-event-btn-bottom:hover {
    background-color: #e8f4ff;
    border-color: #7dbfff;
} */

.egw-plus-icon {
    font-size: 18px;
    margin-right: 5px;
    margin-left: 5px;
    color: #fff !important;
}

.egw-plus-text {
    font-size: 14px;
    color: #fff !important;
}

/* #egw-reset-btn:hover .egw-plus-icon,
#egw-reset-btn:hover .egw-plus-text,
#egw-add-event-btn-top:hover .egw-plus-icon,
#egw-add-event-btn-top:hover .egw-plus-text {
    color: #3498db;
} */

div[style*="justify-content: center;"] {
    gap: 5px; /* Set consistent gap between buttons */
}

/* Edit Event Modal Styles */
#egw-edit-event-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10010;
    display: none;
    align-items: center;
    justify-content: center;
}

#egw-edit-event-modal.show {
    display: flex;
}

#egw-edit-event-modal .egw-modal-content {
    position: relative;
    background: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 300px;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: none;
    z-index: 1;
    direction: rtl; /* Right-to-left for Arabic */
}

/* Sync Badge */
.egw-sync-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    font-weight: bold;
}

/* Error message styling */
.egw-title-error {
    color: #dc3545;
    font-size: 0.8em;
    margin-top: 5px;
    font-weight: normal;
}

/* Sync Status Icon Styling */
#egw-sync-status-icon {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
}

#egw-sync-status-icon i {
    font-size: 20px;
    color: #666;
    transition: all 0.3s ease;
}

#egw-sync-status-icon.sync-not-saved {
    background: #ff4444;
}

#egw-sync-status-icon.sync-not-saved i {
    color: #fff;
}

#egw-sync-status-icon.sync-local {
    background: #ffbb33;
}

#egw-sync-status-icon.sync-local i {
    color: #fff;
}

#egw-sync-status-icon.sync-progress {
    background: #33b5e5;
    animation: pulse 1.5s infinite;
}

#egw-sync-status-icon.sync-progress i {
    color: #fff;
    animation: spin 1.5s linear infinite;
}

#egw-sync-status-icon.sync-complete {
    background: #00C851;
}

#egw-sync-status-icon.sync-complete i {
    color: #fff;
}

#egw-sync-status-icon.sync-indexeddb {
    background: #9933CC;
}

#egw-sync-status-icon.sync-indexeddb i {
    color: #fff;
}

#egw-sync-status-icon:hover {
    transform: scale(1.1);
}

#egw-sync-status-icon .sync-tooltip {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    margin-bottom: 8px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#egw-sync-status-icon:hover .sync-tooltip {
    opacity: 1;
    visibility: visible;
}

#egw-sync-status-icon .sync-tooltip:after {
    content: '';
    position: absolute;
    top: 100%;
    right: 10px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

#egw-sync-status-icon .time-info {
    font-size: 11px;
    color: #ccc;
    margin-top: 4px;
}

#egw-sync-status-icon .time-info .hidden {
    display: none;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(51, 181, 229, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(51, 181, 229, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(51, 181, 229, 0);
    }
}

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

@media (max-width: 768px) {
    #egw-sync-status-icon {
        bottom: 10px;
        left: 10px;
        width: 35px;
        height: 35px;
    }

    #egw-sync-status-icon i {
        font-size: 16px;
    }
}

/* Settings Modal Styles */
#egw-settings-modal {
    display: none;
    position: fixed;
    z-index: 10001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
}

#egw-settings-modal .egw-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

#egw-settings-modal .egw-modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    width: 600px;
    max-width: 600px;
    margin: 10vh auto;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-height: 90vh;
    overflow-y: auto;
    direction: rtl;
}

#egw-settings-modal .egw-modal-content h4 {
    text-align: center;
    margin-bottom: 10px;
    color: var(--mcw-romantic-red);
    font-size: 24px;
    padding-right: 40px; /* Make space for close icon */
}

/* Instructions Section Styles */
.egw-settings-instructions {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 10px;
    border: 1px solid #e9ecef;
}

.egw-settings-instructions h5 {
    color: var(--mcw-romantic-red);
    margin-bottom: 15px;
    font-size: 18px;
    text-align: center;
    border-bottom: 2px solid var(--mcw-romantic-red);
    padding-bottom: 10px;
}

.egw-instruction-content p {
    margin-bottom: 10px;
    color: #495057;
    line-height: 1.6;
    text-align: center;
}

.egw-instruction-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.egw-instruction-content li {
    padding: 8px 0;
    color: #495057;
    line-height: 1.5;
    border-bottom: 1px solid #e9ecef;
}

.egw-instruction-content li:last-child {
    border-bottom: none;
}

.egw-tip {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    text-align: center;
    color: #856404;
    font-size: 14px;
}

.egw-settings-buttons {
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid #e9ecef;
    display: flex;
    flex-direction: row !important;
    gap: 15px;
    justify-content: center;
}

.egw-settings-buttons button {
    background: var(--mcw-romantic-red);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    margin: 0; /* Remove margins, gap handles spacing */
}

.egw-settings-buttons button:hover {
    background: #c41e3a;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(196, 30, 58, 0.3);
}

.egw-settings-buttons button:active {
    transform: translateY(0);
}

#egw-settings-modal.show,
#egw-settings-modal[style*="display: block"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Mobile responsive styles for settings modal */
@media (max-width: 768px) {
    #egw-settings-modal .egw-modal-content {
        width: 95%;
        max-width: none;
        padding: 20px;
        max-height: 75vh;
        margin: 10vh auto;
    }
    
    .egw-settings-instructions {
        padding: 15px;
    }
    
    .egw-instruction-content li {
        font-size: 14px;
        padding: 6px 0;
    }
    
    .egw-tip {
        padding: 12px;
        font-size: 13px;
    }
    
    .egw-settings-buttons {
        flex-direction: column !important;
    }
    
    .egw-settings-buttons button {
        width: 100% !important;
        min-width: auto !important;
        font-size: 14px !important;
        padding: 12px !important;
    }
}

/* Settings close button */
#egw-settings-close-btn {
    background: var(--mcw-cancel-gray-medium) !important;
    color: white !important;
    border: none !important;
    border-radius: 25px !important;
    padding: 12px 30px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    min-width: 120px !important;
    box-shadow: 0 4px 15px var(--mcw-cancel-shadow) !important;
    position: relative !important;
    overflow: hidden !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    width: 100% !important;
}

#egw-settings-close-btn:hover {
    background: var(--mcw-cancel-gray-dark) !important;
    box-shadow: 0 6px 20px var(--mcw-cancel-hover-shadow) !important;
    transform: translateY(-2px) !important;
    color: var(--mcw-cancel-gray-medium) !important;
}

/* Fix timeline to not appear after last event */
.egw-itinerary-event:last-child .egw-timeline-line {
    display: none !important;
}

.egw-itinerary-event:last-child .egw-timeline-center::after {
    display: none !important;
}

/* Update timeline background to stop before last event */
.egw-itinerary-timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 10px;
    bottom: 80px; /* Stop before the last event area */
    width: 2px;
    background-color: #db3535;
    transform: translateX(-50%);
    z-index: 1;
}

/* Settings Button Specific Styles */
#egw-settings-btn {
    background-color: var(--mcw-romantic-red) !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important; /* Make it circular */
    padding: 12px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    min-width: 48px !important;
    width: 48px !important;
    height: 48px !important;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3) !important;
    position: relative !important;
    overflow: hidden !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    margin: 5px !important;
}

#egw-settings-btn:hover {
    background: #6c757d !important; /* Gray color */
    box-shadow: 0 6px 20px var(--mcw-romantic-hover-shadow) !important;
    transform: translateY(-2px) !important;
}

#egw-settings-btn .fas {
    margin: 0 !important;
    font-size: 18px !important;
    transition: transform 0.3s ease !important;
}

#egw-settings-btn:hover .fas {
    transform: rotate(180deg) !important;
}

#egw-settings-btn .fas.rotating {
    transform: rotate(180deg) !important;
}



/* Modal Close Icon */
.egw-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    background: #6c757d;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1;
}

.egw-modal-close:hover {
    background: var(--mcw-romantic-red);
    transform: scale(1.1);
}

.egw-modal-close i {
    color: white;
    font-size: 14px;
}



.egw-settings-buttons button {
    width: auto !important;
    min-width: 150px !important;
    flex: 1;
}

/* Ensure settings modal is above everything */
#egw-settings-modal {
    z-index: 10001 !important;
}

/* Itinerary Event Margin */
.egw-itinerary-event {
    margin: 0;
    padding: 15px;
    background: white;
    border-radius: 10px;
    transition: all 0.3s ease;
    direction: ltr;
}
