/*
 * JRB Support Hub - Client Portal UX Layer
 * Purpose: modernize osTicket client portal without altering core theme files.
 */

:root {
    --jrb-primary: #0f172a;
    --jrb-primary-soft: #1e293b;
    --jrb-accent: #2563eb;
    --jrb-accent-dark: #1d4ed8;
    --jrb-success: #16a34a;
    --jrb-bg: #f3f6fb;
    --jrb-card: #ffffff;
    --jrb-border: #dbe3ef;
    --jrb-muted: #64748b;
    --jrb-text: #0f172a;
    --jrb-radius: 16px;
    --jrb-shadow: 0 18px 45px rgba(15, 23, 42, 0.10);
}

body {
    background: var(--jrb-bg);
    color: var(--jrb-text);
    font-size: 15px;
    line-height: 1.55;
}

#wrapper {
    background: transparent;
}

#container {
    width: min(1120px, calc(100% - 28px));
    margin: 22px auto;
    background: var(--jrb-card);
    border: 1px solid var(--jrb-border);
    border-radius: 22px;
    box-shadow: var(--jrb-shadow);
    overflow: hidden;
}

#header {
    min-height: 86px;
    padding: 18px 24px;
    background: linear-gradient(135deg, var(--jrb-primary), var(--jrb-primary-soft));
    color: #fff;
    border-bottom: 0;
}

#header a,
#header p {
    color: #e5edf8;
}

#header #logo {
    display: flex;
    align-items: center;
    height: 58px;
}

#header #logo img {
    max-height: 54px;
    width: auto;
}

#nav {
    display: flex;
    gap: 8px;
    padding: 12px 22px;
    margin: 0;
    background: #ffffff;
    border-bottom: 1px solid var(--jrb-border);
}

#nav li {
    display: inline-flex;
}

#nav li a {
    border-radius: 999px;
    padding: 9px 15px;
    color: var(--jrb-primary);
    font-weight: 600;
    text-decoration: none;
}

#nav li a:hover,
#nav li a.active {
    background: #eaf1ff;
    color: var(--jrb-accent-dark);
}

#content {
    padding: 26px;
}

h1 {
    color: var(--jrb-primary);
    font-size: 28px;
    line-height: 1.2;
    letter-spacing: -0.03em;
}

h2, h3 {
    color: var(--jrb-primary);
}

a {
    color: var(--jrb-accent);
}

a:hover {
    color: var(--jrb-accent-dark);
}

.button,
button,
input[type="submit"],
input[type="button"],
input[type="reset"] {
    border: 0 !important;
    border-radius: 999px !important;
    padding: 10px 18px !important;
    font-weight: 700 !important;
    cursor: pointer;
    box-shadow: none !important;
}

button,
input[type="submit"],
.green.button {
    background: var(--jrb-accent) !important;
    color: #fff !important;
}

button:hover,
input[type="submit"]:hover,
.green.button:hover {
    background: var(--jrb-accent-dark) !important;
}

input[type="reset"],
input[type="button"] {
    background: #e2e8f0 !important;
    color: var(--jrb-primary) !important;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    border: 1px solid var(--jrb-border) !important;
    border-radius: 10px !important;
    padding: 9px 11px !important;
    background: #fff;
    color: var(--jrb-text);
    max-width: 100%;
}

textarea {
    min-height: 130px;
}

#landing_page {
    display: block;
}

#landing_page .main-content,
.main-content {
    width: auto;
}

.search-form {
    background: #eef4ff;
    border: 1px solid #d8e6ff;
    border-radius: var(--jrb-radius);
    padding: 18px;
    margin-bottom: 24px;
}

.search-form form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-form input.search {
    flex: 1;
    min-width: 0;
    height: 42px;
}

.featured-category,
.front-page,
.thread-entry,
.ticket_info,
.infoTable,
.faq-content,
.category {
    border-radius: var(--jrb-radius);
}

