/* ==========================================================================
   1. HUVUDLAYOUT & BEHÅLLARE
   ========================================================================== */
.unas-calendar-container { 
    display: flex; flex-direction: row; gap: 15px; font-family: "Poppins", sans-serif; 
    max-width: 100%; margin: 10px 0; height: 100vh; 
}
.unas-calendar-wrapper .fc-daygrid-event-dot { display: none !important; }
.unas-calendar-wrapper .fc-daygrid-dot-event .fc-event-time { margin-left: 4px !important; }
.unas-calendar-wrapper { 
    flex: var(--unas-calendar-flex-ratio, 8); min-width: 0; background: #fff; 
    border-radius: 15px; box-shadow: 0 4px 16px rgba(0,0,0,0.05); overflow: visible; display: flex; flex-direction: column; 
}
.unas-calendar-wrapper .fc { flex-grow: 1; }
.sljare-wrapper { 
    flex: 2; min-width: 0; display: flex; flex-direction: column; background: #fff; 
    border-radius: 15px; box-shadow: 0 4px 16px rgba(0,0,0,0.05); overflow: hidden; font-family: "Poppins", sans-serif; 
}

/* ==========================================================================
   2. SÄLJARLISTAN (HÖGRA SPALTEN)
   ========================================================================== */
.sljare-list-header { font-size: 16px; font-weight: 500; color: #2c3e50; padding: 20px; background: #f8f9fa; border-bottom: 1px solid #e9ecef; margin: 0; }
.sljare-list { list-style: none; margin: 0; padding: 10px; overflow-y: auto; flex-grow: 1; }
.sljare-box { padding: 18px; background: #f7fafc; border: 2px dashed #e2e8f0; border-radius: 15px; margin-bottom: 15px; transition: all 0.3s ease; }
.sljare-box.drag-over-active { border-color: #667eea; }
.sljare-box.drag-over { background: #e0e7ff; border-color: #667eea; transform: scale(1.03); }
.sljare-box h4 { margin: 0 0 10px 0; font-size: 14px; color: #2d3748; font-weight: 500; }
.sljare-box .assigned-event { background: #e57373; color: white; padding: 5px 10px; border-radius: 4px; margin-top: 10px; font-size: 10px; text-align: center; animation: fadeIn 0.5s; }
.sljare-counters { display: flex; justify-content: space-between; gap: 5px; background: #eef2f7; padding: 8px 12px; border-radius: 15px; margin: 0 0 10px 0; }
.sljare-counters span { font-size: 12px; color: #4a5568; font-weight: 500; }
.sljare-counters strong { font-weight: 700; color: #2d3748; }

/* ==========================================================================
   3. SÄLJARENS DAGSAGENDA (ACCORDION & MÖTEN)
   ========================================================================== */
.sljare-day-schedule-wrapper { padding: 0 10px 10px 10px; border-top: 1px solid #e9ecef; margin-top: 10px; background-color: #f8f9fa; border-radius: 15px; }
.sljare-day-schedule-wrapper h5.schedule-accordion-trigger { font-size: 14px; font-weight: 600; color: #4a5568; margin: 10px 0 0 0; padding: 8px 10px; cursor: pointer; display: flex; justify-content: flex-start; align-items: center; user-select: none; border-radius: 15px; transition: all 0.2s ease; }
.sljare-day-schedule-wrapper h5.schedule-accordion-trigger:hover { background-color: #eef2f7; color: #2d3748; }
.schedule-accordion-trigger .accordion-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-grow: 1; }
.schedule-accordion-trigger .accordion-icon { font-size: 15px; font-weight: 400; transition: transform 0.2s ease; line-height: 1; flex-shrink: 0; padding-left: 8px; margin-left: auto; }
.schedule-accordion-trigger.active .accordion-icon { transform: rotate(45deg); }
.schedule-accordion-content { padding: 5px 10px 0 10px; }
.sljare-day-schedule { list-style: none; padding: 0; margin: 0; }
.sljare-day-schedule .schedule-item { background: #eef2f7; color: #334155; padding: 6px 10px; border-radius: 6px; margin-bottom: 5px; font-size: 12px; display: flex; justify-content: center; align-items: center; border-left: 3px solid #667eea; }
.sljare-day-schedule .schedule-item-time { font-weight: 600; }
.sljare-day-schedule .no-meetings { font-size: 10px; color: #718096; text-align: center; padding: 10px; }

/* ==========================================================================
   4. KALENDERNS GRUNDUTSEENDE (TOPP, KNAPPAR & DAGAR)
   ========================================================================== */
.unas-calendar-wrapper .fc-toolbar { padding: 20px; background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%); border-bottom: 1px solid #e9ecef; border-top-left-radius: 15px; border-top-right-radius: 15px; }
.unas-calendar-wrapper .fc-toolbar-title { font-size: 18px; font-weight: 600; color: #2c3e50; text-transform: capitalize; }
.unas-calendar-wrapper .fc-button { background: #667eea; border: none; color: white; padding: 10px 20px; border-radius: 15px; font-weight: 500; transition: all 0.1s ease; text-transform: none; font-size: 12px; }
.unas-calendar-wrapper .fc-button:hover { background: #5a67d8; box-shadow: 0 2px 4px rgba(102, 126, 234, 0.15); }
.unas-calendar-wrapper .fc-button-active { background: #5a67d8 !important; box-shadow: inset 0 1px 2px rgba(0,0,0,0.1); }
.unas-calendar-wrapper .fc-button:focus { box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2); }
.unas-calendar-wrapper .fc-day-today { background: #f0f9ff !important; }
.unas-calendar-wrapper .fc-day-today .fc-daygrid-day-number { background: #667eea; color: white; }
.unas-calendar-wrapper .fc-daygrid-day-number { color: black; font-weight: 400; font-size: 14px; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 50%; margin: 4px; text-decoration: none !important; }
.unas-calendar-wrapper .fc-daygrid-day-number:hover { background: #667eea; color: white; }
.unas-calendar-wrapper .fc-day-sat, .unas-calendar-wrapper .fc-day-sun { background: #f8fafc; }
.unas-calendar-wrapper .fc-day.holiday { background: #fef3c7 !important; position: relative; }
.unas-calendar-wrapper .fc-day.holiday::before { content: attr(data-holiday); position: absolute; top: 2px; left: 2px; font-size: 10px; color: #d97706; background: rgba(255, 255, 255, 0.9); padding: 2px 6px; border-radius: 4px; pointer-events: none; max-width: calc(100% - 40px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.unas-calendar-wrapper .fc-daygrid-dot-event .fc-event-title, .unas-calendar-wrapper .fc-daygrid-dot-event .fc-event-time { font-weight: 400 !important; font-size: 10px; }
.unas-calendar-wrapper .fc-col-header-cell-cushion, .unas-calendar-wrapper .fc-timegrid-axis-cushion { font-family: "Poppins", sans-serif; font-size: 12px !important; font-weight: 500 !important; color: #2c3e50 !important; text-transform: capitalize; text-decoration: none !important; padding: 8px 4px; }
.unas-calendar-wrapper .fc-col-header-cell-cushion:hover { color: #667eea !important; }

/* ==========================================================================
   5. KALENDER-KORTEN (LEADS & EVENTS) OCH DERAS FÄRGER
   ========================================================================== */
.unas-calendar-wrapper .fc-event { background: #F56565 !important; border: 1px solid #E53E3E !important; cursor: pointer !important; padding: 4px 8px; border-radius: 15px; font-size: 10px; font-weight: 400; color: white !important; box-shadow: 0 2px 4px rgba(0,0,0,0.1); transition: all 0.2s ease; margin-top: 2px; }
.unas-calendar-wrapper .fc-event:hover {  transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,0.08); }
.unas-calendar-wrapper .fc-daygrid-event { white-space: normal; }
.unas-calendar-wrapper .fc-event-time { font-weight: 400; margin-right: 4px; }
.unas-calendar-wrapper .fc-event.draggable { cursor: move !important; }
.unas-calendar-wrapper .fc-event-dragging { width: 250px !important; box-shadow: 0 8px 25px rgba(0,0,0,0.2) !important; z-index: 1000000 !important; }
.unas-calendar-wrapper .fc-event.bokare-owner { background: #48BB78 !important; border-color: #38A169 !important; }
.unas-calendar-wrapper .fc-event.not-owner { cursor: not-allowed !important; }
.unas-calendar-wrapper .fc-event.guldlead-event { background: linear-gradient(135deg, #FDE68A 0%, #FBBF24 100%) !important; border: 1px solid #FBBF24 !important; }
.unas-calendar-wrapper a.fc-event.guldlead-event, .unas-calendar-wrapper .fc-event.guldlead-event .fc-event-title { color: #000000 !important; }
.unas-calendar-wrapper .fc-event.extension-event { background: #8B5CF6 !important; color: #FFFFFF !important; border: 1px solid #2B6CB0 !important; }
.unas-calendar-wrapper .fc-event.special-bokare-event { background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%) !important; color: #FFFFFF !important; border: 1px solid #1D4ED8 !important; }

/* ==========================================================================
   6. "+X TILL" (NATIV POPOVER & PERFEKT CENTRERAT KRYSS)
   ========================================================================== */
.fc-popover.fc-more-popover {
    z-index: 99998 !important; 
    border-radius: 12px !important; 
    border: 1px solid #e9ecef !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15) !important; 
    overflow: hidden !important;
}

/* Tvingar header att vara en flexbox för att rubrik och kryss ska linjera exakt */
.fc-popover.fc-more-popover .fc-popover-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 12px 16px !important;
    background: #f8f9fa !important;
}

.fc-popover.fc-more-popover .fc-popover-title {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #2c3e50 !important;
    margin: 0 !important;
    line-height: 1 !important;
}

.fc-popover.fc-more-popover .fc-popover-body {
    max-height: 400px !important; 
    overflow-y: auto !important; 
    padding: 10px !important;
}

.fc-popover.fc-more-popover .fc-popover-close {
    cursor: pointer !important;
    opacity: 0.6;
    transition: opacity 0.2s;
    margin: 0 !important; 
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 16px !important;
    line-height: 1 !important;
}
.fc-popover.fc-more-popover .fc-popover-close:hover {
    opacity: 1;
}

/* ==========================================================================
   7. POPUP MODAL (DETALJER OM KUNDEN NÄR MAN KLICKAR - DESKTOP & BOKARE)
   ========================================================================== */
.unas-event-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 99999 !important; backdrop-filter: blur(4px); }
.unas-event-editor { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #ffffff; border-radius: 16px; box-shadow: 0 20px 40px rgba(0,0,0,0.15); z-index: 100000 !important; width: 700px; max-width: 90%; max-height: 85vh; font-family: "Poppins", sans-serif; display: flex; flex-direction: column; overflow: hidden; }
.unas-editor-header { display: flex; justify-content: space-between; align-items: center; padding: 24px 32px; border-bottom: 1px solid #e9ecef; flex-shrink: 0; }
.unas-editor-header h3 { margin: 0; font-size: 22px; font-weight: 600; color: #2c3e50; line-height: 1.3; }
.guldlead-badge { background: linear-gradient(135deg, #FDE68A 0%, #FBBF24 100%); border: 1px solid #FBBF24; color: #000000; font-size: 10px; font-weight: 400; padding: 4px 10px; border-radius: 6px; flex-shrink: 0; margin-left: 16px; }
.unas-editor-content { padding: 24px 32px; overflow-y: auto; background-color: #f8f9fa; }
.info-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin-bottom: 24px; }
.info-address-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 16px; }
.info-group-full { margin-bottom: 24px; }
.info-group h4, .info-group-full h4, .info-field-full strong { font-size: 14px; font-weight: 600; color: #4a5568; margin: 0 0 16px 0; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid #e2e8f0; padding-bottom: 8px; }
.info-field { margin-bottom: 16px; }
.info-field strong { display: block; color: #718096; font-size: 12px; font-weight: 500; margin-bottom: 4px; }
.info-field .info-value { color: #2d3748; font-size: 15px; font-weight: 500; }
.info-field-full strong { margin-bottom: 12px !important; }
.info-field-full .info-value-block { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 12px 16px; color: #334155; font-size: 14px; line-height: 1.6; }
.info-field-full .info-value-block p { margin: 0 0 12px 0; }
.info-field-full .info-value-block p:last-child { margin-bottom: 0; }
.button-group { display: flex; gap: 12px; padding: 24px 32px; border-top: 1px solid #e9ecef; background: #ffffff; flex-shrink: 0; }
.button-group a, .button-group button { flex-grow: 1; border: none; padding: 12px 24px; border-radius: 8px; cursor: pointer; font-weight: 500; font-size: 14px; transition: all 0.2s ease; text-align: center; text-decoration: none; }
.button-group .view-kundkort-btn { background: #3182ce; color: white; }
.button-group .view-kundkort-btn:hover { background: #2b6cb0; }
.button-group .close-editor-btn { background: #e2e8f0; color: #4a5568; }
.button-group .close-editor-btn:hover { background: #cbd5e0; }

/* ==========================================================================
   8. MOBIL-TILLDELNINGS-MODAL (ENDAST PÅ MOBIL OCH FÖR ADMINS)
   ========================================================================== */
.unas-mobile-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); z-index: 100001 !important; backdrop-filter: blur(4px); }
.unas-mobile-assigner { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; z-index: 100002 !important; border-top-left-radius: 20px; border-top-right-radius: 20px; box-shadow: 0 -10px 30px rgba(0,0,0,0.15); padding: 20px; animation: slideUp 0.3s ease-out; font-family: "Poppins", sans-serif; max-height: 60vh; overflow-y: auto; }
.unas-mobile-assigner h3 { margin: 0 0 15px 0; font-size: 20px; font-weight: 600; color: #2c3e50; text-align: center; }
.unas-mobile-assigner .assigner-lead-title { font-size: 14px; text-align: center; color: #718096; margin-bottom: 20px; }
.sljare-assign-list { list-style: none; padding: 0; margin: 0; }
.sljare-assign-list li { background: #f8f9fa; border: 1px solid #e9ecef; padding: 15px 20px; border-radius: 10px; margin-bottom: 10px; font-size: 16px; cursor: pointer; transition: all 0.2s ease; display: flex; justify-content: space-between; align-items: center; }
.sljare-assign-list li:hover, .sljare-assign-list li:active { background: #667eea; border-color: #5a67d8; transform: scale(1.02); }
.sljare-assign-name { font-weight: 500; color: #2d3748; flex-grow: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 10px; }
.sljare-assign-counts { font-size: 13px; color: #4a5568; flex-shrink: 0; white-space: nowrap; }
.sljare-assign-counts strong { color: #2d3748; font-weight: 700; }
.sljare-assign-list li:hover .sljare-assign-name, .sljare-assign-list li:hover .sljare-assign-counts, .sljare-assign-list li:hover .sljare-assign-counts strong, .sljare-assign-list li:active .sljare-assign-name, .sljare-assign-list li:active .sljare-assign-counts, .sljare-assign-list li:active .sljare-assign-counts strong { color: white; }
.unas-mobile-assigner .cancel-btn { background: #f56565; color: white; text-align: center; padding: 15px; border-radius: 10px; margin-top: 15px; cursor: pointer; font-weight: 500; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ==========================================================================
   9. HOVER TOOLTIP (Den vita informationsboxen vid muspekaren)
   ========================================================================== */
.unas-hover-tooltip { position: absolute; z-index: 100000; background: #ffffff; border: 1px solid #e2e8f0; box-shadow: 0 4px 20px rgba(0,0,0,0.15); border-radius: 8px; padding: 12px; width: 260px; font-family: "Poppins", sans-serif; pointer-events: none; animation: fadeIn 0.2s ease-in-out; }
.unas-hover-tooltip .tooltip-header { border-bottom: 1px solid #edf2f7; padding-bottom: 8px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.unas-hover-tooltip .tooltip-header strong { font-size: 14px; color: #2d3748; font-weight: 600; }
.unas-hover-tooltip .tooltip-header .tooltip-time { font-size: 12px; color: #718096; background: #edf2f7; padding: 2px 6px; border-radius: 4px; }
.unas-hover-tooltip .tooltip-body { font-size: 12px; color: #4a5568; }
.unas-hover-tooltip .tooltip-row { margin-bottom: 4px; line-height: 1.4; }
.unas-hover-tooltip .tooltip-desc { margin-top: 8px; font-style: italic; color: #718096; border-top: 1px dashed #e2e8f0; padding-top: 6px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ==========================================================================
   10. SMÅ NOTIFIKATIONER (T.ex. "Tilldelning lyckades")
   ========================================================================== */
.unas-notification { position: fixed; top: 24px; right: 24px; padding: 16px 24px; background: #48bb78; color: white; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.15); z-index: 10000; animation: slideInRight 0.3s ease; font-family: "Poppins", sans-serif; font-weight: 500; }
.unas-notification.info { background: #4299e1; }
.unas-notification.error { background: #f56565; }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ==========================================================================
   11. RESPONSIVITET / MOBIL- OCH TABLETANPASSNING
   ========================================================================== */
@media (max-width: 1200px) { 
    .unas-calendar-container { flex-direction: column; height: 85vh !important; min-height: 600px !important; }
    .unas-calendar-container .sljare-wrapper { display: none !important; }
}

@media (max-width: 768px) {
    .info-columns { grid-template-columns: 1fr; gap: 0; }
    .info-address-grid { grid-template-columns: 1fr; gap: 16px; }
    .unas-editor-header, .unas-editor-content, .button-group { padding: 16px 20px; }
    .unas-calendar-wrapper .fc-event { padding: 2px 4px !important; margin-top: 1px !important; line-height: 1.2 !important; white-space: nowrap !important; overflow: hidden !important; }
    .unas-calendar-wrapper .fc-daygrid-event { white-space: nowrap !important; }
    .unas-calendar-wrapper .fc-daygrid-week-number { font-size: 10px; padding: 2px; }
    .unas-calendar-wrapper .fc-daygrid-day-number { font-size: 10px; font-weight: 400; width: 24px; height: 24px; margin: 2px; line-height: 24px; }
    .unas-calendar-wrapper .fc-day-today .fc-daygrid-day-number { width: 24px; height: 24px; line-height: 24px; }
    .unas-calendar-wrapper .fc-toolbar-title { font-size: 18px; }
    .unas-calendar-wrapper .fc-button { font-size: 12px; padding: 6px 10px; }
}

/* ==========================================================================
   12. CUSTOM SCROLLBAR (Tunn, ljus och smidig)
   ========================================================================== */
/* Gör scrollningen mjuk överallt i vår kalendermiljö */
.unas-calendar-container *,
.unas-event-editor *,
.unas-mobile-assigner *,
.fc-popover * {
    scroll-behavior: smooth;
}

/* För Chrome, Edge och Safari */
.unas-calendar-container ::-webkit-scrollbar,
.unas-event-editor ::-webkit-scrollbar,
.unas-mobile-assigner ::-webkit-scrollbar,
.fc-popover ::-webkit-scrollbar {
    width: 6px; /* Tunn vertikal scrollbar */
    height: 6px; /* Tunn horisontell scrollbar */
}

.unas-calendar-container ::-webkit-scrollbar-track,
.unas-event-editor ::-webkit-scrollbar-track,
.unas-mobile-assigner ::-webkit-scrollbar-track,
.fc-popover ::-webkit-scrollbar-track {
    background: transparent; /* Osynligt spår för en renare känsla */
    border-radius: 10px;
}

.unas-calendar-container ::-webkit-scrollbar-thumb,
.unas-event-editor ::-webkit-scrollbar-thumb,
.unas-mobile-assigner ::-webkit-scrollbar-thumb,
.fc-popover ::-webkit-scrollbar-thumb {
    background: #cbd5e1; /* Ljusgrå och snygg */
    border-radius: 10px;
}

.unas-calendar-container ::-webkit-scrollbar-thumb:hover,
.unas-event-editor ::-webkit-scrollbar-thumb:hover,
.unas-mobile-assigner ::-webkit-scrollbar-thumb:hover,
.fc-popover ::-webkit-scrollbar-thumb:hover {
    background: #94a3b8; /* Lite mörkare när man hovrar över den */
}

/* För Firefox (De stöder endast width och color) */
.unas-calendar-container,
.unas-calendar-container *,
.unas-event-editor,
.unas-event-editor *,
.unas-mobile-assigner,
.unas-mobile-assigner *,
.fc-popover,
.fc-popover * {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}