/* stylelint-disable no-descending-specificity */
/**
 * ITSM Helpdesk — Portal styles.
 *
 * Standalone stylesheet (not loaded via wp_enqueue). Bypasses theme entirely.
 * Uses CSS custom properties for easy theming.
 */

/* -------------------------------------------------------------------------
   Custom properties.
   ------------------------------------------------------------------------- */

:root {
    --itsm-primary: #2271b1;
    --itsm-primary-hover: #135e96;
    --itsm-success: #00a32a;
    --itsm-danger: #d63638;
    --itsm-warning: #dba617;
    --itsm-info: #72aee6;
    --itsm-text: #1d2327;
    --itsm-text-light: #646970;
    --itsm-bg: #f0f0f1;
    --itsm-card-bg: #ffffff;
    --itsm-border: #c3c4c7;
    --itsm-border-light: #e0e0e0;
    --itsm-radius: 4px;
    --itsm-shadow: 0 1px 3px rgb(0 0 0 / 8%);
    --itsm-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* -------------------------------------------------------------------------
   Reset and base.
   ------------------------------------------------------------------------- */

*, *::before, *::after {
    box-sizing: border-box;
}

body.itsm-portal {
    margin: 0;
    padding: 0;
    font-family: var(--itsm-font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--itsm-text);
    background: var(--itsm-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--itsm-primary);
    text-decoration: none;
}
a:hover {
    color: var(--itsm-primary-hover);
    text-decoration: underline;
}

/* -------------------------------------------------------------------------
   Layout.
   ------------------------------------------------------------------------- */

.itsm-portal-header {
    background: #1d2327;
    color: #ffffff;
    padding: 0 20px;
}
.itsm-portal-header-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
}
.itsm-portal-logo {
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
}
.itsm-portal-logo span {
    font-weight: 400;
    opacity: 70%;
}
.itsm-portal-logo:hover {
    color: #ffffff;
    text-decoration: none;
}
.itsm-portal-nav {
    display: flex;
    gap: 20px;
}
.itsm-portal-nav a {
    color: rgb(255 255 255 / 80%);
    font-size: 13px;
    text-decoration: none;
    padding: 12px 0;
}
.itsm-portal-nav a:hover {
    color: #ffffff;
    text-decoration: none;
}

.itsm-portal-main {
    flex: 1;
    padding: 30px 20px;
}
.itsm-portal-container {
    max-width: 960px;
    margin: 0 auto;
}

.itsm-portal-footer {
    padding: 20px;
    text-align: center;
    color: var(--itsm-text-light);
    font-size: 12px;
    border-top: 1px solid var(--itsm-border-light);
}

/* -------------------------------------------------------------------------
   Auth card (login, OTP, not-found).
   ------------------------------------------------------------------------- */

.itsm-auth-card {
    max-width: 420px;
    margin: 60px auto;
    background: var(--itsm-card-bg);
    padding: 40px;
    border-radius: var(--itsm-radius);
    box-shadow: var(--itsm-shadow);
    border: 1px solid var(--itsm-border-light);
}
.itsm-auth-card h1 {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 600;
}
.itsm-auth-subtitle {
    color: var(--itsm-text-light);
    margin: 0 0 24px;
    font-size: 13px;
}
.itsm-auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
}

/* -------------------------------------------------------------------------
   Forms.
   ------------------------------------------------------------------------- */

.itsm-form-group {
    margin-bottom: 16px;
}
.itsm-form-group label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 4px;
    color: var(--itsm-text);
}
.itsm-form-group input[type="text"],
.itsm-form-group input[type="email"],
.itsm-form-group input[type="password"],
.itsm-form-group select,
.itsm-form-group textarea {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    font-family: var(--itsm-font);
    border: 1px solid var(--itsm-border);
    border-radius: var(--itsm-radius);
    background: #ffffff;
    color: var(--itsm-text);
    transition: border-color 0.15s;
}
.itsm-form-group input:focus,
.itsm-form-group select:focus,
.itsm-form-group textarea:focus {
    outline: none;
    border-color: var(--itsm-primary);
    box-shadow: 0 0 0 1px var(--itsm-primary);
}
.itsm-form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* OTP code input — large centered digits */
#otp_code {
    font-size: 24px;
    letter-spacing: 8px;
    text-align: center;
    font-family: monospace;
    padding: 12px;
}

/* -------------------------------------------------------------------------
   Buttons.
   ------------------------------------------------------------------------- */