#ticketForm {
    background: #ffffff;
    border: 1px solid var(--jrb-border);
    border-radius: var(--jrb-radius);
    padding: 22px;
}

#ticketForm table {
    width: 100% !important;
}

#ticketForm td {
    padding: 9px 6px;
    vertical-align: top;
}

#ticketForm .form-header {
    color: var(--jrb-primary);
    font-size: 17px;
}

#ticketForm hr {
    border: 0;
    border-top: 1px solid var(--jrb-border);
    margin: 18px 0;
}

#footer {
    background: #f8fafc;
    border-top: 1px solid var(--jrb-border);
    color: var(--jrb-muted);
    padding: 18px 24px;
    text-align: center;
}

#poweredBy {
    color: var(--jrb-muted);
    font-size: 12px;
}

.notice_bar {
    background: #fff7ed;
    border-bottom: 1px solid #fed7aa;
    color: #9a3412;
    padding: 10px 18px;
}

.error {
    color: #dc2626 !important;
}

@media (max-width: 760px) {
    #container {
        width: calc(100% - 16px);
        margin: 8px auto;
        border-radius: 16px;
    }

    #header {
        padding: 16px;
    }

    #header .pull-right {
        float: none !important;
        text-align: left;
        margin-bottom: 8px;
    }

    #header #logo {
        float: none !important;
        clear: both;
    }

    #nav {
        overflow-x: auto;
        padding: 10px 12px;
    }

    #content {
        padding: 18px;
    }

    h1 {
        font-size: 23px;
    }

    .search-form form {
        flex-direction: column;
        align-items: stretch;
    }

    #ticketForm {
        padding: 16px;
    }

    #ticketForm table,
    #ticketForm tbody,
    #ticketForm tr,
    #ticketForm td {
        display: block;
        width: 100% !important;
    }

    #ticketForm td {
        padding: 7px 0;
    }

    #ticketForm .buttons {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    #ticketForm .buttons input {
        width: 100%;
    }
}
/* UX-2: JRB landing page */

.jrb-landing {
    display: block;
}

.jrb-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.9fr);
    gap: 22px;
    align-items: stretch;
    margin-bottom: 26px;
}

