/* Metricly Report Hub - Same theme as Dashy (no SQL) */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary-color: #7D44BE;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body.dark-mode {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

header {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: clamp(0.75rem, 2vw, 1.5rem) clamp(1rem, 3vw, 20px);
    box-shadow: var(--shadow);
    width: 100%;
    box-sizing: border-box;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: clamp(0.5rem, 1.5vw, 1rem);
    padding-left: 0;
    max-width: 100%;
    min-width: 0;
}

.header-logo {
    display: flex;
    align-items: center;
    margin-right: auto;
    min-width: 120px;
}

.logo-image {
    max-height: 70px;
    max-width: 220px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.logo-light { display: block; }
.logo-dark { display: none; }
body.dark-mode .logo-light { display: none; }
body.dark-mode .logo-dark { display: block; }

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.theme-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(0.35rem, 1vw, 0.5rem);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: clamp(6px, 1vw, 8px);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    width: clamp(32px, 6vw, 36px);
    height: clamp(32px, 6vw, 36px);
    flex-shrink: 0;
}

.theme-toggle-btn:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.theme-toggle-btn svg {
    width: clamp(14px, 2.5vw, 18px);
    height: clamp(14px, 2.5vw, 18px);
}

.header-user-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 0.75rem;
}

.header-user-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
    transition: opacity 0.15s, box-shadow 0.15s;
    flex-shrink: 0;
}

.header-user-trigger--labeled {
    flex-direction: column;
    gap: 0.2rem;
    border-radius: 8px;
    max-width: 5.75rem;
}

.header-user-avatar-slot {
    position: relative;
    width: clamp(28px, 5vw, 32px);
    height: clamp(28px, 5vw, 32px);
    flex-shrink: 0;
}

.header-user-name {
    display: block;
    max-width: 100%;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.15;
    color: var(--text-secondary);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-user-trigger:hover {
    opacity: 0.9;
}

.header-user-trigger:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-color);
}

.header-user-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.header-user-avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    font-size: clamp(0.65rem, 1.2vw, 0.75rem);
    font-weight: 600;
    flex-shrink: 0;
}

.header-user-avatar-fallback[hidden],
.header-user-avatar[hidden] {
    display: none !important;
}

.header-user-avatar-slot .header-user-avatar,
.header-user-avatar-slot .header-user-avatar-fallback {
    position: absolute;
    inset: 0;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
    border: 1px solid var(--primary-color);
}
.btn-primary:hover {
    background: var(--primary-hover, #6c39a6);
    border-color: var(--primary-hover, #6c39a6);
    color: #fff;
}

.header-user-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 140px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    padding: 0.35rem 0;
    z-index: 1000;
    display: none;
}

.header-user-dropdown[aria-hidden="false"],
.header-user-dropdown.open {
    display: block;
}

.header-user-dropdown-item {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s;
}

.header-user-dropdown-item:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.header-user-dropdown-btn {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
    font-family: inherit;
}

.header-user-dropdown-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}
