.global-header {
    position: sticky;
    top: 0;
    z-index: 1002;
    height: 64px;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
}

body {
    font-family: 'Lab Grotesque', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body.modal-open .global-header {
    position: sticky;
    top: 0;
    z-index: 1002;
}

#headerLogo svg g {
    fill: var(--accent-primary)
}

.logo {
    height: 36px;
    width: 36px;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 0 24px;
    height: 100%;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    gap: 24px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    cursor: pointer;
}

.logo-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 1;
    overflow-x: auto;
    padding: 4px 0;
}

.header-nav::-webkit-scrollbar {
    height: 2px;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 10px;
    color: var(--text-header);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s;
    white-space: nowrap;
}

.nav-tab:hover {
    background: var(--bg-hover);
    color: var(--text-header);
}

.nav-tab svg {
    width: 20px;
    height: 20px;
    stroke: var(--text-header);
}

.nav-tab.active svg {
    stroke: var(--accent-primary);
}

.nav-tab.active {
    background: rgba(var(--accent-primary-rgb), 0.12);
    color: var(--accent-primary);
}

.nav-tab-icon {
    font-size: 18px;
}

.nav-badge {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 4px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.global-search-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    color: var(--text-header);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.global-search-btn:hover {
    background: var(--bg-hover);
}

.notification-bell {
    position: relative;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    color: var(--text-header);
    justify-content: center;
}

.notification-bell:hover {
    background: var(--bg-hover);
}

.bell-icon {
    font-size: 20px;
    color: var(--text-secondary);
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--error);
    color: white;
    font-size: 10px;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    flex-shrink: 0;
}

.header-user:hover {
    background: var(--bg-hover);
    border-color: var(--border-color);
}

.header-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 16px;
    background-size: cover;
    background-position: center;
}

.header-user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.header-user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-header);
}

.header-user-role {
    font-size: 11px;
    color: var(--text-muted);
}

.context-menu {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    min-width: 240px;
    transform: scale(0.95);
    transition: opacity 0.2s, transform 0.2s;
}

.context-menu.show {
    opacity: 1;
    transform: scale(1);
    pointer-events: all;
}

.context-menu-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.context-menu-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.context-menu-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    background-size: cover;
    background-position: center;
}

.context-menu-info {
    flex: 1;
}

.context-menu-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    margin-bottom: 2px;
}

.context-menu-role {
    font-size: 12px;
    color: var(--text-muted);
}

.context-menu-items {
    padding: 8px;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    color: var(--text-primary);
    background: var(--bg-card);
    font-size: 14px;
}

.context-menu-item:hover {
    background: var(--text-header);
}

.context-menu-item.logout:hover {
    background: var(--error);
    color: #fff;
}

.context-menu-icon {
    font-size: 18px;
    width: 24px;
}

.context-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#spaceSettingsModal .modal-content {
    max-width: 550px;
}

#spaceSettingsModal .modal-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.banner-upload {
    cursor: pointer;
    position: relative;
}

.banner-preview-area {
    position: relative;
    width: 100%;
    height: 150px;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border: 2px dashed var(--border-color);
    transition: all 0.2s;
}

.banner-upload:hover .banner-preview-area {
    border-color: var(--accent-primary);
}

.banner-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.banner-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    background: var(--bg-tertiary);
}

.upload-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    text-align: center;
    padding: 8px;
    font-size: 12px;
    transform: translateY(100%);
    transition: transform 0.2s;
}

.banner-upload:hover .upload-overlay {
    transform: translateY(0);
}

.icon-upload {
    cursor: pointer;
    transition: transform 0.2s;
    text-align: center;
}

.icon-upload:hover {
    transform: scale(1.05);
}

.icon-preview-area {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin-bottom: 8px;
    background-size: cover;
    background-position: center;
    border: 2px solid var(--border-color);
}

.icon-upload span {
    font-size: 12px;
    color: var(--text-muted);
}

.modal-content {
    background: var(--bg-card);
    padding: 28px;
    border-radius: 20px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.modal-body {
    padding: 0;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.25s;
    font-family: inherit;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.1);
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.25s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    border: 1px solid var(--border-color);
}


.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-tertiary);
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--error);
    color: #fff;
}