.jrb-hero-content {
    background: linear-gradient(135deg, #f8fbff, #eef4ff);
    border: 1px solid #d8e6ff;
    border-radius: 22px;
    padding: 34px;
}

.jrb-eyebrow {
    display: inline-flex;
    margin: 0 0 10px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.jrb-hero h1 {
    margin: 0 0 12px;
    font-size: clamp(34px, 5vw, 52px);
    line-height: 1;
}

.jrb-hero-text {
    max-width: 720px;
    margin: 0;
    color: var(--jrb-muted);
    font-size: 17px;
}

.jrb-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.jrb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 11px 18px;
    border-radius: 999px;
    font-weight: 800;
    text-decoration: none;
}

.jrb-btn-primary {
    background: var(--jrb-accent);
    color: #fff !important;
}

.jrb-btn-primary:hover {
    background: var(--jrb-accent-dark);
    color: #fff !important;
}

.jrb-btn-secondary {
    background: #ffffff;
    color: var(--jrb-primary) !important;
    border: 1px solid var(--jrb-border);
}

.jrb-btn-secondary:hover {
    background: #f1f5f9;
}

.jrb-hero-card {
    background: var(--jrb-primary);
    color: #fff;
    border-radius: 22px;
    padding: 28px;
    box-shadow: 0 18px 35px rgba(15, 23, 42, 0.18);
}

.jrb-hero-card h2 {
    margin-top: 12px;
    color: #fff;
    font-size: 24px;
}

.jrb-hero-card p {
    color: #dbeafe;
}

.jrb-card-badge {
    display: inline-flex;
    padding: 6px 11px;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    color: #bfdbfe;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.jrb-support-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.jrb-support-card {
    background: #fff;
    border: 1px solid var(--jrb-border);
    border-radius: var(--jrb-radius);
    padding: 22px;
}

.jrb-support-icon {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #eaf1ff;
    color: var(--jrb-accent-dark);
    font-weight: 900;
    margin-bottom: 12px;
}

.jrb-support-card h2 {
    margin: 0 0 8px;
    font-size: 20px;
}

.jrb-support-card p {
    margin: 0;
    color: var(--jrb-muted);
}

.jrb-kb-search,
.jrb-products,
.jrb-featured-kb {
    background: #ffffff;
    border: 1px solid var(--jrb-border);
    border-radius: var(--jrb-radius);
    padding: 22px;
    margin-bottom: 22px;
}

.jrb-kb-search h2,
.jrb-products h2,
.jrb-featured-kb h2 {
    margin-top: 0;
}

.jrb-kb-search form {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.jrb-kb-search input.search {
    flex: 1;
    min-width: 0;
}

.jrb-product-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.jrb-product-list span {
    display: inline-flex;
    padding: 8px 12px;
    border-radius: 999px;
    background: #f1f5f9;
    color: var(--jrb-primary);
    font-weight: 700;
}

@media (max-width: 860px) {
    .jrb-hero {
        grid-template-columns: 1fr;
    }

    .jrb-support-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .jrb-hero-content,
    .jrb-hero-card,
    .jrb-kb-search,
    .jrb-products,
    .jrb-featured-kb {
        padding: 18px;
        border-radius: 16px;
    }

    .jrb-hero-actions,
    .jrb-kb-search form {
        flex-direction: column;
        align-items: stretch;
    }

    .jrb-btn {
        width: 100%;
    }
}

/* UX-3: open ticket page */

.jrb-page-intro {
    background: linear-gradient(135deg, #f8fbff, #eef4ff);
    border: 1px solid #d8e6ff;
    border-radius: 22px;
    padding: 28px;
    margin-bottom: 22px;
}

.jrb-page-intro h1 {
    margin: 0 0 10px;
}

.jrb-page-intro p {
    max-width: 780px;
    margin: 0;
    color: var(--jrb-muted);
    font-size: 16px;
}

.jrb-ticket-tips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.jrb-ticket-tips span {
    display: inline-flex;
    padding: 8px 11px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid var(--jrb-border);
    color: var(--jrb-primary);
    font-weight: 700;
    font-size: 13px;
}

.jrb-ticket-form {
    margin-top: 0;
}

.jrb-ticket-form select#topicId {
    min-width: min(100%, 420px);
}

.jrb-ticket-form .buttons {
    margin-top: 18px;
}

@media (max-width: 600px) {
    .jrb-page-intro {
        padding: 18px;
        border-radius: 16px;
    }

    .jrb-ticket-tips {
        flex-direction: column;
    }

    .jrb-ticket-tips span {
        width: 100%;
        justify-content: center;
    }
}

/* UX-4: mobile responsive refinements */

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    min-width: 0 !important;
}

#container {
    width: min(1120px, calc(100% - 28px)) !important;
    max-width: calc(100% - 28px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

#content {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

#header {
    min-height: 0;
}

#header #logo,
#header a#logo {
    max-width: 190px;
}

#header img {
    max-width: 100%;
    height: auto;
}

#nav {
    display: flex !important;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 28px !important;
    min-height: auto !important;
}

#nav li,
#nav ul,
#nav a {
    max-width: 100%;
}

#nav a {
    display: inline-flex !important;
    align-items: center;
    min-height: 38px;
    border-radius: 999px;
    padding: 8px 14px !important;
    line-height: 1.2 !important;
    background-image: none !important;
    white-space: normal !important;
}

#nav a.active,
#nav .active a,
#nav li.active a {
    background: #eaf1ff !important;
    color: var(--jrb-accent-dark) !important;
}

.jrb-landing,
.jrb-hero,
.jrb-support-grid,
.jrb-kb-search,
.jrb-products,
.jrb-featured-kb,
.jrb-page-intro,
#ticketForm,
.jrb-ticket-form,
#clientLogin {
    box-sizing: border-box;
    max-width: 100%;
}

