/*
Theme Name: Asystio Support Theme
Theme URI: https://videohub360.example.com/asystio-support-theme
Author: Your Name
Author URI: https://videohub360.example.com
Description: A lightweight, documentation‑friendly theme built to integrate perfectly with the Asystio support ticket plugin. It automatically creates the key support portal pages on activation and applies a clean, modern layout to your support area.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: support, ticket, portal, responsive, clean
Text Domain: asystio-support-theme
*/

/*
 * Base styles
 *
 * These styles provide a minimalist layout that complements the Asystio plugin. Feel free to
 * customise colours, spacing and fonts to match your brand. The theme relies primarily on
 * modern CSS (flexbox and variables) for layout.
 */

/* CSS custom properties for easy theming */
:root {
    --primary-color: #2b7a78;
    --secondary-color: #3aafa9;
    --background-color: #f6f6f6;
    --text-color: #222;
    --heading-color: #17252a;
    --border-radius: 4px;

    /*
     * Additional colour variables used throughout the theme.
     * These variables allow site owners to customise the look and feel of
     * the support portal via the WordPress Customizer.  Each element of
     * the design (header, footer, documentation sidebar, etc.) is mapped
     * to its own variable so colours can be changed independently.
     */
    --header-bg-color: var(--primary-color);
    --header-text-color: #ffffff;
    --footer-bg-color: var(--primary-color);
    --footer-text-color: #ffffff;
    /* Documentation (Docs) template variables */
    --docs-sidebar-bg-color: #20242b;
    --docs-sidebar-text-color: #e5e7eb;
    --docs-sidebar-link-color: #d1d5db;
    --docs-sidebar-hover-bg-color: rgba(255, 255, 255, 0.06);
    --docs-sidebar-active-bg-color: #111827;
    --docs-title-bg-color: #005aaa;
    --docs-title-text-color: #ffffff;
    --docs-card-bg-color: #ffffff;
    --docs-table-header-bg-color: #f3f4f6;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
    color: var(--text-color);
    background-color: var(--background-color);
    line-height: 1.6;
}

