/* File: /Users/liborballaty/LocalProjects/GitHubProjectsDocuments/xLLMArionComply/arioncomply-v1/internal-admin-ui/public/css/shared-layout.css */
/* Description: Shared styles for standardized header and collapsible sidebar navigation across admin pages */
/* Author: Libor Ballaty <libor@arionetworks.com> */
/* Created: 2025-12-10 */

/* ============================================
   SHARED NAVIGATION LAYOUT STYLES
   All classes prefixed with 'sn-' to avoid conflicts
   ============================================ */

/* ============================================
   1. SHARED HEADER STYLES
   ============================================ */

.sn-header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 70px;
}

.sn-header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 100%;
    max-width: 1800px;
    margin: 0 auto;
}

/* Sidebar Toggle Button */
.sn-sidebar-toggle {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    padding: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    flex-shrink: 0;
}

.sn-sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.3);
}

.sn-hamburger-icon {
    font-size: 1.5rem;
    color: white;
    display: block;
    line-height: 1;
}

/* Header Title */
.sn-header-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
}

.sn-header-title a {
    color: white;
    text-decoration: none;
}

.sn-header-title a:hover {
    opacity: 0.9;
}

/* State Indicators Group */
.sn-header-state-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
    flex-wrap: wrap;
}

/* Database Indicator */
.sn-db-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid;
    transition: all 0.2s ease;
    min-width: 180px;
}

.sn-db-indicator.sn-db-local {
    background: rgba(40, 167, 69, 0.2);
    color: #d4ffd9;
    border-color: rgba(40, 167, 69, 0.5);
}

.sn-db-indicator.sn-db-staging {
    background: rgba(255, 193, 7, 0.2);
    color: #fff9e6;
    border-color: rgba(255, 193, 7, 0.5);
}

.sn-db-indicator.sn-db-production {
    background: rgba(220, 53, 69, 0.2);
    color: #ffd9dd;
    border-color: rgba(220, 53, 69, 0.5);
}

.sn-db-indicator.sn-db-unknown {
    background: rgba(108, 117, 125, 0.2);
    color: #e9ecef;
    border-color: rgba(108, 117, 125, 0.5);
}

.sn-db-info {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.sn-db-first-line {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.sn-db-label {
    font-size: 11px;
    opacity: 0.65;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sn-db-env-name {
    font-weight: 600;
    font-size: 13px;
}

.sn-db-url-short {
    font-size: 10px;
    opacity: 0.75;
    font-weight: 400;
}

/* Mode Indicator */
.sn-mode-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    cursor: help;
}

/* Version Indicator */
.sn-version-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    background: rgba(103, 126, 234, 0.25);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(103, 126, 234, 0.4);
    color: #e8eaf6;
    cursor: help;
    transition: all 0.2s ease;
}

.sn-version-indicator:hover {
    background: rgba(103, 126, 234, 0.35);
    border-color: rgba(103, 126, 234, 0.6);
    transform: translateY(-1px);
}

.sn-version-icon {
    font-size: 16px;
    line-height: 1;
}

/* User Info Badge */
.sn-user-info {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
}

.sn-user-info::before {
    content: "👤";
    font-size: 14px;
}

/* Token Expired State - Red Badge */
.sn-user-info.sn-token-expired {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.6);
    color: #fca5a5;
    animation: pulse-red 2s infinite;
}

.sn-user-info.sn-token-expired::before {
    content: "⚠️";
    font-size: 14px;
}

@keyframes pulse-red {
    0%, 100% {
        background: rgba(239, 68, 68, 0.2);
        border-color: rgba(239, 68, 68, 0.6);
    }
    50% {
        background: rgba(239, 68, 68, 0.4);
        border-color: rgba(239, 68, 68, 0.8);
    }
}

/* Header Actions (Logout button, notifications) */
.sn-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: 1rem;
}

/* ============================================
   NOTIFICATION BADGES AND DROPDOWN
   ============================================ */