#ticketForm table,
.jrb-ticket-form table,
#clientLogin table {
    width: 100% !important;
    max-width: 100% !important;
}

#ticketForm input[type="text"],
#ticketForm input[type="email"],
#ticketForm input[type="tel"],
#ticketForm input[type="password"],
#ticketForm textarea,
#ticketForm select,
.jrb-ticket-form input[type="text"],
.jrb-ticket-form input[type="email"],
.jrb-ticket-form input[type="tel"],
.jrb-ticket-form input[type="password"],
.jrb-ticket-form textarea,
.jrb-ticket-form select,
#clientLogin input[type="text"],
#clientLogin input[type="password"],
#clientLogin input[type="email"] {
    box-sizing: border-box;
    max-width: 100% !important;
}

@media (max-width: 760px) {
    #container {
        width: calc(100% - 16px) !important;
        max-width: calc(100% - 16px) !important;
        border-radius: 18px !important;
        margin-top: 8px !important;
    }

    #header {
        padding: 18px 16px !important;
        border-radius: 18px 18px 0 0 !important;
    }

    #header #logo,
    #header a#logo {
        max-width: 145px;
    }

    #header p,
    #header #user-info {
        font-size: 13px !important;
    }

    #nav {
        padding: 8px 10px !important;
        gap: 6px;
        justify-content: center;
    }

    #nav a {
        flex: 1 1 auto;
        justify-content: center;
        min-width: 135px;
        font-size: 14px !important;
        padding: 9px 10px !important;
        text-align: center;
    }

    #content {
        padding: 16px 12px 22px !important;
    }

    .jrb-hero {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
        padding: 18px !important;
    }

    .jrb-hero h1 {
        font-size: clamp(34px, 11vw, 48px) !important;
        line-height: 1.02 !important;
    }

    .jrb-hero p {
        font-size: 15px !important;
    }

    .jrb-hero-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .jrb-btn {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .jrb-hero-card {
        padding: 22px !important;
    }

    .jrb-support-grid {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }

    .jrb-support-card {
        padding: 18px !important;
    }

    .jrb-page-intro {
        padding: 18px !important;
        border-radius: 18px !important;
    }

    .jrb-page-intro h1 {
        font-size: 27px !important;
        line-height: 1.12 !important;
    }

    .jrb-page-intro p {
        font-size: 15px !important;
    }

    .jrb-ticket-tips {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .jrb-ticket-tips span {
        width: auto !important;
        justify-content: center;
        text-align: center;
        font-size: 12px;
    }

    #ticketForm,
    .jrb-ticket-form,
    #clientLogin {
        padding: 18px !important;
        border-radius: 18px !important;
    }

    #ticketForm table,
    #ticketForm tbody,
    #ticketForm tr,
    #ticketForm td,
    .jrb-ticket-form table,
    .jrb-ticket-form tbody,
    .jrb-ticket-form tr,
    .jrb-ticket-form td {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box;
    }

    #ticketForm td,
    .jrb-ticket-form td {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    #ticketForm input[type="text"],
    #ticketForm input[type="email"],
    #ticketForm input[type="tel"],
    #ticketForm input[type="password"],
    #ticketForm textarea,
    #ticketForm select,
    .jrb-ticket-form input[type="text"],
    .jrb-ticket-form input[type="email"],
    .jrb-ticket-form input[type="tel"],
    .jrb-ticket-form input[type="password"],
    .jrb-ticket-form textarea,
    .jrb-ticket-form select {
        width: 100% !important;
        min-width: 0 !important;
    }

    #ticketForm .buttons,
    .jrb-ticket-form .buttons {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    #ticketForm .buttons input,
    .jrb-ticket-form .buttons input,
    #ticketForm button,
    .jrb-ticket-form button {
        width: 100%;
        margin-left: 0 !important;
    }

    #footer {
        padding-left: 12px !important;
        padding-right: 12px !important;
        text-align: center;
    }
}

@media (max-width: 430px) {
    #container {
        width: 100% !important;
        max-width: 100% !important;
        margin-top: 0 !important;
        border-radius: 0 !important;
    }

    #header {
        border-radius: 0 !important;
    }

    #nav {
        justify-content: stretch;
    }

    #nav a {
        flex: 1 1 100%;
        min-width: 100%;
    }

    .jrb-ticket-tips {
        grid-template-columns: 1fr;
    }

    .jrb-hero h1 {
        font-size: 36px !important;
    }
}

