/**
 * Zapnio Knowledge Base - Main Styles
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #667eea;
    font-weight: bold;
    font-size: 18px;
}

.header-title {
    font-size: 24px;
    font-weight: 600;
}

.header-search {
    flex: 1;
    max-width: 500px;
    margin: 0 2rem;
    position: relative;
}

.header-search form {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    background: rgba(255,255,255,0.1);
    color: white;
    backdrop-filter: blur(10px);
}

.search-input::placeholder {
    color: rgba(255,255,255,0.7);
}

.search-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    font-size: 18px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.back-to-crm {
    background: rgba(255,255,255,0.1);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.back-to-crm:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-1px);
}

/* Main Container */
.container {
    display: flex;
    /* margin-top: 70px; */
    min-height: calc(100vh - 70px);
}

/* Sidebar */
.sidebar {
    width: 300px;
    background: white;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    padding: 2rem 0;
    overflow-y: auto;
    position: fixed;
    left: 0;
    top: 70px;
    bottom: 0;
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-title {
    font-size: 14px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0 1.5rem;
    margin-bottom: 1rem;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 4px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 1.5rem;
    color: #555;
    text-decoration: none;
    transition: all 0.3s ease;
    border-right: 3px solid transparent;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: #f8f9fa;
    color: #667eea;
    border-right-color: #667eea;
}

.sidebar-menu a i {
    width: 20px;
    margin-right: 12px;
    font-size: 16px;
}

.badge {
    background: #e74c3c;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 300px;
    padding: 2rem;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2rem;
    font-size: 14px;
    color: #666;
}

.breadcrumb a {
    color: #667eea;
    text-decoration: none;
}

/* Welcome Section */
.welcome-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 3rem 2rem;
    border-radius: 12px;
    margin-bottom: 3rem;
    text-align: center;
}

.welcome-section h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 300;
}

.welcome-section p {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.action-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.action-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.action-card i {
    font-size: 2.5rem;
    color: #667eea;
    margin-bottom: 1rem;
}

.action-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.action-card p {
    color: #666;
    font-size: 0.95rem;
}

/* Content Sections */
.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.content-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    overflow: hidden;
}

.section-header {
    background: #f8f9fa;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #eee;
}

.section-header h2 {
    font-size: 1.4rem;
    color: #333;
    margin-bottom: 0.5rem;
}

.section-header p {
    color: #666;
    font-size: 0.9rem;
}

.section-content {
    padding: 2rem;
}

/* Article List */
.article-list {
    list-style: none;
}

.article-item {
    padding: 1rem 0;
    border-bottom: 1px solid #f0f0f0;
}

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

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

.article-item a:hover {
    color: #667eea;
}

.article-title {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.article-meta {
    font-size: 0.85rem;
    color: #888;
    display: flex;
    align-items: center;
    gap: 15px;
}

/* FAQ Section */
.faq-item {
    margin-bottom: 1rem;
}

.faq-question {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease;
}

.faq-question:hover {
    background: #e9ecef;
}

.faq-answer {
    padding: 1rem;
    color: #666;
    display: none;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
}

/* Featured Articles */
.featured-articles {
    margin-top: 3rem;
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.featured-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.featured-card:hover {
    transform: translateY(-5px);
}

.featured-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.featured-content {
    padding: 1.5rem;
}

.featured-content h3 {
    margin-bottom: 0.5rem;
}

.featured-content h3 a {
    color: #333;
    text-decoration: none;
}

.featured-content h3 a:hover {
    color: #667eea;
}

.featured-content p {
    color: #666;
    margin-bottom: 1rem;
}

.featured-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #888;
}

.category {
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    border-left: 4px solid;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left-color: #28a745;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border-left-color: #dc3545;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-left-color: #ffc107;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left-color: #17a2b8;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .header-search {
        display: none;
    }
    
    .welcome-section h1 {
        font-size: 2rem;
    }
    
    .quick-actions {
        grid-template-columns: 1fr;
    }
    
    .featured-grid {
        grid-template-columns: 1fr;
    }
}

/* Header Search with Autocomplete */
.header-search {
    position: relative;
    max-width: 400px;
    width: 100%;
}

.search-form {
    position: relative;
    width: 100%;
}

.search-input-group {
    display: flex;
    background: white;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    border: 1px solid #e5e7eb;
}

.search-input-group:focus-within {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
    border-color: #3b82f6;
}

.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    font-size: 0.875rem;
    color: #374151;
    min-width: 0; /* Prevents flex overflow */
}

.search-input:focus {
    outline: none;
}

.search-input::placeholder {
    color: #9ca3af;
}

.search-btn {
      color: #3b82f6;
}

.search-btn:hover {
    color: #051530;
}

.search-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* Search Suggestions Dropdown */
.search-suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 0.5rem 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.suggestions-list {
    padding: 0.5rem 0;
}

.suggestions-header {
    padding: 0.75rem 1rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #f3f4f6;
    background: #f9fafb;
}

.suggestion-item {
    display: block;
    padding: 0.75rem 1rem;
    color: #374151;
    text-decoration: none;
    border-bottom: 1px solid #f9fafb;
    transition: all 0.15s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.suggestion-item:hover,
.suggestion-item.active {
    background-color: #f0f9ff;
    color: #1e40af;
}

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

.suggestion-item.view-all {
    background: #f9fafb;
    font-weight: 500;
    color: #3b82f6;
    border-top: 1px solid #e5e7eb;
}

.suggestion-item.view-all:hover {
    background: #f0f9ff;
    color: #1d4ed8;
}

.suggestion-item mark {
    background: #fef3c7;
    color: #92400e;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-weight: 500;
}

.suggestion-icon {
    color: #9ca3af;
    font-size: 0.875rem;
    width: 16px;
    flex-shrink: 0;
}

/* Header Layout Adjustments */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 2rem;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
}

.header-actions {
    flex-shrink: 0;
}

.back-to-crm {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #f3f4f6;
    color: #374151;
    text-decoration: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.back-to-crm:hover {
    background: #e5e7eb;
    text-decoration: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .header {
        flex-wrap: wrap;
        gap: 1rem;
        padding: 1rem;
    }
    
    .header-search {
        order: 3;
        width: 100%;
        max-width: none;
        margin-top: 0.5rem;
    }
    
    .search-input {
        font-size: 0.875rem;
        padding: 0.625rem 0.875rem;
    }
    
    .search-btn {
        padding: 0.625rem 0.875rem;
        min-width: 40px;
    }
    
    .logo-section {
        flex: 1;
    }
    
    .header-actions {
        order: 2;
    }
    
    .back-to-crm {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }
    
    .header-title {
        font-size: 1.125rem;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0.75rem;
    }
    
    .header-title {
        font-size: 1rem;
    }
    
    .logo {
        width: 36px;
        height: 36px;
        font-size: 1.125rem;
    }
    
    .search-input {
        padding: 0.5rem 0.75rem;
    }
    
    .search-btn {
        padding: 0.5rem 0.75rem;
        min-width: 36px;
    }
    
    .back-to-crm span {
        display: none; /* Hide text, keep icon */
    }
}