/* Custom Styles for HelpDesk System */

:root {
    --primary: #ef4136;
    --success: #198754;
    --danger: #dc3545;
    --light: #f8f9fa;
    --dark: #212529;
}

/* Force Bootstrap Overrides */
.text-primary {
    color: var(--primary) !important;
}

.bg-primary {
    background-color: var(--primary) !important;
}

.btn-primary {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.btn-primary:hover {
    background-color: #d32f2f !important;
    /* Darker shade for hover */
    border-color: #d32f2f !important;
}

.btn-outline-primary {
    color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.btn-outline-primary:hover {
    background-color: var(--primary) !important;
    color: #fff !important;
}

body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: #333;
}

/* Custom Header */
.navbar-custom {
    padding: 1rem 0;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.navbar-custom .navbar-brand {
    font-size: 1.5rem;
    letter-spacing: -0.5px;
}

.navbar-custom .nav-link {
    font-weight: 500;
    color: #495057;
    padding: 0.5rem 1rem !important;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.navbar-custom .nav-link:hover,
.navbar-custom .nav-link.active {
    color: var(--primary);
}

.btn-header-cta {
    background-color: var(--primary) !important;
    color: #fff !important;
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(239, 65, 54, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-header-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(239, 65, 54, 0.3);
}

.user-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    border: 1px solid #e9ecef;
    transition: all 0.2s;
}

.user-dropdown-toggle:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
}

/* Hero Section */
.hero-section {
    background: #fff;
    padding: 4rem 0;
    position: relative;
    overflow: hidden;
}

.hero-illustration {
    max-width: 100%;
    height: auto;
}

.search-box {
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border-radius: 50px;
    /* Pillow shape for modern look */
    background: #fff;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
    padding: 4px;
    /* Space for the button */
    display: flex;
    align-items: center;
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(239, 65, 54, 0.1);
}

.search-box .form-control {
    border: none;
    padding: 0.8rem 1.5rem;
    height: auto;
    font-size: 1rem;
    box-shadow: none !important;
    /* Remove individual input focus ring */
    background: transparent;
    border-radius: 50px;
}

.search-box .btn-search {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 0.8rem 1.8rem;
    /* Larger click area */
    margin: 0;
    /* Remove margin to integrate */
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.hero-section .text-muted {
    color: #6c757d !important;
}

.search-box .btn-search:hover {
    background: #d63025;
    /* Darker shade of brand red */
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 65, 54, 0.3);
}

/* Knowledge Base List Layout */
.kb-category-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 1rem;
    border-bottom: 2px solid #f8f9fa;
    padding-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kb-article-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.kb-article-list li {
    margin-bottom: 0.75rem;
}

.kb-article-list a {
    color: #555;
    text-decoration: none;
    display: flex;
    align-items: flex-start;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.kb-article-list a:hover {
    color: var(--primary);
}

.kb-article-list i {
    color: #adb5bd;
    margin-right: 0.5rem;
    margin-top: 3px;
    font-size: 1rem;
}

/* CTA Footer */
.cta-footer {
    background: #fff;
    border-top: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
}

.cta-card {
    border: 1px dashed #ced4da;
    border-radius: 12px;
    background: #f8f9fa;
}

.icon-box {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* KB Article Card Layout */
.kb-article-card {
    background: #fff;
    padding: 2rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
    position: relative;
}

/* Title & Helpful Count Container */
.kb-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.kb-article-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 0px;
    line-height: 1.4;
    flex: 1;
    padding-right: 1rem;
}

.kb-article-title a {
    color: #212529;
    text-decoration: none;
    transition: color 0.2s;
}

.kb-article-title a:hover {
    color: #000;
}

.kb-helpful-count {
    font-size: 0.8rem;
    color: #6c757d;
    font-weight: 500;
    white-space: nowrap;
}

.kb-meta {
    font-size: 0.75rem;
    color: #6c757d;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.kb-meta i {
    font-size: 0.8rem;
    margin-right: 5px;
}

.kb-excerpt {
    font-size: 0.95rem;
    color: #6c757d;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.kb-read-more {
    font-size: 0.9rem;
    font-weight: 700;
    color: #212529;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.kb-read-more:hover {
    color: #000;
    text-decoration: none;
}

.kb-read-more i {
    font-size: 0.8rem;
    margin-left: 5px;
    font-weight: 700;
}

/* Custom Pagination */
.pagination-custom .page-item {
    margin: 0 4px;
}

.pagination-custom .page-link {
    border: 1px solid #e9ecef;
    color: #212529;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    background: #fff;
    border-radius: 4px;
}

.pagination-custom .page-item.active .page-link {
    background-color: #212529;
    border-color: #212529;
    color: #fff;
}

.pagination-custom .page-link:hover {
    background-color: #f8f9fa;
    color: #000;
}


/* Helpful Buttons */
.helpful-btn {
    transition: all 0.2s;
}

.helpful-btn:active {
    transform: scale(0.95);
}

.helpful-btn.voted {
    pointer-events: none;
    opacity: 0.6;
}

/* Ticket Status Badges */
.badge.status-open {
    background-color: #0dcaf0;
}

.badge.status-in_progress {
    background-color: #ffc107;
}

.badge.status-resolved {
    background-color: #198754;
}

.badge.status-closed {
    background-color: #6c757d;
}

/* Priority Badges */
.badge.priority-low {
    background-color: #6c757d;
}

.badge.priority-medium {
    background-color: #0dcaf0;
}

.badge.priority-high {
    background-color: #ffc107;
}

.badge.priority-urgent {
    background-color: #dc3545;
}

/* Ticket Timeline */
.ticket-timeline {
    position: relative;
    padding-left: 2rem;
}

.ticket-timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e9ecef;
}

.timeline-item {
    position: relative;
    padding-bottom: 2rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.4rem;
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #e9ecef;
}

.timeline-item.internal-note {
    background-color: #fff3cd;
    padding: 1rem;
    border-radius: 8px;
    margin-left: -0.5rem;
}

.timeline-item.internal-note::before {
    background: #ffc107;
}

/* Form Styling */
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(239, 65, 54, 0.25);
}

/* Admin Sidebar */
.admin-sidebar {
    min-height: 100vh;
    background: #fff5f5;
    /* Darker slate blue/grey for premium feel */
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.02);
}

