/* GEOLMS UI Toolkit – toasts, modals, skeletons, infinite scroll, search, drag-drop */

/* ── Toast ── */
.geo-toast-container {
    position: fixed;
    z-index: 10050;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(400px, calc(100vw - 32px));
    pointer-events: none;
}
.geo-toast-container[data-position="top-right"] { top: 20px; right: 20px; }
.geo-toast-container[data-position="top-left"] { top: 20px; left: 20px; }
.geo-toast-container[data-position="bottom-right"] { bottom: 20px; right: 20px; flex-direction: column-reverse; }
.geo-toast-container[data-position="bottom-left"] { bottom: 20px; left: 20px; flex-direction: column-reverse; }
.geo-toast-container[data-position="top-center"] { top: 20px; left: 50%; transform: translateX(-50%); align-items: center; }
.geo-toast-container[data-position="bottom-center"] { bottom: 20px; left: 50%; transform: translateX(-50%); flex-direction: column-reverse; align-items: center; }

.geo-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--card, #fff);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    border-left: 4px solid;
    font-size: 14px;
    line-height: 1.45;
    animation: geoToastIn 0.3s ease-out;
    color: var(--foreground, #3d3436);
}
.geo-toast.geo-toast-out { animation: geoToastOut 0.25s ease-in forwards; }
.geo-toast.success { border-left-color: #28a745; }
.geo-toast.error { border-left-color: #e63946; }
.geo-toast.warning { border-left-color: #feb47b; }
.geo-toast.info { border-left-color: var(--primary, #ff7e5f); }
.geo-toast-icon { flex-shrink: 0; font-size: 16px; line-height: 1.4; }
.geo-toast-body { flex: 1; min-width: 0; word-break: break-word; }
.geo-toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: var(--muted-foreground, #78716c);
    padding: 0 2px;
    opacity: 0.7;
}
.geo-toast-close:hover { opacity: 1; }

@keyframes geoToastIn {
    from { opacity: 0; transform: translateX(24px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes geoToastOut {
    to { opacity: 0; transform: translateX(24px); }
}

/* ── Modal enhancements ── */
body.geo-modal-open { overflow: hidden; }
.modal.geo-modal-enhanced,
.geo-modal-overlay {
    opacity: 0;
    transition: opacity 0.25s ease;
}
.modal.geo-modal-enhanced.active,
.geo-modal-overlay.geo-modal-visible {
    opacity: 1;
}
.modal.geo-modal-enhanced .modal-content,
.geo-modal-overlay .geo-modal-panel {
    transform: scale(0.96) translateY(8px);
    transition: transform 0.25s ease;
}
.modal.geo-modal-enhanced.active .modal-content,
.geo-modal-overlay.geo-modal-visible .geo-modal-panel {
    transform: scale(1) translateY(0);
}

/* ── Skeletons (shimmer placeholders until data loads) ── */
.geo-skeleton-wrap { position: relative; }

.geo-skeleton {
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, #eef2f7 0%, #f8fafc 45%, #eef2f7 90%);
    background-size: 200% 100%;
    animation: geoShimmer 1.4s ease-in-out infinite;
    border-radius: 8px;
}

.geo-skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.72), transparent);
    animation: geoShimmerSweep 1.4s ease-in-out infinite;
}

.geo-skeleton-card {
    padding: 16px;
    background: var(--card, #fff);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-bottom: 12px;
}

.geo-skeleton-line { height: 14px; margin-bottom: 10px; }
.geo-skeleton-line.short { width: 40%; }
.geo-skeleton-line.medium { width: 65%; }
.geo-skeleton-line.long { width: 90%; }

.geo-skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
}

.geo-skeleton-avatar-md {
    width: 72px;
    height: 72px;
    margin: 0 auto 12px;
}

.geo-skeleton-avatar-lg {
    width: 88px;
    height: 88px;
}

.geo-skeleton-row { display: flex; gap: 12px; align-items: center; }

.geo-skeleton-pill {
    width: 88px;
    height: 24px;
    border-radius: 999px;
    flex-shrink: 0;
}

.geo-skeleton-btn {
    height: 34px;
    width: 72px;
    border-radius: 8px;
    margin: 12px auto 0;
}

.geo-skeleton-block {
    height: 120px;
    border-radius: 10px;
    margin-top: 8px;
}

.geo-skeleton-section-title {
    height: 16px;
    width: 180px;
    border-radius: 6px;
    margin: 20px 0 14px;
}

/* Profile page / employee details modal */
.geo-skeleton-profile {
    padding: 8px 4px 16px;
}

.geo-skeleton-profile-header {
    display: flex;
    gap: 18px;
    align-items: center;
    margin-bottom: 24px;
}

.geo-skeleton-profile-meta {
    flex: 1;
    min-width: 0;
}

.geo-skeleton-fields-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.geo-skeleton-field .geo-skeleton-line:last-child {
    margin-bottom: 0;
}

/* Employee cards grid */
.geo-skeleton-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
}

.geo-skeleton-employee-card {
    aspect-ratio: 1;
    padding: 14px 12px;
    border-radius: 12px;
    background: var(--card, #fff);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

/* Leave history / list cards */
.geo-skeleton-history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.geo-skeleton-history-card {
    padding: 16px;
    border-radius: 12px;
    background: var(--card, #fff);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Compact rows: notifications, change history */
.geo-skeleton-inline-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.geo-skeleton-inline-row {
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--card, #fff);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.geo-skeleton-inline-row .geo-skeleton-line:last-child {
    margin-bottom: 0;
}

@media (max-width: 1200px) {
    .geo-skeleton-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .geo-skeleton-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .geo-skeleton-fields-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .geo-skeleton-grid {
        grid-template-columns: 1fr;
    }

    .geo-skeleton-profile-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@keyframes geoShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes geoShimmerSweep {
    100% { transform: translateX(100%); }
}

/* ── Infinite scroll ── */
.geo-infinite-sentinel { height: 1px; }
.geo-infinite-status {
    text-align: center;
    padding: 16px;
    color: var(--muted-foreground, #78716c);
    font-size: 14px;
}
.geo-infinite-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border, #ffe0d6);
    border-top-color: var(--primary, #ff7e5f);
    border-radius: 50%;
    animation: geoSpin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}
.geo-infinite-error {
    color: var(--destructive, #e63946);
}
.geo-infinite-end { color: var(--muted-foreground, #78716c); font-style: italic; }

@keyframes geoSpin {
    to { transform: rotate(360deg); }
}

/* ── Debounced search ── */
.geo-search-wrap { position: relative; }
.geo-search-loading {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: 2px solid var(--border, #ffe0d6);
    border-top-color: var(--primary, #ff7e5f);
    border-radius: 50%;
    animation: geoSpin 0.7s linear infinite;
    display: none;
}
.geo-search-wrap.is-loading .geo-search-loading { display: block; }
.geo-search-empty {
    text-align: center;
    padding: 24px;
    color: var(--muted-foreground, #78716c);
}
.geo-highlight {
    background: rgba(255, 126, 95, 0.25);
    border-radius: 2px;
    font-weight: 600;
}

/* ── Drag & drop ── */
.geo-draggable-list { list-style: none; padding: 0; margin: 0; }
.geo-draggable-item {
    cursor: grab;
    touch-action: none;
    transition: box-shadow 0.2s, transform 0.2s;
    user-select: none;
}
.geo-draggable-item:active { cursor: grabbing; }
.geo-draggable-item.geo-dragging {
    opacity: 0.85;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    transform: scale(1.02);
    z-index: 10;
    cursor: grabbing;
}
.geo-draggable-item.geo-drag-over {
    outline: 2px dashed var(--primary, #ff7e5f);
    outline-offset: 2px;
}
.geo-drag-handle {
    display: inline-flex;
    align-items: center;
    color: var(--muted-foreground, #999);
    margin-right: 8px;
    font-size: 18px;
    line-height: 1;
}
.geo-drag-handle::before { content: "⋮⋮"; letter-spacing: -2px; }

@media (max-width: 768px) {
    .geo-toast-container[data-position="top-right"],
    .geo-toast-container[data-position="bottom-right"] {
        right: 12px;
        left: 12px;
        max-width: none;
    }
}
