:root {
    --primary-color: #0066FF;
    --primary-hover: #0052CC;
    --success-color: #00C853;
    --error-color: #FF1744;
    --text-primary: #1a1a1a;
    --text-secondary: #666;
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --border-color: #e0e0e0;
    --sidebar-bg: #1a1a2e;
    --sidebar-text: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    cursor: default;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text-primary);
    background: var(--bg-secondary);
    line-height: 1.6;
}

/* Text cursor only for input fields */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="number"],
textarea,
[contenteditable="true"] {
    cursor: text;
}

/* Auth Page */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.auth-card {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.logo-container {
    margin-bottom: 20px;
}

.auth-logo {
    height: 60px;
    width: auto;
}

.auth-header h1 {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--text-secondary);
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
}

.auth-tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.3s;
}

.auth-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

.btn-primary {
    background: var(--primary-color);
    color: white !important;
}

.btn-primary:hover {
    background: var(--primary-hover);
    color: white !important;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-primary) !important;
}

.btn-outline:hover {
    border-color: var(--primary-color);
    color: var(--primary-color) !important;
}

/* Special case: white outline buttons on dark backgrounds */
.sidebar-footer .btn-outline,
.sidebar .btn-outline {
    color: white !important;
    border-color: rgba(255, 255, 255, 0.3);
}

.sidebar-footer .btn-outline:hover,
.sidebar .btn-outline:hover {
    border-color: white;
    color: white !important;
}

.btn-danger {
    background: var(--error-color);
    color: white !important;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-text {
    color: inherit;
    display: inline;
}

.btn-loader {
    color: inherit;
    display: none;
}

.btn-primary .btn-text,
.btn-primary .btn-loader {
    color: white !important;
}

.btn-danger .btn-text,
.btn-danger .btn-loader {
    color: white !important;
}

.sidebar .btn-outline .btn-text,
.sidebar-footer .btn-outline .btn-text {
    color: white !important;
}

/* App Layout */
.app-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 30px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    height: 32px;
    width: 32px;
}

.sidebar-header h2 {
    font-size: 1.5rem;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: background 0.3s;
}

.nav-item i {
    width: 20px;
    font-size: 16px;
    text-align: center;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255, 255, 255, 0.1);
    border-left: 3px solid var(--primary-color);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
}