.sn-notification-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Backup Status Indicator */
.sn-backup-indicator {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sn-backup-indicator.sn-backup-critical {
    background: rgba(220, 53, 69, 0.2);
    border: 2px solid rgba(220, 53, 69, 0.6);
    animation: backupBlinkCritical 1.5s ease-in-out infinite;
}

.sn-backup-indicator.sn-backup-warning {
    background: rgba(255, 193, 7, 0.2);
    border: 2px solid rgba(255, 193, 7, 0.6);
}

/* Blinking animation for critical backup issues */
@keyframes backupBlinkCritical {
    0%, 100% {
        background: rgba(220, 53, 69, 0.2);
        border-color: rgba(220, 53, 69, 0.6);
        box-shadow: 0 0 0 rgba(220, 53, 69, 0);
    }
    50% {
        background: rgba(255, 26, 46, 0.4);
        border-color: rgba(255, 26, 46, 0.9);
        box-shadow: 0 0 15px rgba(220, 53, 69, 0.6);
    }
}

.sn-backup-indicator:hover {
    transform: scale(1.1);
}

.sn-backup-indicator.sn-backup-critical:hover {
    background: rgba(220, 53, 69, 0.3);
}

.sn-backup-indicator.sn-backup-warning:hover {
    background: rgba(255, 193, 7, 0.3);
}

.sn-backup-icon {
    font-size: 1.2rem;
}

/* SLA Breach Indicator */
.sn-sla-indicator {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(220, 53, 69, 0.2);
    border: 1px solid rgba(220, 53, 69, 0.4);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sn-sla-indicator:hover {
    background: rgba(220, 53, 69, 0.3);
    transform: scale(1.05);
}

.sn-sla-icon {
    font-size: 1.2rem;
}

/* Notification Bell Wrapper */
.sn-notification-bell-wrapper {
    position: relative;
}

.sn-notification-bell {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sn-notification-bell:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.sn-bell-icon {
    font-size: 1.2rem;
}

/* Badge Styles */
.sn-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #1e3c72;
}

.sn-badge-primary {
    background: #3b82f6;
    color: white;
}

.sn-badge-urgent {
    background: #dc3545;
    color: white;
    animation: sn-pulse 2s infinite;
}

@keyframes sn-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Notification Dropdown */
.sn-notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    width: 360px;
    max-height: 480px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 2000;
}

.sn-notification-dropdown.sn-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.sn-notification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
}

.sn-notification-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.sn-notification-mark-read {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.35rem 0.75rem;
    border-radius: 15px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sn-notification-mark-read:hover {
    background: rgba(255, 255, 255, 0.25);
}

.sn-notification-content {
    max-height: 380px;
    overflow-y: auto;
}

.sn-notification-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    color: #6c757d;
    text-align: center;
}

.sn-notification-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.sn-notification-empty p {
    margin: 0;
    font-size: 0.95rem;
}

/* Notification Item */
.sn-notification-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s ease;
}

.sn-notification-item:hover {
    background: #f8f9fa;
}

.sn-notification-item:last-of-type {
    border-bottom: none;
}

.sn-notification-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f4f8;
    border-radius: 50%;
}

.sn-notification-text {
    flex: 1;
    min-width: 0;
}

.sn-notification-text strong {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    color: #1e3c72;
}

.sn-notification-text p {
    margin: 0 0 0.25rem 0;
    font-size: 0.85rem;
    color: #6c757d;
    line-height: 1.4;
}

.sn-notification-text small {
    font-size: 0.75rem;
    color: #adb5bd;
}

/* Urgent notification item */
.sn-notification-item.sn-notification-urgent {
    background: #fff5f5;
    border-left: 3px solid #dc3545;
}

.sn-notification-item.sn-notification-urgent:hover {
    background: #ffe8e8;
}

.sn-notification-item.sn-notification-urgent .sn-notification-icon {
    background: #fde8ea;
}

/* Warning notification item */
.sn-notification-item.sn-notification-warning {
    background: #fffef5;
    border-left: 3px solid #ffc107;
}

.sn-notification-item.sn-notification-warning:hover {
    background: #fff8e1;
}

.sn-notification-item.sn-notification-warning .sn-notification-icon {
    background: #fff3cd;
}

/* Info notification item */
.sn-notification-item.sn-notification-info {
    border-left: 3px solid #3b82f6;
}

.sn-notification-item.sn-notification-info .sn-notification-icon {
    background: #e7f1ff;
}

/* View All link */
.sn-notification-view-all {
    display: block;
    padding: 1rem 1.25rem;
    text-align: center;
    text-decoration: none;
    color: #2a5298;
    font-weight: 500;
    font-size: 0.9rem;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    transition: background 0.15s ease;
}

.sn-notification-view-all:hover {
    background: #e9ecef;
}

.sn-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.sn-btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.sn-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
}

.sn-btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

/* ============================================
   2. COLLAPSIBLE SIDEBAR STYLES
   ============================================ */

.sn-sidebar {
    position: fixed;
    top: 70px; /* Below header */
    left: 0;
    bottom: 0;
    width: 260px;
    background: white;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
    z-index: 1001;
    overflow-x: hidden;
    overflow-y: auto;
    transform: translateX(-100%);
}

.sn-sidebar.sn-sidebar-expanded {
    transform: translateX(0);
}

/* Sidebar backdrop overlay */
.sn-sidebar-backdrop {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
}

.sn-sidebar-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* Sidebar Header */
.sn-sidebar-header {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.sn-logo {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e3c72;
}

/* Sidebar Navigation */
.sn-nav {
    padding: 1rem 0;
}

/* Section Headers */
.sn-nav-section {
    margin-bottom: 0.5rem;
}

.sn-nav-title {
    padding: 0.75rem 1rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #999;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
}

.sn-sidebar.sn-sidebar-expanded .sn-nav-title {
    opacity: 1;
}

/* Navigation Links */
.sn-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #555;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
}

.sn-nav-link:hover {
    background: #f5f7fa;
    color: #2a5298;
}

