﻿/* ============================================================
   IDENTITY MODAL — Compact Enterprise Glass Panel
   ============================================================ */

/* Overlay */
.identity-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.40);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    visibility: hidden;
    opacity: 0;
    z-index: 999999;
    transition: opacity .18s ease, visibility .18s ease;
}

    .identity-modal-overlay.show {
        visibility: visible;
        opacity: 1;
    }

/* Panel */
.identity-modal {
    position: absolute;
    top: 0;
    right: 1%;
    height: max-content;
    width: min(320px, 92vw);
    /* Local tokens */
    --id-surface: rgba(255, 255, 255, 0.92);
    --id-border-subtle: rgba(15, 23, 42, 0.08);
    --id-border-strong: rgba(15, 23, 42, 0.16);
    --id-shadow: -10px 0 32px rgba(15, 23, 42, 0.20);
    --id-text: #0f172a;
    --id-muted: #6b7280;
    --id-soft: #f3f4f6;
    --id-accent: #2563eb;
    background: var(--id-surface);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    border-left: 1px solid rgba(255,255,255,0.6);
    box-shadow: var(--id-shadow);
    transform: translateX(100%);
    transition: transform .22s ease;
    padding: 0.9rem 1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    color: var(--id-text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.9rem;
}

.identity-modal-overlay.show .identity-modal {
    transform: translateX(0);
}

/* Top panel header */
.identity-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.55rem;
}

.identity-panel-title {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--id-text);
}

    .identity-panel-title i {
        font-size: 1rem;
        color: var(--id-accent);
    }

/* Close */
.identity-close-btn {
    background: rgba(255,255,255,0.9);
    border: 1px solid var(--id-border-subtle);
    border-radius: 999px;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .16s ease, transform .12s ease, box-shadow .16s ease;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

    .identity-close-btn i {
        font-size: 0.9rem;
        color: var(--id-muted);
    }

    .identity-close-btn:hover {
        color: #444;
        background: #ffffff;
        transform: translateY(-1px);
        box-shadow: 0 3px 10px rgba(15, 23, 42, 0.18);
    }

/* Profile header */
.identity-header {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 0.75rem;
    row-gap: 0.25rem;
    padding-top: 0.7rem;
}

.identity-avatar {
    width: 60px;
    height: 60px;
    border-radius: 999px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .identity-avatar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.identity-avatar-initials {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--id-text);
}

.identity-info {
    flex: 1;
    min-width: 0;
}

    .identity-info .identity-name {
        font-size: 1.05rem;
        font-weight: 700;
        color: var(--id-text);
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .identity-info .identity-role {
        font-size: 0.9rem;
        font-weight: 600;
        color: #475569;
        margin: 0.05rem 0 0.05rem;
    }

    .identity-info .identity-email {
        font-size: 0.9rem;
        color: var(--id-muted);
        margin: 0;
        display: inline-flex;
        align-items: center;
        gap: 0.45rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* If you also have .identity-phone, it will match */
    .identity-info .identity-phone {
        font-size: 0.9rem;
        color: var(--id-muted);
        margin: 0;
        display: inline-flex;
        align-items: center;
        gap: 0.25rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

/* Meta line */
.identity-meta {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 1rem;
    font-size: 0.8rem;
    color: #475569;
    line-height: 1.4;
    margin-top: 0.25rem;
    background: #fff;
    border-radius: 12px;
}

    .identity-meta i {
        margin-top: 1px;
        font-size: 0.85rem;
        color: var(--id-muted);
    }

    .identity-meta span {
        flex: 1;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

/* Identity Details Section */
.identity-details {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.6rem 0;
    font-size: 0.82rem;
}

.identity-detail-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #475569;
}

    .identity-detail-item i {
        width: 18px;
        text-align: center;
        color: var(--id-muted);
        font-size: 0.9rem;
    }

    .identity-detail-item span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

/* Actions */
.identity-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-top: 0.55rem;
}

.identity-logout-form {
    margin: 0;
    padding: 0;
}

.identity-action-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 0.85rem;
    border-radius: 10px;
    background: rgba(255,255,255,0.96);
    border: 1px solid var(--id-border-subtle);
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--id-text);
    text-decoration: none;
    cursor: pointer;
    transition: background .14s ease, transform .1s ease, border-color .14s ease, box-shadow .14s ease;
    width: 100%;
    text-align: left;
}

    .identity-action-btn i {
        width: 18px;
        text-align: center;
        font-size: 0.95rem;
        color: var(--id-muted);
    }

    .identity-action-btn:hover {
        background: var(--id-soft);
        transform: translateY(-1px);
        border-color: var(--id-border-strong);
        box-shadow: 0 3px 10px rgba(15, 23, 42, 0.15);
        color: #444;
    }

    /* PWA install row (accent) */
    .identity-action-btn.pwa-install {
        border-color: rgba(37, 99, 235, 0.4);
        background: linear-gradient(135deg, rgba(219, 234, 254, 0.9) 0%, rgba(191, 219, 254, 0.9) 100%);
    }

        .identity-action-btn.pwa-install i {
            color: var(--id-accent);
        }

        .identity-action-btn.pwa-install:hover {
            background: linear-gradient(135deg, rgba(219, 234, 254, 1) 0%, rgba(191, 219, 254, 1) 100%);
            border-color: rgba(37, 99, 235, 0.6);
        }

    /* Danger (logout) */
    .identity-action-btn.danger {
        background: rgba(239, 68, 68, 0.06);
        border-color: rgba(239, 68, 68, 0.45);
        color: #b91c1c;
    }

        .identity-action-btn.danger i {
            color: #b91c1c;
        }

        .identity-action-btn.danger:hover {
            background: rgba(239, 68, 68, 0.14);
        }

/* Mobile: full-width right sheet */
@media (max-width: 640px) {
    .identity-modal {
        width: 100vw;
        border-left: none;
        box-shadow: none;
        padding-inline: 0.85rem;
    }

    .identity-header {
        column-gap: 0.65rem;
    }
}

/* Extra-tight on very small screens */
@media (max-width: 480px) {
    .identity-modal {
        padding: 0.8rem 0.8rem 1rem;
    }

    .identity-avatar {
        width: 52px;
        height: 52px;
    }

    .identity-info .identity-name {
        font-size: 1rem;
    }
}

/* ======================================================
   MODAL SAFETY LAYER — Prevent invisible blocking
   ====================================================== */
#identityModal:not(.show) {
    pointer-events: none !important;
}