.itsm-btn {
    display: inline-block;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--itsm-font);
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: var(--itsm-radius);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.itsm-btn-primary {
    background: var(--itsm-primary);
    color: #ffffff;
}
.itsm-btn-primary:hover {
    background: var(--itsm-primary-hover);
    color: #ffffff;
    text-decoration: none;
}
.itsm-btn-full {
    width: 100%;
}

/* -------------------------------------------------------------------------
   Notices.
   ------------------------------------------------------------------------- */

.itsm-notice {
    padding: 10px 14px;
    border-radius: var(--itsm-radius);
    margin-bottom: 16px;
    font-size: 13px;
    border-left: 4px solid;
}
.itsm-notice-error {
    background: #fcf0f1;
    border-color: var(--itsm-danger);
    color: #8a1a1d;
}
.itsm-notice-success {
    background: #edfaef;
    border-color: var(--itsm-success);
    color: #005c12;
}
.itsm-notice-info {
    background: #f0f6fc;
    border-color: var(--itsm-info);
    color: #1d4ed8;
}

/* -------------------------------------------------------------------------
   Portal page layout.
   ------------------------------------------------------------------------- */

.itsm-portal-page h1 {
    margin: 0 0 20px;
    font-size: 22px;
    font-weight: 600;
}
.itsm-portal-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.itsm-portal-page-header h1 {
    margin: 0;
}
.itsm-back-link {
    margin: 0 0 16px;
    font-size: 13px;
}

/* -------------------------------------------------------------------------
   Ticket table.
   ------------------------------------------------------------------------- */

.itsm-portal-table {
    width: 100%;
    background: var(--itsm-card-bg);
    border: 1px solid var(--itsm-border-light);
    border-radius: var(--itsm-radius);
    border-collapse: collapse;
    font-size: 13px;
}
.itsm-portal-table th {
    text-align: left;
    padding: 10px 14px;
    background: #f6f7f7;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--itsm-text-light);
    border-bottom: 1px solid var(--itsm-border-light);
}
.itsm-portal-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--itsm-border-light);
}
.itsm-portal-table tr:last-child td {
    border-bottom: none;
}
.itsm-portal-table tr:hover td {
    background: #f9f9f9;
}

/* -------------------------------------------------------------------------
   Badges (status, priority).
   ------------------------------------------------------------------------- */

.itsm-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
    white-space: nowrap;
    line-height: 1.5;
}

/* Status badges */
.itsm-badge-new {
    background: #e7f3ff;
    color: #0a4b78;
}
.itsm-badge-in-progress {
    background: #fff3cd;
    color: #664d03;
}
.itsm-badge-awaiting-customer,
.itsm-badge-awaiting-third-party {
    background: #f8d7da;
    color: #842029;
}
.itsm-badge-resolved {
    background: #d1e7dd;
    color: #0f5132;
}
.itsm-badge-closed {
    background: #e9ecef;
    color: #495057;
}

/* Priority badges */
.itsm-badge-p1 {
    background: #f8d7da;
    color: #842029;
}
.itsm-badge-p2 {
    background: #fff3cd;
    color: #664d03;
}
.itsm-badge-p3 {
    background: #e7f3ff;
    color: #0a4b78;
}
.itsm-badge-p4 {
    background: #e9ecef;
    color: #495057;
}

/* -------------------------------------------------------------------------
   Conversation thread.
   ------------------------------------------------------------------------- */

.itsm-conversation {
    margin: 24px 0;
}
.itsm-reply {
    background: var(--itsm-card-bg);
    border: 1px solid var(--itsm-border-light);
    border-radius: var(--itsm-radius);
    padding: 16px;
    margin-bottom: 12px;
}
.itsm-reply-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
    font-size: 13px;
}
.itsm-reply-header strong {
    font-size: 13px;
}
.itsm-reply-date {
    color: var(--itsm-text-light);
    font-size: 12px;
}
.itsm-reply-body {
    font-size: 14px;
    line-height: 1.6;
    color: var(--itsm-text);
}
.itsm-reply-body p {
    margin: 0 0 8px;
}
.itsm-reply-body p:last-child {
    margin-bottom: 0;
}

/* Reply type indicators */
.itsm-reply-description {
    border-left: 3px solid var(--itsm-border);
}
.itsm-reply-customer {
    border-left: 3px solid var(--itsm-primary);
}
.itsm-reply-analyst {
    border-left: 3px solid var(--itsm-success);
}

/* -------------------------------------------------------------------------
   Ticket header / meta.
   ------------------------------------------------------------------------- */

.itsm-ticket-header {
    margin-bottom: 24px;
}
.itsm-ticket-header h1 {
    margin: 0 0 10px;
    font-size: 20px;
}
.itsm-ticket-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    font-size: 13px;
    color: var(--itsm-text-light);
}
.itsm-ticket-meta-item {
    display: inline-block;
}