a {
    color: var(--secondary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Site header */
.site-header {
    /* Use customisable header variables instead of fixed primary colour */
    background-color: var(--header-bg-color);
    color: var(--header-text-color);
    padding: 1rem 2rem;
}

.site-header .site-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.site-header nav {
    margin-top: 0.5rem;
}

.site-header nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 1rem;
}

.site-header nav ul li {
    margin: 0;
}

.site-header nav ul li a {
    /* adjust link colour relative to header text for better contrast */
    color: var(--header-text-color);
    font-weight: 500;
}

.site-header nav ul li a:hover {
    color: var(--header-text-color);
}

/* Content container */
.site-content {
    max-width: 960px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Footer */
.site-footer {
    /* Footer colours driven by variables for customisation */
    background-color: var(--footer-bg-color);
    color: var(--footer-text-color);
    text-align: center;
    padding: 1rem 2rem;
    margin-top: 3rem;
}

/* Asystio specific styles */
.asystio-dashboard table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.asystio-dashboard th,
.asystio-dashboard td {
    padding: 0.75rem;
    border: 1px solid #dee2e6;
    text-align: left;
}

.asystio-dashboard th {
    background-color: var(--primary-color);
    color: #fff;
}

.asystio-dashboard tr:nth-child(even) {
    background-color: #ffffff;
}

.asystio-dashboard tr:nth-child(odd) {
    background-color: #f1f1f1;
}

.asystio-dashboard .asystio-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
}

/* Badge colours for ticket statuses */
.asystio-badge-open { background-color: #28a745; }
.asystio-badge-pending { background-color: #ffc107; }
.asystio-badge-in-progress { background-color: #17a2b8; }
.asystio-badge-on-hold { background-color: #6c757d; }
.asystio-badge-resolved { background-color: #007bff; }
.asystio-badge-closed { background-color: #343a40; }

.asystio-form label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.asystio-form input[type="text"],
.asystio-form input[type="email"],
.asystio-form textarea,
.asystio-form select {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
    background-color: #fff;
}

.asystio-form button[type="submit"],
.asystio-form input[type="submit"] {
    background-color: var(--secondary-color);
    color: #fff;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
}

.asystio-form button[type="submit"]:hover,
.asystio-form input[type="submit"]:hover {
    background-color: var(--primary-color);
}

/* Responsiveness */
@media (max-width: 600px) {
    .site-header nav ul {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* ---------------------------------------------------------------------------
 * Enhanced header and user menu styles
 *
 * These rules support the custom header layout introduced in version 1.1 of
 * the Asystio Support Theme.  The header now contains a flexible inner
 * container, a site actions section with Submit Ticket and My Tickets links,
 * a user menu with avatar dropdown, and a dark mode toggle.  The dark mode
 * toggle switches the CSS variables defined at the top of the stylesheet.
 * -------------------------------------------------------------------------*/

/* Flex layout for header content */
.site-header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

/* Branding */
.site-branding {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Primary navigation */
.primary-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 1rem;
}
.primary-navigation li {
    margin: 0;
}
.primary-navigation li a {
    color: #e8f0f2;
    font-weight: 500;
    text-decoration: none;
}
.primary-navigation li a:hover {
    color: #ffffff;
    text-decoration: none;
}

/* Site actions (Submit Ticket, My Tickets, login/register links) */
.site-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}
/* Default desktop layout for the nav wrapper */
.site-header-nav-wrapper {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 1rem;
}
.primary-navigation {
    flex: 1;
}
.primary-navigation ul {
    display: flex;
    justify-content: center;
    gap: 1rem;
}
.site-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.ast-action-link {
    color: #e8f0f2;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    border-radius: var(--border-radius);
    border: 1px solid transparent;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.ast-action-link:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}
.ast-action-link-primary {
    background-color: var(--secondary-color);
    color: #ffffff;
    border-color: var(--secondary-color);
}
.ast-action-link-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
}

/* User menu styles */
.ast-user-menu {
    position: relative;
}
.ast-user-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #e8f0f2;
    padding: 0;
}
.ast-user-avatar img {
    border-radius: 50%;
    width: 32px;
    height: 32px;
}
.ast-user-caret {
    font-size: 0.7rem;
    line-height: 1;
}
.ast-user-menu-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    background-color: #ffffff;
    color: #333333;
    border: 1px solid #e0e0e0;
    border-radius: var(--border-radius);
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
    display: none;
}
.ast-user-menu-dropdown.is-open {
    display: block;
}
.ast-user-menu-header {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #e0e0e0;
}
.ast-user-menu-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
}
.ast-user-menu-name {
    margin-top: 0.25rem;
}
.ast-user-menu-section {
    border-top: 1px solid #e0e0e0;
}
.ast-user-menu-item {
    display: block;
    padding: 0.5rem 1rem;
    color: #333333;
    font-size: 0.9rem;
    text-decoration: none;
}
.ast-user-menu-item:hover {
    background-color: #f5f5f5;
}
.ast-user-menu-item-danger {
    color: #b91c1c;
}
.ast-user-menu-guest {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Dark mode styles */
body.dark-mode {
    --primary-color: #263849;
    --secondary-color: #1e88e5;
    --background-color: #1a1a1a;
    --text-color: #e5e5e5;
    --heading-color: #f5f5f5;
}
body.dark-mode {
    background-color: var(--background-color);
    color: var(--text-color);
}
body.dark-mode .site-header,
body.dark-mode .site-footer {
    background-color: var(--primary-color);
    color: var(--text-color);
}
body.dark-mode .primary-navigation li a {
    color: #c3d1dc;
}
body.dark-mode .primary-navigation li a:hover {
    color: #ffffff;
}
body.dark-mode .ast-action-link {
    color: #c3d1dc;
}
body.dark-mode .ast-action-link:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}
body.dark-mode .ast-action-link-primary {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: #ffffff;
}
body.dark-mode .ast-action-link-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
}
body.dark-mode .ast-user-menu-dropdown {
    background-color: #263849;
    border-color: #334e68;
    color: #e5e5e5;
}
body.dark-mode .ast-user-menu-item:hover {
    background-color: #1d2c3b;
}

/* Responsive adjustments for the header and actions */
@media (max-width: 600px) {
    /* Keep the header items in a row on very small screens; the nav
       wrapper is hidden by default and toggled via the hamburger icon. */
    .site-header-inner {
        flex-wrap: wrap;
        align-items: center;
    }
    .site-actions {
        margin-top: 0;
        flex-wrap: wrap;
    }
}

/* ---------------------------------------------------------------------------
 * Mobile navigation toggle styles
 *
 * The toggle button appears on screens narrower than 768px.  When clicked,
 * it reveals the navigation wrapper containing the primary menu and the
 * site actions.  The toggle is hidden on larger screens.
 * -------------------------------------------------------------------------*/
.ast-mobile-nav-toggle {
    display: none;
    background: transparent;
    border: none;
    color: #e8f0f2;
    font-size: 1.5rem;
    cursor: pointer;
    align-items: center;
}
.ast-mobile-nav-icon {
    width: 20px;
    height: 2px;
    background-color: #e8f0f2;
    position: relative;
    display: block;
}
.ast-mobile-nav-icon::before,
.ast-mobile-nav-icon::after {
    content: '';
    width: 20px;
    height: 2px;
    background-color: #e8f0f2;
    position: absolute;
    left: 0;
}
.ast-mobile-nav-icon::before {
    top: -6px;
}
.ast-mobile-nav-icon::after {
    top: 6px;
}

@media (max-width: 768px) {
    .ast-mobile-nav-toggle {
        display: inline-flex;
        margin-left: auto;
    }
    .site-header-nav-wrapper {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 1rem;
        margin-top: 1rem;
    }
    .site-header-nav-wrapper.is-open {
        display: flex;
    }
    .primary-navigation ul {
        flex-direction: column;
        width: 100%;
    }
    .primary-navigation li a {
        display: block;
        padding: 0.5rem 0;
    }
    .site-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        width: 100%;
    }
    /* Place the user avatar or guest links to the far right on mobile so they
       remain visible even when the navigation is collapsed. */
    .ast-user-menu,
    .ast-user-menu-guest {
        margin-left: auto;
        align-self: center;
    }
}

/* ---------------------------------------------------------------------------
 * Documentation layout styles
 *
 * The old docs layout styles have been removed in favor of the new
 * Aardvark-style docs shell (see below).  This placeholder comment
 * remains to document that the earlier `.ast-docs-layout` based rules
 * were intentionally deleted to avoid conflicts.
 * ---------------------------------------------------------------------------*/

/* ------------------------------------------------------------------
 * Documentation layout – Aardvark-style
 * This section customises the Documentation template to provide a
 * two-column shell with a dark, fixed sidebar and a white content
 * panel similar to the Aardvark documentation site.  It also
 * defines styles for the title bar, content card and table
 * appearance.  Adjust colours to suit your brand.
 * ------------------------------------------------------------------ */

/* Light grey page background behind the docs shell and make it full width */
.page-template-page-docs .site-content {
    /* Background colour for the docs area */
    background: #f3f4f6;
    /* Override global container width to allow full-width docs layout */
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0;
}

/* Overall docs layout: left sidebar + right content area */
.ast-docs-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: calc(100vh - 64px);
}

/* Left dark sidebar */
.ast-docs-sidebar {
    /* Docs sidebar colours can be customised */
    background: var(--docs-sidebar-bg-color);
    color: var(--docs-sidebar-text-color);
}

/* Sidebar inner wrapper: sticky and scrollable */
.ast-docs-sidebar-inner {
    position: sticky;
    top: 64px;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    padding: 1.5rem 1.25rem 2rem;
}

/* Logo at top of sidebar */
.ast-docs-logo {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

/* Sidebar menu links */
.ast-docs-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.9rem;
}

.ast-docs-menu li {
    margin-bottom: 0.25rem;
}

.ast-docs-menu a {
    display: block;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    color: var(--docs-sidebar-link-color);
    text-decoration: none;
}

.ast-docs-menu a:hover {
    background: var(--docs-sidebar-hover-bg-color);
    color: var(--docs-title-text-color);
}

/* Highlight current page and ancestors */
.ast-docs-menu .current-menu-item > a,
.ast-docs-menu .current-menu-ancestor > a {
    background: var(--docs-sidebar-active-bg-color);
    color: var(--docs-title-text-color);
    font-weight: 600;
}

/* Right content area */
.ast-docs-main {
    padding: 2rem 3rem;
}

/* Top title bar inside docs main */
.ast-docs-header {
    /* Docs header colours are now customisable */
    background: var(--docs-title-bg-color);
    color: var(--docs-title-text-color);
    padding: 1.25rem 1.5rem;
    border-radius: 6px 6px 0 0;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
}

.ast-docs-title {
    margin: 0;
    font-size: 1.6rem;
}

/* White content card under the title */
.ast-docs-card {
    /* Docs content card background is customisable */
    background: var(--docs-card-bg-color);
    border-radius: 0 0 6px 6px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    padding: 1.75rem 1.75rem 2.5rem;
}

/* Adjust max width for docs content */
.ast-docs-content {
    max-width: 900px;
}

/* Table styling within docs */
.ast-docs-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}

