﻿/* Help Desk System – shared layout & graphics */

:root {
    --hd-primary: #2f4f4f;
    --hd-primary-dark: #243d3d;
    --hd-accent: #3d7a7a;
    --hd-light: #f4f7f7;
    --hd-white: #ffffff;
    --hd-text: #1a2e2e;
    --hd-muted: #5c6b6b;
    --hd-border: #d8e0e0;
    --hd-danger: #c0392b;
    --hd-danger-dark: #a93226;
    --hd-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --hd-radius: 10px;
}

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

html {
    height: 100%;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html, body {
    height: 100%;
    margin: 0;
}

body {
    padding: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: #1a2e2e;
    color: var(--hd-text);
    background: #f4f7f7;
    background: var(--hd-light);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
    border: 0;
    vertical-align: middle;
}

button,
input,
select,
textarea {
    font: inherit;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
textarea {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

select {
    -webkit-appearance: menulist;
    -moz-appearance: menulist;
    appearance: menulist;
}

/* Flex layout lives on a wrapper so Bootstrap modals (fixed) are not flex children of body */
.app-shell {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

/* ── Header ── */
.app-header {
    background: var(--hd-white);
    border-bottom: 3px solid var(--hd-primary);
    padding: 0.75rem 0;
    box-shadow: var(--hd-shadow);
}

.app-header-inner {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    gap: 1rem;
    text-align: center;
}

/* gap fallback for older Safari / browsers without flex gap */
.app-header-inner > * {
    margin: 0.5rem;
}

.app-header img {
    height: 56px;
    width: auto;
    object-fit: contain;
}

.app-header-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--hd-primary);
    letter-spacing: 0.02em;
    line-height: 1.3;
}

.app-header-subtitle {
    margin: 0;
    font-size: 0.85rem;
    color: var(--hd-muted);
}

/* ── Navigation bar ── */
.app-navbar {
    background: var(--hd-primary);
    padding: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.app-navbar-inner {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: stretch;
    -ms-flex-align: stretch;
    align-items: stretch;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    min-height: 48px;
    gap: 1rem;
}

#c6 {
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

#c7 {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: end;
    -ms-flex-pack: end;
    justify-content: flex-end;
    padding: 0 1.25rem;
    -ms-flex-negative: 0;
    flex-shrink: 0;
}

.app-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
}

.app-nav-list li a {
    display: block;
    color: var(--hd-white);
    text-decoration: none;
    padding: 0.85rem 1rem;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    white-space: nowrap;
    transition: background 0.2s ease;
}

.app-nav-list li a:hover,
.app-nav-list li a:focus {
    background: var(--hd-primary-dark);
    color: var(--hd-white);
}

.app-login-link {
    display: inline-block;
    color: var(--hd-white) !important;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 0.45rem 1.1rem;
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 6px;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.app-login-link:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--hd-white);
    color: var(--hd-white) !important;
}

/* ── Main content area ── */
.app-main {
    flex: 1;
    padding: 1.5rem 0 2rem;
}

.app-content-row {
    --bs-gutter-x: 1.5rem;
}

.app-content {
    min-width: 0;
}

/* ── Sidebar (logged-in notifications) ── */
.app-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.app-sidebar .card {
    border: none;
    border-radius: var(--hd-radius);
    box-shadow: var(--hd-shadow);
    overflow: hidden;
}

.app-sidebar .card-header {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-align: center;
    padding: 0.65rem 0.75rem;
    border-bottom: none;
}

.app-sidebar .card-admin .card-header {
    background: var(--hd-primary);
    color: var(--hd-white);
}

.app-sidebar .card-tech .card-header {
    background: #c0392b;
    color: var(--hd-white);
}

.app-sidebar .card-body {
    padding: 0.75rem 1rem;
}

.app-sidebar .card-body ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.app-sidebar .card-body li {
    margin-bottom: 0.5rem;
}

.app-sidebar .card-body li:last-child {
    margin-bottom: 0;
}

#ui a {
    color: var(--hd-text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0;
}

#ui a:hover {
    color: var(--hd-accent);
}

#ui img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

/* ── Contact sidebar (public) ── */
.app-contact-card {
    background: var(--hd-white);
    border-radius: var(--hd-radius);
    box-shadow: var(--hd-shadow);
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 1rem;
}

.app-contact-card h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--hd-primary);
    text-align: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--hd-border);
}

.app-contact-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
    font-size: 0.95rem;
}

.app-contact-item img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
}

.app-contact-text {
    font-size: 0.9rem;
    color: var(--hd-muted);
    line-height: 1.5;
    margin: 1rem 0;
}

.app-contact-logos {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--hd-border);
}