.btn-danger:hover:not(:disabled) {
    background: #a00f1f;
    transform: translateY(-2px);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.avatar-upload {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s;
}

.avatar-upload:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

.avatar-preview {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 24px;
    border: 1px solid var(--border-color);
    background-size: cover;
    background-position: center;
}

.qr-container {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 16px;
    display: inline-block;
}

.qr-secret {
    display: block;
    color: var(--text-primary);
    background: var(--bg-secondary);
    padding: 12px;
    border-radius: 8px;
    word-break: break-all;
    margin-bottom: 25px;
    font-family: monospace;
}

.crop-container {
    padding: 20px;
    max-height: 400px;
    overflow: hidden;
}

.crop-container img {
    max-width: 100%;
    max-height: 360px;
}

.search-input-wrapper {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.search-filters-row {
    margin-bottom: 16px;
}

.search-results-modal {
    max-height: 400px;
    overflow-y: auto;
}

.search-results-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.search-result-item:hover {
    background: var(--bg-hover);
    transform: translateX(4px);
}

.result-icon {
    font-size: 24px;
    width: 40px;
    text-align: center;
}

.result-content {
    flex: 1;
}

.result-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.result-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.result-type {
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 12px;
}

.active-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.active-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 12px;
    border-radius: 16px;
    font-size: 13px;
}

.remove-tag {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: inherit;
    padding: 0 2px;
}

.search-stats {
    padding: 8px 0;
    color: var(--text-muted);
    font-size: 13px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 12px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.cropper-container {
    direction: ltr;
    font-size: 0;
    line-height: 0;
    position: relative;
    touch-action: none;
    user-select: none;
}

.cropper-container img {
    display: block;
    height: 100%;
    max-height: none !important;
    max-width: none !important;
    min-height: 0 !important;
    min-width: 0 !important;
    width: 100%;
}

.cropper-canvas,
.cropper-crop-box,
.cropper-drag-box,
.cropper-modal,
.cropper-wrap-box {
    bottom: 0;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
}

.cropper-canvas,
.cropper-wrap-box {
    overflow: hidden;
}

.cropper-drag-box {
    background-color: #fff;
    opacity: 0;
}

.cropper-modal {
    background-color: #000;
    opacity: 0.5;
}

.cropper-view-box {
    display: block;
    height: 100%;
    outline: 1px solid #39f;
    outline-color: rgba(51, 153, 255, 0.75);
    overflow: hidden;
    width: 100%;
}

.cropper-dashed {
    border: 0 dashed #eee;
    display: block;
    opacity: 0.5;
    position: absolute;
}

.cropper-dashed.dashed-h {
    border-bottom-width: 1px;
    border-top-width: 1px;
    height: 33.33333%;
    left: 0;
    top: 33.33333%;
    width: 100%;
}

.cropper-dashed.dashed-v {
    border-left-width: 1px;
    border-right-width: 1px;
    height: 100%;
    left: 33.33333%;
    top: 0;
    width: 33.33333%;
}

.cropper-center {
    display: block;
    height: 0;
    left: 50%;
    opacity: 0.75;
    position: absolute;
    top: 50%;
    width: 0;
}

.cropper-center::before,
.cropper-center::after {
    background-color: #eee;
    content: " ";
    display: block;
    position: absolute;
}

.cropper-center::before {
    height: 1px;
    left: -3px;
    top: 0;
    width: 7px;
}

.cropper-center::after {
    height: 7px;
    left: 0;
    top: -3px;
    width: 1px;
}

.cropper-face,
.cropper-line,
.cropper-point {
    display: block;
    height: 100%;
    opacity: 0.1;
    position: absolute;
    width: 100%;
}

.cropper-face {
    background-color: #fff;
    left: 0;
    top: 0;
}

.cropper-line {
    background-color: #39f;
}

.cropper-line.line-e {
    cursor: ew-resize;
    right: -3px;
    top: 0;
    width: 5px;
}

.cropper-line.line-n {
    cursor: ns-resize;
    height: 5px;
    left: 0;
    top: -3px;
}

.cropper-line.line-w {
    cursor: ew-resize;
    left: -3px;
    top: 0;
    width: 5px;
}

.cropper-line.line-s {
    bottom: -3px;
    cursor: ns-resize;
    height: 5px;
    left: 0;
}

.cropper-point {
    background-color: #39f;
    height: 5px;
    opacity: 0.75;
    width: 5px;
}

.cropper-point.point-e {
    cursor: ew-resize;
    margin-top: -3px;
    right: -3px;
    top: 50%;
}

.cropper-point.point-n {
    cursor: ns-resize;
    left: 50%;
    margin-left: -3px;
    top: -3px;
}

.cropper-point.point-w {
    cursor: ew-resize;
    left: -3px;
    margin-top: -3px;
    top: 50%;
}

.cropper-point.point-s {
    bottom: -3px;
    cursor: s-resize;
    left: 50%;
    margin-left: -3px;
}

.cropper-point.point-ne {
    cursor: nesw-resize;
    right: -3px;
    top: -3px;
}

.cropper-point.point-nw {
    cursor: nwse-resize;
    left: -3px;
    top: -3px;
}

.cropper-point.point-sw {
    bottom: -3px;
    cursor: nesw-resize;
    left: -3px;
}

.cropper-point.point-se {
    bottom: -3px;
    cursor: nwse-resize;
    height: 20px;
    opacity: 1;
    right: -3px;
    width: 20px;
}

@media (min-width: 768px) {
    .cropper-point.point-se {
        height: 15px;
        width: 15px;
    }
}

@media (min-width: 992px) {
    .cropper-point.point-se {
        height: 10px;
        width: 10px;
    }
}

@media (min-width: 1200px) {
    .cropper-point.point-se {
        height: 5px;
        opacity: 0.75;
        width: 5px;
    }
}

.cropper-point.point-se::before {
    background-color: #39f;
    bottom: -50%;
    content: " ";
    display: block;
    height: 200%;
    opacity: 0;
    position: absolute;
    right: -50%;
    width: 200%;
}

.cropper-invisible {
    opacity: 0;
}

.cropper-bg {
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC");
}

.cropper-hide {
    display: block;
    height: 0;
    position: absolute;
    width: 0;
}

.cropper-hidden {
    display: none !important;
}

.cropper-move {
    cursor: move;
}

.cropper-crop {
    cursor: crosshair;
}

.cropper-disabled .cropper-drag-box,
.cropper-disabled .cropper-face,
.cropper-disabled .cropper-line,
.cropper-disabled .cropper-point {
    cursor: not-allowed;
}

#cropImage {
    max-width: 100%;
    max-height: 360px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    color: var(--text-header);
    transition: all 0.2s;
    order: 1;
}

.mobile-compact-menu {
    display: none;
}

.mobile-menu-btn:hover {
    background: var(--bg-hover);
}

.mobile-nav-actions {
    display: none;
    flex-direction: column;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.mobile-action-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    color: var(--text-header);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s;
    position: relative;
}

.mobile-action-item:hover {
    background: var(--bg-hover);
}

.mobile-action-item.logout:hover {
    background: var(--error);
    color: #fff;
}

.mobile-action-icon {
    font-size: 20px;
    width: 28px;
}

.mobile-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    background-size: cover;
    background-position: center;
}