/* UX-4.1: mobile fixes for ticket status page */

@media (max-width: 760px) {
    #header {
        height: auto !important;
        min-height: 132px !important;
        padding: 18px 16px 16px !important;
        overflow: hidden !important;
    }

    #header #logo,
    #header a#logo {
        position: static !important;
        float: none !important;
        display: block !important;
        max-width: 145px !important;
        margin: 0 auto 10px !important;
        text-align: center !important;
    }

    #header img {
        max-width: 145px !important;
        height: auto !important;
    }

    #header p,
    #header #user-info {
        position: static !important;
        float: none !important;
        width: 100% !important;
        margin: 0 !important;
        text-align: center !important;
    }

    #nav {
        clear: both !important;
        position: relative !important;
        z-index: 2 !important;
    }

    #nav li,
    #nav li a,
    #nav a {
        background-image: none !important;
    }

    /* view.php / ticket status access form */
    #clientLogin {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
    }

    #clientLogin > div,
    #clientLogin .pull-left,
    #clientLogin .pull-right,
    #clientLogin .left,
    #clientLogin .right,
    #clientLogin .flush-left,
    #clientLogin .flush-right {
        float: none !important;
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin: 0 0 16px 0 !important;
        box-sizing: border-box !important;
    }

    #clientLogin input[type="text"],
    #clientLogin input[type="email"],
    #clientLogin input[type="password"],
    #clientLogin input[type="submit"],
    #clientLogin button {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    #clientLogin input[type="submit"],
    #clientLogin button,
    #clientLogin .button {
        white-space: normal !important;
        text-align: center !important;
    }

    #clientLogin img {
        max-width: 90px !important;
        height: auto !important;
        margin: 10px auto !important;
        display: block !important;
    }

    #content h1 {
        overflow-wrap: anywhere;
    }
}

@media (max-width: 430px) {
    #header {
        min-height: 122px !important;
    }

    #header #logo,
    #header a#logo,
    #header img {
        max-width: 132px !important;
    }

    #clientLogin {
        padding: 16px !important;
    }
}

/* UX-5: modern navigation icons */

#nav,
#nav ul,
#nav li,
#nav a {
    background-image: none !important;
}

#nav img {
    display: none !important;
}

#nav a {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    text-decoration: none !important;
}

#nav a::before {
    content: "•";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    border-radius: 999px;
    background: #eef4ff;
    color: var(--jrb-accent-dark);
    font-size: 14px;
    font-weight: 900;
    line-height: 1;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.14);
}

#nav a.home::before,
#nav a[href$="/"]::before,
#nav a[href*="index.php"]::before {
    content: "⌂";
}

#nav a.new::before,
#nav a.open::before,
#nav a[href*="open.php"]::before {
    content: "+";
    font-size: 18px;
}

#nav a.status::before,
#nav a.tickets::before,
#nav a[href*="tickets.php"]::before,
#nav a[href*="view.php"]::before {
    content: "✓";
}

#nav a.active::before,
#nav .active a::before,
#nav li.active a::before {
    background: var(--jrb-accent);
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
}

@media (max-width: 760px) {
    #nav a::before {
        width: 24px;
        height: 24px;
        flex-basis: 24px;
    }
}

@media (max-width: 430px) {
    #nav a {
        justify-content: center !important;
    }
}