.admin-sidebar .nav-link {
    color: #94a3b8;
    padding: 0.85rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 0.25rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.admin-sidebar .nav-link:hover {
    color: #000000;
    background-color: rgba(255, 255, 255, 0.05);
    transform: translateX(4px);
}

.admin-sidebar .nav-link.active {
    color: #fff;
    background: linear-gradient(90deg, var(--primary) 0%, #ff6b6b 100%);
    box-shadow: 0 4px 12px rgba(239, 65, 54, 0.3);
}

.admin-sidebar .nav-link i {
    font-size: 1.1rem;
    opacity: 0.8;
}

/* Dashboard Stats Cards */
.stat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
    border-color: transparent;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.bg-soft-primary {
    background-color: rgba(239, 65, 54, 0.1);
    color: var(--primary);
}

.bg-soft-warning {
    background-color: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

.bg-soft-success {
    background-color: rgba(25, 135, 84, 0.1);
    color: #198754;
}

.bg-soft-info {
    background-color: rgba(13, 202, 240, 0.1);
    color: #0dcaf0;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.25rem;
    line-height: 1;
}

.stat-label {
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Modern Tables */
.table-responsive {
    border-radius: 12px;
    background: #fff;
}

.table thead th {
    background: #f8fafc;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-section {
        padding: 3rem 0 !important;
    }

    .search-btn {
        position: static !important;
        margin-top: 0.5rem;
        width: 100%;
    }

    .icon-box {
        width: 50px;
        height: 50px;
    }
}

/* Loading Spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* CTA Section */
.cta-section .card {
    border-width: 2px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

/* Footer Hover Effect */
.hover-white:hover {
    color: #fff !important;
    transition: color 0.3s ease;
}

.ls-1 {
    letter-spacing: 1px;
}

/* Light Footer Hover Effect */
.hover-primary:hover {
    color: var(--primary) !important;
    transition: color 0.3s ease;
}

/* Breadcrumb Customization */
.breadcrumb {
    background: transparent !important;
    padding: 0 !important;
    margin-bottom: 0.5rem;
}

.breadcrumb-item {
    font-size: 0.95rem;
    font-weight: 500;
}

.breadcrumb-item a {
    color: #212529;
    /* Dark text */
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-item a:hover {
    color: var(--primary);
    /* Brand color on hover */
}

.breadcrumb-item.active {
    color: #6c757d;
    /* Muted for active page */
}

/* Chevron Separator */
.breadcrumb-item+.breadcrumb-item::before {
    content: "\F285";
    /* Bootstrap Icon Chevron Right */
    font-family: "bootstrap-icons";
    color: #6c757d;
    font-size: 0.8rem;
    padding-top: 3px;
}

/* CTA Icon Animation */
.cta-icon {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.cta-section:hover .cta-icon {
    transform: scale(1.1) rotate(5deg);
    opacity: 1 !important;
    color: var(--primary) !important;
}

/* Brand Outline Button */
.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(239, 65, 54, 0.3);
}

/* Brand Primary Button */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background-color: #d63026;
    border-color: #d63026;
}

/* FAQ Header Gradient */
.bg-gradient-brand {
    background: linear-gradient(135deg, var(--primary) 0%, #000000 100%);
}

/* Popular Topic Pills */
.topic-pill {
    background: #fff;
    color: #6c757d;
    border: 1px solid #e9ecef;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.topic-pill:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(239, 65, 54, 0.2);
}

/* Knowledge Base Card Grid Layout */
.kb-card {
    background: #fff;
    border: 1px solid #eff2f5;
    border-radius: 16px;
    padding: 1.8rem;
    height: 100%;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
}

.kb-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
    border-color: rgba(239, 65, 54, 0.2);
}

/* Subtle top border bar for brand color pop */
.kb-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.kb-card:hover::before {
    opacity: 1;
}

.kb-card-header {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kb-card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
    display: flex;
    align-items: center;
}

.kb-icon-wrapper {
    width: 40px;
    height: 40px;
    background: rgba(239, 65, 54, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    color: var(--primary);
    transition: all 0.3s ease;
}

.kb-card:hover .kb-icon-wrapper {
    background: var(--primary);
    color: #fff;
    transform: rotate(-10deg);
}

.kb-article-item {
    display: flex;
    align-items: center;
    padding: 0.6rem 0;
    color: #555;
    text-decoration: none;
    transition: all 0.2s ease;
    border-bottom: 1px dashed #f0f0f0;
}

.kb-article-item:last-child {
    border-bottom: none;
}

.kb-article-item:hover {
    color: var(--primary);
    padding-left: 5px;
}

.kb-article-item i {
    font-size: 14px;
    margin-right: 10px;
    color: #adb5bd;
    transition: color 0.2s ease;
}

.kb-article-item:hover i {
    color: var(--primary);
}


/* Mobile Responsiveness */
@media (max-width: 768px) {
    .hero-section {
        padding: 3rem 0;
        text-align: center;
    }

    .hero-illustration {
        margin-top: 2rem;
        max-width: 80%;
    }

    .search-box {
        margin: 0 auto;
    }

    .kb-card {
        margin-bottom: 1rem;
    }

    .kb-category-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .topic-pill {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    /* Ensure tables roll horizontally if needed */
    .table-responsive {
        overflow-x: auto;
    }

    /* Admin Sidebar Mobile */
    .admin-sidebar {
        position: fixed;
        /* Fixed on mobile for better UX */
        top: 60px;
        /* Below navbar roughly */
        left: 0;
        bottom: 0;
        width: 250px;
        z-index: 1040;
        padding-top: 1rem;
        transition: transform 0.3s ease;
    }

    /* When collapsed (default on mobile via d-md-block logic + collapse class handling) */
    /* When collapsed (default on mobile via d-md-block logic + collapse class handling) */
    .admin-sidebar:not(.show) {
        /* Bootstrap collapse handles display:none */
        transform: translateX(-100%);
    }

    .admin-sidebar.show {
        transform: translateX(0);
    }

    /* Breadcrumbs Mobile */
    .breadcrumb-item {
        font-size: 0.85rem;
    }

    /* Overlay background when sidebar is open (optional, but good) */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1030;
    }

    .sidebar-overlay.show {
        display: block;
    }
}

/* Desktop Sidebar Reset */
@media (min-width: 768px) {
    .admin-sidebar {
        position: sticky !important;
        top: 0;
        height: 100vh;
        z-index: 100 !important;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.02);
    }

    /* Utility for auto width on desktop */
    .w-md-auto {
        width: auto !important;
    }
}