/**
 * Shared Header Styles
 * Used across all application pages for consistent header appearance
 */

/* Main Header Container */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: white;
    border-bottom: 2px solid #e2e8f0;
    position: relative;
}

/* Header Sections */
.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    z-index: 2;
}

.header-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    z-index: 3;
    pointer-events: none; /* Allow clicks to pass through to elements below */
}

.header-center > * {
    pointer-events: auto; /* But allow clicking on the logo/title themselves */
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex: 1;
    justify-content: flex-end;
    z-index: 2;
}

/* Home Button */
.home-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: white;
    border: 2px solid #e2e8f0;
    color: #667eea;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.home-button:hover {
    background: #f7fafc;
    border-color: #667eea;
    transform: scale(1.05);
}

.home-button svg {
    display: block;
}

/* Logo and Title */
.header-logo {
    height: 56px;
    width: auto;
    flex-shrink: 0;
}

.header-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: #000 !important;
    margin: 0;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 0;
}

/* Language Selector */
.header-language-selector {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header-lang-button {
    font-size: 20px;
    padding: 0.4rem;
    border: 2px solid #e2e8f0;
    background: white;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-lang-button:hover {
    transform: scale(1.05);
    background: rgba(102, 126, 234, 0.1);
    border-color: #667eea;
}

.header-lang-button.active {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.15);
}

/* Language dropdown */
.header-lang-dropdown {
    position: absolute;
    top: 60px;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0.5rem;
    display: none;
    z-index: 1000;
    min-width: 60px;
}

.header-lang-dropdown.show {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Hide non-active languages by default */
.header-lang-button:not(.active) {
    display: none;
}

/* Show all languages in dropdown when expanded */
.header-lang-dropdown.show .header-lang-button {
    display: flex !important;
    position: relative;
    opacity: 1;
    pointer-events: auto;
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-menu-button {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.user-menu-button:hover {
    border-color: #667eea;
    background: #f7fafc;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.user-menu-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 1000;
}

.user-menu-dropdown.show {
    display: block;
}

.user-menu-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f1f1f1;
}

.user-menu-item:last-child {
    border-bottom: none;
}

.user-menu-item:hover {
    background: #f7fafc;
}

.user-menu-item a {
    color: #333;
    text-decoration: none;
    display: block;
}

.user-menu-item.logout {
    color: #e53e3e;
}

/* ==========================================
 * ProcessBot Menu
 * ==========================================
 */

.processbot-menu {
    position: relative;
}

.processbot-menu-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    padding: 0;
}

.processbot-menu-button:hover {
    transform: scale(1.05);
}

.processbot-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.processbot-menu-dropdown {
    position: absolute;
    top: 60px;
    left: 0;
    min-width: 280px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0.5rem;
    display: none;
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
}

.processbot-menu-dropdown.show {
    display: block;
}

/* No Robots State */
.processbot-add-button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #f7fafc;
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.processbot-add-button:hover {
    background: #edf2f7;
    border-color: #667eea;
}

.processbot-add-icon {
    width: 32px;
    height: 32px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
}

.processbot-add-text {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #4a5568;
}

/* Robot List */
.processbot-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.processbot-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
}

.processbot-item:hover {
    background: #f7fafc;
    border-color: #667eea;
    transform: translateX(4px);
}

.processbot-type-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
}

.processbot-info {
    flex: 1;
    min-width: 0;
}

.processbot-name {
    font-size: 14px;
    font-weight: 500;
    color: #2d3748;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.processbot-type {
    font-size: 12px;
    color: #718096;
    margin-top: 2px;
}

.processbot-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.processbot-status.online {
    background: #48bb78;
}

.processbot-status.offline {
    background: #cbd5e0;
}

.processbot-status.sleeping {
    background: #ed8936;
}

.processbot-loading {
    padding: 1rem;
    text-align: center;
    color: #718096;
}

.processbot-menu-header {
    padding: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 0.5rem;
}

.processbot-menu-title {
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.25rem;
}

.processbot-menu-count {
    font-size: 12px;
    color: #718096;
}

/* Environment Banner (DEV/QA) */
.env-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    padding: 0.5rem 1rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.env-banner.dev {
    background-color: #fff3e0;
    color: #e65100;
    border-bottom: 2px solid #ff9800;
}

.env-banner.qa {
    background-color: #e3f2fd;
    color: #01579b;
    border-bottom: 2px solid #2196f3;
}

/* Adjust body padding when banner is present */
body.has-env-banner {
    padding-top: 40px;
}

/* Adjust header when banner is present */
body.has-env-banner .header {
    top: 40px;
}

/* Feature Requests Lightbulb Link */
.feature-requests-link {
    color: #FFD700;
    font-size: 1.3rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    background: rgba(128, 128, 128, 0);
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    margin-left: 0.75rem;
    transition: all 0.3s ease;
    position: relative;
    filter: brightness(0.6);
}

/* Lightbulb "lighting up" animation on hover */
.feature-requests-link:hover {
    background: rgba(255, 215, 0, 0.1);
    transform: scale(1.05);
    filter: brightness(1.0) drop-shadow(0 0 4px rgba(255, 215, 0, 0.25));
    box-shadow:
        0 0 6px rgba(255, 215, 0, 0.2),
        0 2px 3px rgba(0, 0, 0, 0.15);
    animation: lightbulb-glow 0.4s ease-in-out;
}

@keyframes lightbulb-glow {
    0% {
        filter: brightness(0.7) drop-shadow(0 0 0 rgba(255, 215, 0, 0));
        box-shadow: 0 0 0 rgba(255, 215, 0, 0), 0 1px 2px rgba(0, 0, 0, 0.1);
    }
    50% {
        filter: brightness(1.05) drop-shadow(0 0 5px rgba(255, 215, 0, 0.3));
        box-shadow:
            0 0 8px rgba(255, 215, 0, 0.25),
            0 2px 4px rgba(0, 0, 0, 0.2);
    }
    100% {
        filter: brightness(1.0) drop-shadow(0 0 4px rgba(255, 215, 0, 0.25));
        box-shadow:
            0 0 6px rgba(255, 215, 0, 0.2),
            0 2px 3px rgba(0, 0, 0, 0.15);
    }
}

.feature-requests-link:active {
    transform: scale(1.05);
}