.mobile-user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.mobile-user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.mobile-user-role {
    font-size: 11px;
    color: var(--text-muted);
}

.mobile-notification-badge {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--error);
    color: white;
    font-size: 10px;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .header-nav {
        position: fixed;
        top: 64px;
        left: -100%;
        width: 300px;
        height: calc(100vh - 64px);
        background: var(--bg-card);
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
        transition: left 0.3s ease;
        z-index: 999;
        border-right: 1px solid var(--border-color);
        overflow-y: auto;
    }
    
    .header-nav.mobile-open {
        left: 0;
    }
    
    .nav-tab {
        padding: 12px 16px;
        justify-content: flex-start;
    }
    
    .nav-tab-text {
        display: inline;
    }
    
    .header-actions {
        display: none;
    }
    
    .mobile-nav-actions {
        display: flex;
    }
    
    .header-user-info {
        display: none;
    }
    
    .header-content {
        justify-content: space-between;
    }
    
    .header-logo {
        order: 0;
    }
    
    .mobile-menu-btn {
        order: 2;
    }

    .header-user-info {
        display: none;
    }

    
    .nav-tab {
        padding: 8px 12px;
    }

    .header-container {
        padding: 0 16px;
    }
    
    .search-input-wrapper {
        flex-direction: column;
    }
    
    .modal-content {
        max-width: 95%;
        padding: 20px;
    }
    
    .modal-header {
        flex-wrap: wrap;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .color-picker-group {
        flex-direction: column;
    }
    
    .color-picker {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .header-container {
        padding: 0 12px;
    }
    
    .modal-content {
        padding: 16px;
    }
    
    .modal-title {
        font-size: 18px;
    }
    
    .header-actions {
        gap: 8px;
    }
    
    .global-search-btn, .notification-bell {
        padding: 6px;
    }
    
    .context-menu {
        right: 10px !important;
        left: auto !important;
        min-width: 200px;
    }
}

@media (max-width: 768px) {
    .mobile-compact-menu {
        display: flex;
    }
}