/* ====================================================
   ICAWiki App Launcher — Fixed Right Sidebar
   ==================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Sidebar container ── */
#ical-sidebar {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    z-index: 99999;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    transition: transform 0.3s ease;
}

/* ── Toggle tab (left side of sidebar) ── */
#ical-sidebar-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 20px;
    background: linear-gradient(180deg, #4f46e5, #7c3aed);
    border-radius: 10px 0 0 10px;
    cursor: pointer;
    padding: 14px 0;
    box-shadow: -3px 0 12px rgba(79,70,229,0.3);
    transition: width 0.2s;
    flex-shrink: 0;
    user-select: none;
}

#ical-sidebar-toggle:hover {
    width: 24px;
}

#ical-sidebar-toggle-icon {
    color: #fff;
    font-size: 13px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    letter-spacing: 1.5px;
    font-weight: 700;
    opacity: 0.9;
    transform: rotate(180deg);
}

/* ── Sidebar panel ── */
#ical-sidebar-panel {
    background: #ffffff;
    border-left: 1px solid #e5e7eb;
    box-shadow: -4px 0 24px rgba(0,0,0,0.12);
    width: 72px;
    max-height: 80vh;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0;
    gap: 4px;
    transition: width 0.3s cubic-bezier(0.4,0,0.2,1), opacity 0.3s ease;
    scrollbar-width: none;
}

#ical-sidebar-panel::-webkit-scrollbar { display: none; }

/* Collapsed state */
#ical-sidebar.ical-sidebar-collapsed #ical-sidebar-panel {
    width: 0;
    opacity: 0;
    padding: 0;
    overflow: hidden;
}

/* ── Group divider ── */
.ical-sb-group-label {
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #94a3b8;
    padding: 6px 4px 2px;
    text-align: center;
    width: 100%;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ical-sb-divider {
    width: 40px;
    height: 1px;
    background: #e5e7eb;
    margin: 2px auto;
    flex-shrink: 0;
}

/* ── App icon button ── */
.ical-sb-app {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 52px;
    padding: 6px 4px;
    border-radius: 10px;
    text-decoration: none !important;
    color: #1e293b;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
    position: relative;
    flex-shrink: 0;
    gap: 3px;
}

.ical-sb-app:hover {
    background: #f1f5f9;
    transform: scale(1.08);
    text-decoration: none !important;
    color: #1e293b;
}

.ical-sb-app:active {
    transform: scale(0.95);
}

/* Icon circle */
.ical-sb-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.ical-sb-icon img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    display: block;
}

.ical-sb-icon .ical-sb-emoji {
    font-size: 18px;
    line-height: 1;
}

/* App name below icon */
.ical-sb-name {
    font-size: 9px;
    font-weight: 600;
    color: #475569;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 52px;
    line-height: 1.1;
}

/* ── Tooltip on hover ── */
.ical-sb-app::before {
    content: attr(data-name);
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: #1e293b;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 7px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.ical-sb-app::after {
    content: '';
    position: absolute;
    right: calc(100% + 4px);
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-left-color: #1e293b;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s;
}

.ical-sb-app:hover::before,
.ical-sb-app:hover::after {
    opacity: 1;
}

/* ── WordPress admin bar offset ── */
.admin-bar #ical-sidebar {
    top: calc(50% + 16px);
}

/* ── Mobile: hide on small screens ── */
@media (max-width: 640px) {
    #ical-sidebar { display: none; }
}