.sn-nav-link.sn-active {
    background: #e8f0fe;
    color: #2a5298;
    border-left: 3px solid #2a5298;
    font-weight: 600;
}

.sn-nav-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.sn-nav-text {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sn-sidebar.sn-sidebar-expanded .sn-nav-text {
    opacity: 1;
}

/* Divider between sections */
.sn-nav-divider {
    height: 1px;
    background: #e9ecef;
    margin: 0.5rem 0;
}

/* ============================================
   3. TABLE VIEWS SUBMENU (EXPANDABLE WITH HOVER)
   ============================================ */

.sn-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease;
    opacity: 0;
}

.sn-submenu.sn-open {
    max-height: 1000px;
    opacity: 1;
}

.sn-submenu-toggle {
    cursor: pointer;
    position: relative;
}

/* Visual indicator that this item has a submenu */
.sn-submenu-toggle::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border: none;
}

.sn-submenu-toggle .sn-arrow {
    margin-left: auto;
    transition: transform 0.2s ease;
    font-size: 0.8rem;
    opacity: 0;
}

.sn-sidebar.sn-sidebar-expanded .sn-submenu-toggle .sn-arrow {
    opacity: 1;
}

.sn-submenu-toggle.sn-open .sn-arrow {
    transform: rotate(90deg);
}

/* Highlight parent when submenu is open */
.sn-submenu-toggle.sn-open {
    background: #f0f4f8;
    color: #2a5298;
}

.sn-submenu .sn-nav-link {
    padding-left: 2.5rem;
    font-size: 0.9rem;
}

.sn-sidebar:not(.sn-sidebar-expanded) .sn-submenu {
    display: none;
}

/* Sub-submenu (Core Tables, Compliance Tables) */
.sn-sub-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease;
    opacity: 0;
    background: #fafbfc;
}

.sn-sub-submenu.sn-open {
    max-height: 500px;
    opacity: 1;
}

/* Highlight sub-submenu toggle when open */
.sn-submenu-toggle[data-sub-submenu-id].sn-open {
    background: #e8f0fe;
    font-weight: 500;
}

.sn-sub-submenu .sn-nav-link {
    padding-left: 3.5rem;
    font-size: 0.85rem;
}

/* Subtle left border for nested items */
.sn-sub-submenu .sn-nav-link {
    border-left: 2px solid #e0e0e0;
    margin-left: 1rem;
}

.sn-sub-submenu .sn-nav-link:hover {
    border-left-color: #2a5298;
}

/* ============================================
   4. MAIN CONTENT ADJUSTMENT
   ============================================ */

.sn-main-content {
    margin-left: 0;
    margin-top: 70px; /* Match header height */
    padding: 2rem;
    transition: margin-left 0.3s ease;
    min-height: calc(100vh - 70px);
    position: relative;
    z-index: 1;
}

body.sn-sidebar-expanded .sn-main-content {
    margin-left: 260px;
}

/* ============================================
   5. TOOLTIP FOR COLLAPSED SIDEBAR
   ============================================ */

.sn-tooltip {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: #333;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    margin-left: 0.5rem;
    z-index: 1001;
}

.sn-nav-link:hover .sn-tooltip {
    opacity: 1;
}

.sn-sidebar.sn-sidebar-expanded .sn-tooltip {
    display: none;
}

/* ============================================
   6. RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
    .sn-header {
        padding: 0.75rem 1rem;
    }

    .sn-header-state-group {
        display: none; /* Hide on mobile, show in menu */
    }

    .sn-sidebar {
        transform: translateX(-100%);
        width: 260px;
    }

    .sn-sidebar.sn-expanded {
        transform: translateX(0);
    }

    .sn-main-content {
        margin-left: 0;
    }

    body.sn-sidebar-expanded .sn-main-content {
        margin-left: 0;
    }

    /* Overlay when sidebar open on mobile */
    .sn-sidebar-overlay {
        display: none;
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
    }

    body.sn-sidebar-expanded .sn-sidebar-overlay {
        display: block;
    }
}

/* ============================================
   7. PAGE-SPECIFIC OVERRIDES
   Pages can use these to adjust their content
   ============================================ */

/* For pages that have their own page header */
.sn-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.sn-page-header h2 {
    font-size: 1.75rem;
    color: #1e3c72;
    margin: 0;
}

/* Back link styling (if pages still want a back button) */
.sn-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #2a5298;
    text-decoration: none;
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.sn-back-link:hover {
    text-decoration: underline;
}

/* ============================================
   8. ANIMATION UTILITIES
   ============================================ */

.sn-fade-in {
    animation: snFadeIn 0.3s ease;
}

@keyframes snFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ============================================
   9. PRINT STYLES
   ============================================ */

@media print {
    .sn-header,
    .sn-sidebar,
    .sn-sidebar-overlay {
        display: none !important;
    }

    .sn-main-content {
        margin-left: 0 !important;
        margin-top: 0 !important;
    }
}