.content-header {
    background: var(--bg-primary);
    padding: 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

/* Organization Badge */
.org-context {
    display: flex;
    align-items: center;
}

.org-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.org-badge i {
    font-size: 12px;
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.breadcrumb-item {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.breadcrumb-item:hover {
    color: var(--primary-color);
}

.breadcrumb-item.active {
    color: var(--text-primary);
    font-weight: 600;
}

.breadcrumb-separator {
    color: var(--text-secondary);
    opacity: 0.5;
}

/* User Profile Section */
.user-profile {
    display: flex;
    align-items: center;
    gap: 20px;
}

.org-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-right: 10px;
}

.org-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.plan-badge {
    display: inline-block;
    padding: 2px 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 2px;
}

.user-menu {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.user-menu-trigger:hover {
    border-color: var(--primary-color);
    background: white;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
}

.user-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.3;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: none;
    z-index: 1000;
}

.user-dropdown.show {
    display: block;
}

.dropdown-header {
    padding: 16px;
}

.dropdown-user-info {
    display: flex;
    flex-direction: column;
}

.dropdown-user-info strong {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.dropdown-user-info span {
    font-size: 13px;
    color: var(--text-secondary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.2s;
    cursor: pointer;
}

.dropdown-item:hover {
    background: var(--bg-secondary);
}

.dropdown-item svg {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

.dropdown-item:hover svg {
    opacity: 1;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Notifications System */
.notifications-container {
    position: relative;
}

.notifications-trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
}

.notifications-trigger:hover {
    border-color: var(--primary-color);
    background: white;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--error-color);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.notifications-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 380px;
    max-height: 500px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: none;
    z-index: 1000;
    overflow: hidden;
}

.notifications-dropdown.show {
    display: flex;
    flex-direction: column;
}

.notifications-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.notifications-header h3 {
    font-size: 16px;
    margin: 0;
}

.btn-text-link {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 13px;
    cursor: pointer;
    padding: 0;
}

.btn-text-link:hover {
    text-decoration: underline;
}

.notifications-list {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
}

.notification-item {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
    cursor: pointer;
}

.notification-item:hover {
    background: var(--bg-secondary);
}

.notification-item.unread {
    background: #f0f7ff;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-icon.success {
    background: rgba(0, 200, 83, 0.1);
    color: var(--success-color);
}

.notification-icon.info {
    background: rgba(0, 102, 255, 0.1);
    color: var(--primary-color);
}

.notification-icon.warning {
    background: rgba(255, 152, 0, 0.1);
    color: #FF9800;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.notification-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 6px 0;
    line-height: 1.4;
}

.notification-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.notifications-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.notifications-footer .btn-text-link {
    font-size: 14px;
}

.content-body {
    padding: 30px;
}

.page-actions {
    margin-bottom: 30px;
}

/* Card */
.card {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.card h3 {
    margin-bottom: 20px;
    font-size: 1.25rem;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Knowledge Base Section */
.knowledge-list {
    margin-top: 30px;
}

.knowledge-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.knowledge-list-header h3 {
    margin: 0;
    font-size: 1.5rem;
}

.knowledge-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box svg {
    position: absolute;
    left: 12px;
    opacity: 0.5;
}

.search-box input {
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    width: 240px;
    transition: all 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.view-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: 8px;
}

.view-toggle-btn {
    padding: 8px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-toggle-btn:hover {
    background: white;
    color: var(--text-primary);
}

.view-toggle-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Items List */
.items-list {
    display: grid;
    gap: 15px;
}

.items-list.grid-view {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.items-list.list-view {
    grid-template-columns: 1fr;
}

.items-list.grid-view .item {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
}

.items-list.grid-view .item-info {
    width: 100%;
}

.items-list.grid-view .item-actions {
    width: 100%;
    justify-content: flex-end;
}

.item {
    background: var(--bg-primary);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.item-info h4 {
    margin-bottom: 5px;
}

.item-info p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.item-actions {
    display: flex;
    gap: 10px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

/* Chat Sessions */
.chat-sessions {
    display: grid;
    gap: 20px;
}

.chat-session {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
}

.session-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.chat-message {
    padding: 12px;
    margin: 8px 0;
    border-radius: 8px;
}

.chat-message.user {
    background: #e3f2fd;
    margin-left: 20px;
}

.chat-message.assistant {
    background: var(--bg-secondary);
    margin-right: 20px;
}

.message-role {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 5px;
}

/* Code Block */
.code-block {
    position: relative;
    background: #1e1e1e;
    color: #d4d4d4;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    overflow-x: auto;
}

.code-block pre {
    margin: 0;
}

.code-block button {
    position: absolute;
    top: 10px;
    right: 10px;
}

.code-block .btn-outline {
    color: white !important;
    border-color: rgba(255, 255, 255, 0.3);
}

.code-block .btn-outline:hover {
    border-color: white;
    color: white !important;
}

.code-block .btn-outline .btn-text {
    color: white !important;
}

/* Deploy Info */
.deploy-info {
    margin-top: 30px;
}

.deploy-info h4 {
    margin-bottom: 15px;
}

.deploy-info ol {
    padding-left: 20px;
}

.deploy-info li {
    margin: 10px 0;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 15px 25px;
    background: var(--sidebar-bg);
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    pointer-events: none;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--error-color);
}

/* Settings Page Layout */
.settings-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.settings-form {
    height: fit-content;
}

/* Preview Card */
.preview-card {
    position: sticky;
    top: 20px;
    height: fit-content;
}

.preview-container {
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 500px;
    border-radius: 12px;
    padding: 20px;
    overflow: hidden;
}

.preview-button {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
}

.preview-button:hover {
    transform: scale(1.05);
}

.preview-button.bottom-right {
    bottom: 20px;
    right: 20px;
}

.preview-button.bottom-left {
    bottom: 20px;
    left: 20px;
}

.preview-button.top-right {
    top: 20px;
    right: 20px;
}

.preview-button.top-left {
    top: 20px;
    left: 20px;
}

.preview-button.small {
    width: 50px;
    height: 50px;
}

.preview-button.large {
    width: 70px;
    height: 70px;
}

.preview-chat {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 350px;
    height: 450px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.preview-chat.small {
    width: 300px;
    height: 400px;
}

.preview-chat.large {
    width: 400px;
    height: 500px;
}

.preview-chat-header {
    background: var(--primary-color);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s;
}

.preview-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.preview-chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f5f5f5;
}

.preview-message {
    margin-bottom: 15px;
    display: flex;
}

.preview-message.bot-message {
    justify-content: flex-start;
}

.preview-message.user-message {
    justify-content: flex-end;
}

.preview-message-content {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
}

.bot-message .preview-message-content {
    background: white;
    border: 1px solid #e0e0e0;
}

.user-message .preview-message-content {
    background: var(--primary-color);
    color: white;
}

.preview-chat-footer {
    padding: 15px;
    border-top: 1px solid #e0e0e0;
    background: white;
    display: flex;
    gap: 10px;
}

.preview-chat-footer input {
    flex: 1;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 14px;
}

.preview-chat-footer button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.preview-branding {
    padding: 8px 15px;
    background: #f9f9f9;
    border-top: 1px solid #e0e0e0;
    text-align: center;
    font-size: 11px;
    color: #999;
}

.preview-branding a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.preview-branding a:hover {
    text-decoration: underline;
}

@media (max-width: 1024px) {
    .settings-layout {
        grid-template-columns: 1fr;
    }
    
    .preview-card {
        position: relative;
        top: 0;
    }
}

/* Test Widget Page */
.test-container {
    max-width: 900px;
}

.test-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin: 30px 0;
}

.info-badge {
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid;
}

.info-badge strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1rem;
}

.info-badge p {
    font-size: 0.9rem;
    opacity: 0.9;
    margin: 0;
}

.info-success {
    background: #e8f5e9;
    border-color: var(--success-color);
    color: #2e7d32;
}

.info-primary {
    background: #e3f2fd;
    border-color: var(--primary-color);
    color: #1565c0;
}

.info-warning {
    background: #fff3e0;
    border-color: #ff9800;
    color: #e65100;
}

.test-actions {
    display: flex;
    gap: 15px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.test-instructions {
    margin: 30px 0;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.test-instructions h4 {
    margin-bottom: 15px;
}

.test-instructions ol {
    padding-left: 20px;
}

.test-instructions li {
    margin: 10px 0;
    line-height: 1.6;
}

.test-checklist {
    margin: 30px 0;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.test-checklist h4 {
    margin-bottom: 15px;
}

.checkbox-label {
    display: block;
    padding: 10px;
    margin: 5px 0;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.3s;
}

.checkbox-label:hover {
    background: white;
}

.checkbox-label input {
    margin-right: 10px;
    cursor: pointer;
}


/* Error Message */
.error-message {
    color: var(--error-color);
    font-size: 0.875rem;
    margin-top: 10px;
}

/* Global Search Modal */
.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    z-index: 2000;
    animation: fadeIn 0.2s ease;
}

.search-modal.show {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.search-modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 640px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.search-modal-header i {
    color: var(--text-secondary);
    font-size: 18px;
}

.search-modal-header input {
    flex: 1;
    border: none;
    font-size: 16px;
    outline: none;
}

.search-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.search-close:hover {
    background: var(--bg-secondary);
}

.search-shortcuts {
    display: flex;
    gap: 16px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.search-shortcut-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.search-shortcut-hint kbd {
    display: inline-block;
    padding: 2px 6px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 11px;
    font-family: monospace;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.search-section {
    margin-bottom: 20px;
}

.search-section h4 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin: 0 0 8px 12px;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.2s;
    cursor: pointer;
}

.search-result-item:hover,
.search-result-item.active {
    background: var(--bg-secondary);
}

.search-result-item i {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 8px;
    font-size: 16px;
    color: var(--primary-color);
}

.search-result-content {
    flex: 1;
}

.search-result-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.search-result-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

.search-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.search-empty i {
    font-size: 48px;
    opacity: 0.3;
    margin-bottom: 16px;
}

/* Responsive Design */

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 56px;
    height: 56px;
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

/* Tablet Styles (768px - 1024px) */
@media (max-width: 1024px) {
    .content-header {
        padding: 20px;
    }
    
    .knowledge-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .notifications-dropdown {
        width: 340px;
    }
}

/* Mobile Styles (max-width: 768px) */
@media (max-width: 768px) {
    .app-container {
        grid-template-columns: 1fr;
    }

    /* Hide sidebar by default on mobile */
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 1001;
        transition: left 0.3s ease;
    }
    
    .sidebar.mobile-open {
        left: 0;
        box-shadow: 4px 0 12px rgba(0, 0, 0, 0.3);
    }
    
    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: flex;
    }
    
    /* Mobile overlay */
    .mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
    }
    
    .mobile-overlay.show {
        display: block;
    }
    
    /* Adjust main content for mobile */
    .main-content {
        margin-left: 0;
    }

    /* Header adjustments */
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 15px;
    }
    
    .header-left {
        width: 100%;
    }
    
    .breadcrumbs {
        flex-wrap: wrap;
    }
    
    .breadcrumb-item {
        font-size: 13px;
    }
    
    .org-badge {
        font-size: 12px;
        padding: 5px 12px;
    }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .user-profile {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .org-info {
        align-items: flex-start;
    }
    
    .user-menu-trigger {
        width: 100%;
        justify-content: space-between;
    }
    
    /* Search modal mobile */
    .search-modal {
        padding-top: 20px;
    }
    
    .search-modal-content {
        width: 95%;
        max-height: 80vh;
    }
    
    .search-shortcuts {
        display: none;
    }
    
    /* Notifications and dropdowns */
    .notifications-dropdown,
    .user-dropdown {
        position: fixed;
        top: auto;
        bottom: 80px;
        left: 10px;
        right: 10px;
        width: auto;
        max-width: none;
    }
    
    .notifications-dropdown {
        max-height: 400px;
    }

    /* Content adjustments */
    .content-body {
        padding: 15px;
    }
    
    .content-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .card {
        padding: 20px;
    }
    
    /* Knowledge base mobile */
    .knowledge-list-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .knowledge-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-box {
        width: 100%;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .view-toggle {
        align-self: flex-end;
    }
    
    .items-list.grid-view {
        grid-template-columns: 1fr;
    }

    /* Form adjustments */
    .form-row {
        grid-template-columns: 1fr;
    }
    
    /* Settings page mobile */
    .settings-layout {
        grid-template-columns: 1fr;
    }
    
    .preview-card {
        position: relative;
        top: 0;
    }
    
    /* Table responsiveness */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    /* Button adjustments */
    .btn {
        width: 100%;
    }
    
    .item-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .item-actions .btn {
        width: 100%;
    }
}

/* Small Mobile (max-width: 480px) */
@media (max-width: 480px) {
    .content-header h1 {
        font-size: 1.25rem;
    }
    
    .user-avatar {
        width: 36px;
        height: 36px;
        font-size: 12px;
    }
    
    .user-name {
        font-size: 13px;
    }
    
    .user-role {
        font-size: 11px;
    }
    
    .notification-badge {
        font-size: 9px;
        padding: 1px 4px;
        min-width: 16px;
    }
    
    .card {
        padding: 15px;
    }
    
    .card h3 {
        font-size: 1.1rem;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .mobile-menu-toggle {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

/* Logo Upload Styles */
.logo-upload-container {
    display: flex;
    gap: 20px;
    align-items: center;
}

.current-logo {
    flex-shrink: 0;
}

.logo-preview {
    width: 100px;
    height: 100px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f9fafb;
    position: relative;
}

.logo-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
}

.logo-preview img[src*=".svg"] {
    object-fit: contain;
    padding: 12px;
}

.logo-upload-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.logo-upload-actions .btn {
    margin: 0;
}

/* Landscape mobile adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .content-header {
        flex-direction: row;
        align-items: center;
    }
    
    .header-actions {
        width: auto;
    }
}

/* Print styles */
@media print {
    .sidebar,
    .mobile-menu-toggle,
    .notifications-container,
    .user-menu,
    .btn,
    .page-actions {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .content-header {
        border-bottom: 2px solid #000;
    }
}

/* Team Management Styles */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.member-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: box-shadow 0.2s;
}

.member-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.member-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.member-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    flex-shrink: 0;
}

.member-details h3 {
    font-size: 16px;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.member-details p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 2px 0;
}

.member-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.role-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.role-owner {
    background: #fee;
    color: #c00;
}

.role-admin {
    background: #e3f2fd;
    color: #1976d2;
}

.role-member {
    background: #f3e5f5;
    color: #7b1fa2;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.btn-icon:hover {
    opacity: 1;
}

.invitation-card {
    background: #fff9e6;
    border: 1px solid #ffd966;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.invitation-info p {
    margin: 4px 0;
}

.invitation-info strong {
    color: var(--text-primary);
}

.expires-text {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal form {
    padding: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .team-grid {
        grid-template-columns: 1fr;
    }
    
    .member-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .member-actions {
        width: 100%;
        justify-content: space-between;
    }
}