/* -------------------------------------------------------------------------
   Reply form.
   ------------------------------------------------------------------------- */

.itsm-reply-form-wrap {
    background: var(--itsm-card-bg);
    border: 1px solid var(--itsm-border-light);
    border-radius: var(--itsm-radius);
    padding: 20px;
    margin-top: 20px;
}
.itsm-reply-form-wrap h2 {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 600;
}

/* -------------------------------------------------------------------------
   Empty state.
   ------------------------------------------------------------------------- */

.itsm-empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--itsm-card-bg);
    border: 1px solid var(--itsm-border-light);
    border-radius: var(--itsm-radius);
    color: var(--itsm-text-light);
}
.itsm-empty-state p {
    margin: 0 0 16px;
    font-size: 15px;
}

/* -------------------------------------------------------------------------
   Portal form (new ticket).
   ------------------------------------------------------------------------- */

.itsm-portal-form {
    background: var(--itsm-card-bg);
    border: 1px solid var(--itsm-border-light);
    border-radius: var(--itsm-radius);
    padding: 24px;
}

/* -------------------------------------------------------------------------
   Documentation layout (sidebar + main).
   ------------------------------------------------------------------------- */

.itsm-docs-layout {
    display: flex;
    gap: 30px;
}
.itsm-docs-sidebar {
    width: 240px;
    flex-shrink: 0;
}
.itsm-docs-sidebar h3 {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 600;
}
.itsm-docs-main {
    flex: 1;
    min-width: 0;
}

/* Doc nav tree */
.itsm-doc-nav-root {
    list-style: none;
    padding: 0;
    margin: 0;
}
.itsm-doc-nav-list {
    list-style: none;
    padding-left: 14px;
    margin: 2px 0;
}
.itsm-doc-nav-list li {
    padding: 3px 0;
    font-size: 13px;
}
.itsm-doc-nav-list li a {
    color: var(--itsm-text);
    text-decoration: none;
}
.itsm-doc-nav-list li a:hover {
    color: var(--itsm-primary);
}
.itsm-doc-nav-active > a {
    color: var(--itsm-primary);
    font-weight: 600;
}

/* Doc content */
.itsm-doc-content {
    background: var(--itsm-card-bg);
    border: 1px solid var(--itsm-border-light);
    border-radius: var(--itsm-radius);
    padding: 24px;
    margin-bottom: 20px;
    line-height: 1.7;
}
.itsm-doc-content h1,
.itsm-doc-content h2,
.itsm-doc-content h3 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}
.itsm-doc-content h1:first-child,
.itsm-doc-content h2:first-child,
.itsm-doc-content h3:first-child {
    margin-top: 0;
}

/* Doc breadcrumbs */
.itsm-doc-breadcrumbs-portal {
    font-size: 13px;
    margin-bottom: 16px;
    color: var(--itsm-text-light);
}
.itsm-doc-breadcrumbs-portal a {
    color: var(--itsm-text-light);
}
.itsm-doc-breadcrumbs-portal a:hover {
    color: var(--itsm-primary);
}
.itsm-breadcrumb-sep {
    margin: 0 4px;
    color: #ccc;
}
.itsm-breadcrumb-current {
    color: var(--itsm-text);
    font-weight: 600;
}

/* Doc child list */
.itsm-doc-child-list {
    margin-top: 20px;
}
.itsm-doc-child-list h2 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 10px;
}
.itsm-doc-child-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.itsm-doc-child-list li {
    padding: 6px 0;
    border-bottom: 1px solid var(--itsm-border-light);
}
.itsm-doc-child-list li:last-child {
    border-bottom: none;
}

/* -------------------------------------------------------------------------
   Responsive.
   ------------------------------------------------------------------------- */

@media (max-width: 640px) {
    .itsm-portal-header-inner {
        flex-direction: column;
        gap: 8px;
        padding: 8px 0;
    }
    .itsm-portal-nav {
        gap: 12px;
    }
    .itsm-portal-page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .itsm-auth-card {
        margin: 20px auto;
        padding: 24px;
    }
    .itsm-portal-table {
        font-size: 12px;
    }
    .itsm-portal-table th,
    .itsm-portal-table td {
        padding: 8px 10px;
    }
    .itsm-ticket-meta-row {
        flex-direction: column;
        gap: 6px;
    }
    .itsm-docs-layout {
        flex-direction: column;
    }
    .itsm-docs-sidebar {
        width: 100%;
    }
}