.ast-docs-content th,
.ast-docs-content td {
    border: 1px solid #e5e7eb;
    padding: 0.6rem 0.8rem;
}

.ast-docs-content thead th {
    background: var(--docs-table-header-bg-color);
    font-weight: 600;
}

/* Responsive adjustments for docs */
@media (max-width: 1024px) {
    .ast-docs-shell {
        grid-template-columns: 1fr;
    }
    .ast-docs-sidebar-inner {
        position: static;
        max-height: none;
    }
    .ast-docs-main {
        padding: 1.5rem 1.25rem 2.5rem;
    }
}

/* ---------------------------------------------------------------------------
 * Knowledge base layout styles
 *
 * Provides a clean layout for the knowledge base template with a search
 * bar, results list, and a call to action.  It adapts to different screen
 * sizes and uses CSS variables for colours.
 * -------------------------------------------------------------------------*/
.ast-kb-layout {
    max-width: 960px;
    margin: 2rem auto;
    padding: 0 1rem;
}
.ast-kb-header {
    text-align: center;
    margin-bottom: 2rem;
}
.ast-kb-search {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1rem;
}
.ast-kb-search input[type="search"] {
    flex: 1;
    max-width: 300px;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
}
.ast-kb-search button {
    padding: 0.5rem 1rem;
    background-color: var(--secondary-color);
    color: #fff;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
}
.ast-kb-search button:hover {
    background-color: var(--primary-color);
}
.ast-kb-results .ast-kb-article {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 1rem;
}
.ast-kb-results .ast-kb-question {
    font-size: 1.25rem;
    margin: 0 0 0.5rem;
}
.ast-kb-results .ast-kb-excerpt {
    color: var(--text-color);
}
.ast-kb-cta {
    margin-top: 2rem;
    text-align: center;
}
.ast-kb-cta .ast-button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: #fff;
    border-radius: var(--border-radius);
    text-decoration: none;
}
.ast-kb-cta .ast-button:hover {
    background-color: var(--secondary-color);
    color: #fff;
}