#identityModal.show {
    pointer-events: auto !important;
}

/* Icon styling for contact lines (keeps your original intent) */
.identity-email i {
    font-size: 0.75rem;
    margin-right: 0.25rem;
    color: #64748b;
}

/* ============================================================
   PWA INSTALLATION INSTRUCTION MODAL
   ============================================================ */

/* Overlay for instruction modal */
.pwa-instruction-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.50);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000000;
    opacity: 0;
    transition: opacity 0.2s ease;
    padding: 1rem;
}

    .pwa-instruction-overlay.show {
        opacity: 1;
    }

/* Modal container */
.pwa-instruction-modal {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.3);
    max-width: 420px;
    width: 100%;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Header */
.pwa-instruction-header {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
}

    .pwa-instruction-header i:first-child {
        font-size: 1.5rem;
    }

    .pwa-instruction-header h3 {
        margin: 0;
        font-size: 1.1rem;
        font-weight: 600;
        flex: 1;
    }

/* Close button */
.pwa-instruction-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    color: white;
}

    .pwa-instruction-close:hover {
        background: rgba(255, 255, 255, 0.3);
    }

/* Body content */
.pwa-instruction-body {
    padding: 1.5rem;
}

    .pwa-instruction-body ol {
        margin: 0;
        padding-left: 1.5rem;
        color: #334155;
        line-height: 1.8;
    }

    .pwa-instruction-body li {
        margin-bottom: 0.75rem;
        font-size: 0.95rem;
    }

        .pwa-instruction-body li:last-child {
            margin-bottom: 0;
        }

        .pwa-instruction-body li i {
            color: #64748b;
        }

/* Footer */
.pwa-instruction-footer {
    padding: 1rem 1.5rem 1.5rem;
    display: flex;
    justify-content: flex-end;
}

.pwa-instruction-btn {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

    .pwa-instruction-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
    }

    .pwa-instruction-btn:active {
        transform: translateY(0);
    }

/* Mobile responsive */
@media (max-width: 480px) {
    .pwa-instruction-modal {
        max-width: 100%;
        margin: 0.5rem;
    }

    .pwa-instruction-header {
        padding: 1.25rem;
    }

    .pwa-instruction-body {
        padding: 1.25rem;
    }

        .pwa-instruction-body li {
            font-size: 0.9rem;
        }
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.pwa-notification {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