.app-contact-logos img {
    width: 80px;
    height: auto;
    max-height: 90px;
    object-fit: contain;
}

/* ── Home hero ── */
.app-hero {
    border-radius: var(--hd-radius);
    overflow: hidden;
    box-shadow: var(--hd-shadow);
    line-height: 0;
}

.app-hero img {
    width: 100%;
    height: auto;
    max-height: 480px;
    object-fit: cover;
    display: block;
}

/* ── Page cards (forms, tables) ── */
.app-page-card {
    background: var(--hd-white);
    border-radius: var(--hd-radius);
    box-shadow: var(--hd-shadow);
    padding: 1.75rem;
}

.app-page-card h2,
.app-page-card h4 {
    color: var(--hd-primary);
    margin-bottom: 0.5rem;
}

.app-page-card hr {
    border-color: var(--hd-border);
    margin: 1rem 0 1.25rem;
}

/* ── Footer ── */
.app-footer {
    background: var(--hd-primary);
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    margin-top: auto;
}

/* ── Modals ── */
.modal-header.app-modal-header {
    background: var(--hd-primary);
    color: var(--hd-white);
}

.modal-header.app-modal-header .modal-title {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Guarantee modals surface above layout even if Bootstrap JS/CSS is delayed */
.modal.show {
    display: block !important;
    opacity: 1 !important;
}

.modal-backdrop.show {
    opacity: 0.5;
}

body.modal-open {
    overflow: hidden;
}

/* ── Forms ── */
.app-page-card input[type="text"],
.app-page-card input[type="password"],
.app-page-card input[type="email"],
.app-page-card select,
.app-page-card textarea,
.app-page-card .form-control {
    max-width: 100%;
}

/* ── Buttons (primary / secondary / danger) ── */
.app-btn-primary,
input[type="submit"]:not(.btn-link):not(.app-btn-danger):not([value="Delete"]):not([value="Remove"]),
button[type="submit"]:not(.btn-link):not(.app-btn-danger),
.btn-primary {
    display: inline-block;
    background: var(--hd-primary);
    border: 1px solid var(--hd-primary);
    color: var(--hd-white);
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    line-height: 1.4;
    padding: 0.55rem 1.65rem;
    min-width: 7.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(47, 79, 79, 0.25);
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.app-btn-primary:hover,
.app-btn-primary:focus,
input[type="submit"]:not(.btn-link):not(.app-btn-danger):not([value="Delete"]):not([value="Remove"]):hover,
input[type="submit"]:not(.btn-link):not(.app-btn-danger):not([value="Delete"]):not([value="Remove"]):focus,
button[type="submit"]:not(.btn-link):not(.app-btn-danger):hover,
button[type="submit"]:not(.btn-link):not(.app-btn-danger):focus,
.btn-primary:hover,
.btn-primary:focus {
    background: var(--hd-primary-dark);
    border-color: var(--hd-primary-dark);
    color: var(--hd-white);
    box-shadow: 0 4px 12px rgba(47, 79, 79, 0.35);
}

.app-btn-primary:active,
input[type="submit"]:not(.btn-link):not(.app-btn-danger):not([value="Delete"]):not([value="Remove"]):active,
button[type="submit"]:not(.btn-link):not(.app-btn-danger):active,
.btn-primary:active {
    transform: translateY(1px);
    box-shadow: 0 1px 3px rgba(47, 79, 79, 0.3);
}

.app-btn-danger,
input[type="submit"].btn-default[value="Delete"],
input[type="submit"].btn-default[value="Remove"],
input[type="submit"][value="Delete"],
input[type="submit"][value="Remove"] {
    display: inline-block;
    background: var(--hd-danger) !important;
    border: 1px solid var(--hd-danger) !important;
    color: var(--hd-white) !important;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    line-height: 1.4;
    padding: 0.55rem 1.65rem;
    min-width: 7.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(192, 57, 43, 0.3);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.app-btn-danger:hover,
.app-btn-danger:focus,
input[type="submit"].btn-default[value="Delete"]:hover,
input[type="submit"].btn-default[value="Delete"]:focus,
input[type="submit"].btn-default[value="Remove"]:hover,
input[type="submit"].btn-default[value="Remove"]:focus,
input[type="submit"][value="Delete"]:hover,
input[type="submit"][value="Delete"]:focus,
input[type="submit"][value="Remove"]:hover,
input[type="submit"][value="Remove"]:focus {
    background: var(--hd-danger-dark) !important;
    border-color: var(--hd-danger-dark) !important;
    color: var(--hd-white) !important;
    box-shadow: 0 4px 12px rgba(192, 57, 43, 0.4);
}

.app-btn-danger:active,
input[type="submit"][value="Delete"]:active,
input[type="submit"][value="Remove"]:active {
    transform: translateY(1px);
}

/* Secondary / cancel-style (.btn-default is not in Bootstrap 5) */
.btn-default,
a.btn-default {
    display: inline-block;
    background: var(--hd-white);
    border: 1px solid var(--hd-border);
    color: var(--hd-primary);
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.03em;
    line-height: 1.4;
    padding: 0.55rem 1.35rem;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-default:hover,
.btn-default:focus,
a.btn-default:hover,
a.btn-default:focus {
    background: var(--hd-light);
    border-color: var(--hd-accent);
    color: var(--hd-primary-dark);
}

/* Submit still wins when both classes are present */
input[type="submit"].btn-default:not([value="Delete"]):not([value="Remove"]),
button[type="submit"].btn-default {
    background: var(--hd-primary);
    border-color: var(--hd-primary);
    color: var(--hd-white);
    min-width: 7.5rem;
    box-shadow: 0 2px 6px rgba(47, 79, 79, 0.25);
}

input[type="submit"].btn-default:not([value="Delete"]):not([value="Remove"]):hover,
input[type="submit"].btn-default:not([value="Delete"]):not([value="Remove"]):focus,
button[type="submit"].btn-default:hover,
button[type="submit"].btn-default:focus {
    background: var(--hd-primary-dark);
    border-color: var(--hd-primary-dark);
    color: var(--hd-white);
}

/* Form action row spacing */
.form-group .btn,
.form-horizontal .btn,
.form-group input[type="submit"],
.form-horizontal input[type="submit"] {
    margin-right: 0.5rem;
    margin-top: 0.25rem;
}

.app-sms-alert {
    margin-bottom: 0;
    border-radius: var(--hd-radius);
    box-shadow: var(--hd-shadow);
}

/* ── Legacy helpers ── */
.body-content {
    padding-left: 15px;
    padding-right: 15px;
}

.dl-horizontal dt {
    white-space: normal;
}

/* ── Bootstrap 3 form helpers on Bootstrap 5 (consistent across browsers) ── */
.form-horizontal .form-group {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
}

.form-horizontal .control-label {
    padding-top: 0.45rem;
    margin-bottom: 0;
    font-weight: 600;
    text-align: right;
}

.form-horizontal .col-md-offset-2 {
    margin-left: 16.666667%;
}

.form-horizontal .form-control,
.form-horizontal select.form-control,
.form-horizontal textarea.form-control {
    width: 100%;
    max-width: 100%;
}

input.form-control,
textarea.form-control {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 6px;
}

select.form-control {
    -webkit-appearance: menulist;
    -moz-appearance: menulist;
    appearance: menulist;
    border-radius: 6px;
}

/* Tables scroll horizontally on small screens instead of breaking layout */
.app-content table,
.app-page-card table,
table.table {
    width: 100%;
    max-width: 100%;
}

.app-table-wrap,
.app-content .dataTables_wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.app-content,
.app-page-card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Sticky contact card: Safari-friendly */
.app-contact-card {
    position: -webkit-sticky;
    position: sticky;
}

/* ── Responsive ── */
@media (max-width: 991.98px) {
    .app-header-title {
        font-size: 1.1rem;
    }

    .app-navbar-inner {
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
        -webkit-box-align: stretch;
        -ms-flex-align: stretch;
        align-items: stretch;
    }

    #c7 {
        -webkit-box-pack: center;
        -ms-flex-pack: center;
        justify-content: center;
        padding: 0.5rem 1rem 0.75rem;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
    }

    .app-nav-list {
        -webkit-box-pack: center;
        -ms-flex-pack: center;
        justify-content: center;
    }

    .app-contact-card {
        position: static;
        margin-top: 1.5rem;
    }

    .form-horizontal .col-md-offset-2 {
        margin-left: 0;
    }

    .form-horizontal .control-label {
        text-align: left;
        margin-bottom: 0.35rem;
    }
}

@media (max-width: 575.98px) {
    .app-nav-list li a {
        padding: 0.65rem 0.75rem;
        font-size: 0.75rem;
    }

    .app-main {
        padding: 1rem 0 1.5rem;
    }

    .app-header-inner > * {
        margin: 0.35rem;
    }
}

/* Print: keep usable paper output across browsers */
@media print {
    .app-navbar,
    .app-sidebar,
    .app-footer,
    .app-contact-card,
    .modal,
    .modal-backdrop {
        display: none !important;
    }

    .app-shell,
    .app-main,
    .app-content {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow: visible !important;
    }

    body {
        background: #fff !important;
        color: #000 !important;
    }
}