/* ---------------------------------------------------------------------------
 * Global support ribbon
 *
 * A fixed bar displayed below the header inviting users to open a ticket.
 * It uses the secondary colour and white text.  Adjust spacing as needed.
 * -------------------------------------------------------------------------*/
.ast-support-ribbon {
    background-color: var(--secondary-color);
    color: #ffffff;
    text-align: center;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}
.ast-support-ribbon a {
    color: #ffffff;
    text-decoration: underline;
    font-weight: 600;
}

/* ---------------------------------------------------------------------------
 * Enhanced ticket search styles
 *
 * These styles provide visual enhancements for the ticket search functionality
 * on the support dashboard, including a search icon, clear button, and
 * highlighted search terms in results.
 * -------------------------------------------------------------------------*/

/* Container for all filter inputs including search */
.asystio-ticket-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

/* Wrapper for search input with clear button */
.ast-search-wrapper {
    position: relative;
    flex: 1;
    min-width: 250px;
}

/* Search input with magnifying glass icon */
.ast-search-wrapper input[type="text"],
.ast-search-wrapper input[type="search"] {
    width: 100%;
    padding: 0.5rem 2.5rem 0.5rem 2.5rem;
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 0.75rem center;
    background-size: 16px 16px;
    transition: border-color 0.2s ease;
}

.ast-search-wrapper input[type="text"]:focus,
.ast-search-wrapper input[type="search"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Clear button (×) positioned on the right */
.ast-search-clear {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #6b7280;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.ast-search-clear:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text-color);
}

.ast-search-clear:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Highlighted search terms in results */
mark {
    background-color: #fef3c7;
    color: inherit;
    padding: 0.1rem 0.2rem;
    border-radius: 2px;
    font-weight: 500;
}

/* Filter selects styling */
.asystio-ticket-filters select {
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
    background-color: #fff;
    min-width: 150px;
    transition: border-color 0.2s ease;
}

.asystio-ticket-filters select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.asystio-ticket-filters select:hover {
    border-color: var(--secondary-color);
}

/* Responsive styles for mobile devices */
@media (max-width: 768px) {
    .asystio-ticket-filters {
        flex-direction: column;
        gap: 0.75rem;
    }

    .ast-search-wrapper {
        min-width: 100%;
    }

    .asystio-ticket-filters select {
        width: 100%;
    }
}

/* Dark mode adjustments for search */
body.dark-mode .ast-search-wrapper input[type="text"],
body.dark-mode .ast-search-wrapper input[type="search"] {
    background-color: #263849;
    border-color: #334e68;
    color: #e5e5e5;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23c3d1dc' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
}

body.dark-mode .asystio-ticket-filters select {
    background-color: #263849;
    border-color: #334e68;
    color: #e5e5e5;
}

body.dark-mode .ast-search-clear {
    color: #c3d1dc;
}

body.dark-mode .ast-search-clear:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

body.dark-mode mark {
    background-color: #854d0e;
    color: #fef3c7;
}