/* =========================================
   KanoMart Customer Support
   PREMIUM MOBILE-FIRST SUPPORT
========================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: Arial, Helvetica, sans-serif;

    background: #f7f9f8;

    color: #172033;

    padding-bottom: 82px;
}

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

button {
    -webkit-tap-highlight-color: transparent;
}

button:active {
    transform: scale(.97);
}


/* =========================================
   HEADER
========================================= */

.support-header {
    position: sticky;

    top: 0;

    z-index: 1000;

    min-height: 74px;

    display: flex;

    align-items: center;

    gap: 12px;

    padding: 10px 18px;

    background: #ffffff;

    border-bottom: 1px solid #e4e9e6;

    box-shadow:
        0 3px 12px rgba(0,0,0,.04);
}

.header-btn {
    width: 43px;
    height: 43px;

    flex: 0 0 43px;

    border: none;

    border-radius: 13px;

    background: #eef7f1;

    color: #0b7a3b;

    font-size: 23px;

    font-weight: 900;

    cursor: pointer;
}

.header-title {
    flex: 1;

    min-width: 0;
}

.header-title strong {
    display: block;

    font-size: 17px;

    font-weight: 900;

    color: #172033;
}

.header-title span {
    display: block;

    margin-top: 3px;

    color: #818a85;

    font-size: 9px;
}


/* =========================================
   MAIN
========================================= */

.support-main {
    width: 100%;

    max-width: 700px;

    margin: auto;

    padding: 20px 18px 35px;
}


/* =========================================
   HERO
========================================= */

.support-hero {
    display: flex;

    align-items: center;

    gap: 15px;

    padding: 24px 20px;

    margin-bottom: 25px;

    border-radius: 22px;

    background:
        linear-gradient(
            135deg,
            #08763a,
            #159447
        );

    color: #ffffff;

    box-shadow:
        0 12px 28px rgba(11,122,59,.16);
}

.hero-icon {
    width: 68px;
    height: 68px;

    flex: 0 0 68px;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 20px;

    background: rgba(255,255,255,.15);

    border: 1px solid rgba(255,255,255,.25);

    font-size: 34px;
}

.support-hero h1 {
    font-size: 22px;

    font-weight: 900;

    margin-bottom: 6px;
}

.support-hero p {
    color: rgba(255,255,255,.85);

    font-size: 10px;

    line-height: 1.55;
}


/* =========================================
   SECTIONS
========================================= */

.support-section {
    margin-bottom: 28px;
}

.section-heading {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 10px;

    margin-bottom: 12px;
}

.section-heading h2 {
    color: #172033;

    font-size: 18px;

    font-weight: 900;
}

.section-heading p {
    color: #7c8580;

    font-size: 10px;

    margin-top: 4px;
}

.refresh-btn {
    width: 38px;
    height: 38px;

    border: none;

    border-radius: 11px;

    background: #eef7f1;

    color: #0b7a3b;

    font-size: 22px;

    font-weight: 900;

    cursor: pointer;
}


/* =========================================
   FORM
========================================= */

.support-form {
    padding: 18px;

    background: #ffffff;

    border: 1px solid #e1e7e4;

    border-radius: 19px;

    box-shadow:
        0 5px 18px rgba(0,0,0,.04);
}

.form-group {
    position: relative;

    margin-bottom: 15px;
}

.form-group label {
    display: block;

    color: #303b35;

    font-size: 10px;

    font-weight: 900;

    margin-bottom: 6px;
}

.form-group label span {
    color: #8b938e;

    font-weight: 500;

    margin-left: 4px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;

    border: 1px solid #dfe6e2;

    border-radius: 11px;

    background: #f9fbfa;

    color: #172033;

    outline: none;

    font-size: 12px;

    padding: 12px;

    transition: .2s ease;
}

.form-group select {
    appearance: auto;
}

.form-group textarea {
    min-height: 105px;

    resize: vertical;

    line-height: 1.5;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: #0b7a3b;

    background: #ffffff;

    box-shadow:
        0 0 0 3px rgba(11,122,59,.08);
}

.field-help {
    display: block;

    color: #89918c;

    font-size: 8px;

    margin-top: 5px;

    line-height: 1.4;
}

.character-count {
    position: absolute;

    right: 9px;

    bottom: 8px;

    color: #9aa29d;

    font-size: 8px;

    background: #ffffff;

    padding: 2px 4px;

    border-radius: 4px;
}


/* =========================================
   SUBMIT
========================================= */

.submit-btn {
    width: 100%;

    min-height: 48px;

    border: none;

    border-radius: 12px;

    background: #0b7a3b;

    color: #ffffff;

    font-size: 12px;

    font-weight: 900;

    cursor: pointer;

    box-shadow:
        0 7px 16px rgba(11,122,59,.15);
}

.submit-btn:disabled {
    opacity: .6;

    cursor: not-allowed;
}


/* =========================================
   STATE BOX
========================================= */

.state-box {
    min-height: 130px;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    gap: 8px;

    padding: 20px;

    background: #ffffff;

    border: 1px solid #e1e7e4;

    border-radius: 18px;

    text-align: center;
}

.state-box p {
    color: #858e89;

    font-size: 10px;
}

.loading-spinner {
    width: 27px;
    height: 27px;

    border: 3px solid #dcebe2;

    border-top-color: #0b7a3b;

    border-radius: 50%;

    animation: spin .8s linear infinite;
}

@keyframes spin {

    to {
        transform: rotate(360deg);
    }

}

.empty-icon {
    font-size: 30px;
}

.empty-state strong {
    color: #303a35;

    font-size: 12px;
}

.empty-state p {
    max-width: 270px;

    line-height: 1.5;
}


/* =========================================
   TICKETS
========================================= */

.tickets-list {
    display: grid;

    gap: 10px;
}

.ticket-card {
    width: 100%;

    padding: 15px;

    border: 1px solid #e0e7e3;

    border-radius: 17px;

    background: #ffffff;

    text-align: left;

    cursor: pointer;

    box-shadow:
        0 4px 14px rgba(0,0,0,.035);

    transition: .2s ease;
}

.ticket-card:hover {
    transform: translateY(-1px);

    box-shadow:
        0 7px 18px rgba(0,0,0,.06);
}

.ticket-top {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 10px;

    margin-bottom: 8px;
}

.ticket-id {
    color: #7e8782;

    font-size: 9px;

    font-weight: 700;

    word-break: break-all;
}

.ticket-status {
    padding: 5px 8px;

    border-radius: 20px;

    font-size: 8px;

    font-weight: 900;

    white-space: nowrap;
}

.status-open {
    background: #eef7f1;

    color: #0b7a3b;
}

.status-pending {
    background: #fff6df;

    color: #9a7200;
}

.status-replied {
    background: #e9f3ff;

    color: #1767a6;
}

.status-resolved {
    background: #e9f8ee;

    color: #237a46;
}

.status-closed {
    background: #f0f1f1;

    color: #68706c;
}

.ticket-subject {
    color: #27322d;

    font-size: 13px;

    font-weight: 900;

    margin-bottom: 6px;

    word-break: break-word;
}

.ticket-meta {
    display: flex;

    align-items: center;

    gap: 7px;

    flex-wrap: wrap;

    margin-bottom: 8px;
}

.ticket-category {
    color: #0b7a3b;

    background: #eef7f1;

    border-radius: 15px;

    padding: 4px 7px;

    font-size: 8px;

    font-weight: 800;
}

.ticket-priority {
    color: #8b6a00;

    background: #fff6df;

    border-radius: 15px;

    padding: 4px 7px;

    font-size: 8px;

    font-weight: 800;
}

.ticket-preview {
    color: #818a85;

    font-size: 10px;

    line-height: 1.5;

    display: -webkit-box;

    -webkit-line-clamp: 2;

    -webkit-box-orient: vertical;

    overflow: hidden;
}

.ticket-date {
    display: block;

    margin-top: 10px;

    padding-top: 9px;

    border-top: 1px solid #edf0ee;

    color: #9aa19d;

    font-size: 8px;
}


/* =========================================
   CONTACT
========================================= */

.contact-section {
    margin-bottom: 20px;
}

.contact-heading {
    margin-bottom: 12px;
}

.contact-heading h2 {
    color: #172033;

    font-size: 18px;

    font-weight: 900;
}

.contact-heading p {
    color: #818a85;

    font-size: 10px;

    margin-top: 5px;

    line-height: 1.5;
}

.contact-card {
    display: flex;

    align-items: center;

    gap: 12px;

    min-height: 76px;

    padding: 12px;

    margin-bottom: 9px;

    background: #ffffff;

    border: 1px solid #e1e7e4;

    border-radius: 16px;

    box-shadow:
        0 3px 12px rgba(0,0,0,.03);
}

.contact-icon {
    width: 43px;
    height: 43px;

    flex: 0 0 43px;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 12px;

    background: #eef7f1;

    font-size: 20px;
}

.contact-content {
    flex: 1;

    min-width: 0;
}

.contact-content small {
    display: block;

    color: #858e89;

    font-size: 9px;

    margin-bottom: 3px;
}

.contact-content strong {
    display: block;

    color: #29342e;

    font-size: 12px;

    margin-bottom: 3px;
}

.contact-content span {
    display: block;

    color: #8a928d;

    font-size: 9px;
}

.contact-arrow {
    width: 35px;
    height: 35px;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 10px;

    background: #eef7f1;

    color: #0b7a3b;

    font-size: 19px;

    font-weight: 900;
}


/* =========================================
   SUPPORT NOTE
========================================= */

.support-note {
    display: flex;

    align-items: center;

    gap: 11px;

    padding: 14px;

    border: 1px solid #d8ebdf;

    border-radius: 16px;

    background: #eef7f1;
}

.note-icon {
    width: 40px;
    height: 40px;

    flex: 0 0 40px;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 12px;

    background: #ffffff;

    color: #0b7a3b;

    font-size: 19px;

    font-weight: 900;
}

.support-note strong {
    display: block;

    color: #28573d;

    font-size: 11px;

    margin-bottom: 3px;
}

.support-note p {
    color: #66806f;

    font-size: 9px;

    line-height: 1.45;
}


/* =========================================
   CONVERSATION MODAL
========================================= */

.conversation-modal {
    position: fixed;

    inset: 0;

    z-index: 5000;
}

.conversation-modal[hidden] {
    display: none;
}

.conversation-overlay {
    position: absolute;

    inset: 0;

    background: rgba(0,0,0,.5);
}

.conversation-card {
    position: absolute;

    left: 0;
    right: 0;
    bottom: 0;

    height: 92vh;

    display: flex;

    flex-direction: column;

    background: #f7f9f8;

    border-radius: 22px 22px 0 0;

    overflow: hidden;

    box-shadow:
        0 -10px 35px rgba(0,0,0,.18);
}


/* =========================================
   CONVERSATION HEADER
========================================= */

.conversation-header {
    min-height: 67px;

    display: flex;

    align-items: center;

    gap: 10px;

    padding: 10px 13px;

    background: #ffffff;

    border-bottom: 1px solid #e1e7e4;
}

.conversation-back,
.conversation-close {
    width: 38px;
    height: 38px;

    flex: 0 0 38px;

    border: none;

    border-radius: 11px;

    background: #eef7f1;

    color: #0b7a3b;

    font-size: 20px;

    font-weight: 900;

    cursor: pointer;
}

.conversation-header > div {
    flex: 1;

    min-width: 0;
}

.conversation-header strong {
    display: block;

    color: #172033;

    font-size: 13px;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}

.conversation-header small {
    display: block;

    color: #8a928d;

    font-size: 8px;

    margin-top: 3px;
}

.conversation-close {
    background: #f3f4f3;

    color: #69716c;
}


/* =========================================
   CONVERSATION INFO
========================================= */

.conversation-info {
    padding: 10px 14px;

    background: #eef7f1;

    border-bottom: 1px solid #dcebe2;

    color: #52685b;

    font-size: 9px;

    line-height: 1.5;
}


/* =========================================
   MESSAGES
========================================= */

.messages-container {
    flex: 1;

    overflow-y: auto;

    padding: 16px 13px 20px;

    display: flex;

    flex-direction: column;

    gap: 9px;
}

.message-row {
    display: flex;

    width: 100%;
}

.message-row.customer {
    justify-content: flex-end;
}

.message-row.admin {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 82%;

    padding: 10px 12px;

    border-radius: 15px;

    font-size: 11px;

    line-height: 1.5;

    word-break: break-word;
}

.message-row.customer .message-bubble {
    background: #0b7a3b;

    color: #ffffff;

    border-bottom-right-radius: 5px;
}

.message-row.admin .message-bubble {
    background: #ffffff;

    color: #29342e;

    border: 1px solid #e0e7e3;

    border-bottom-left-radius: 5px;

    box-shadow:
        0 2px 8px rgba(0,0,0,.03);
}

.message-sender {
    display: block;

    margin-bottom: 3px;

    font-size: 8px;

    font-weight: 900;

    opacity: .8;
}

.message-time {
    display: block;

    margin-top: 5px;

    font-size: 7px;

    opacity: .7;

    text-align: right;
}

.messages-empty {
    margin: auto;

    color: #8a928d;

    font-size: 10px;

    text-align: center;
}


/* =========================================
   REPLY
========================================= */

.reply-form {
    display: flex;

    align-items: flex-end;

    gap: 8px;

    padding: 10px;

    background: #ffffff;

    border-top: 1px solid #e1e7e4;

    padding-bottom:
        calc(10px + env(safe-area-inset-bottom));
}

.reply-form textarea {
    flex: 1;

    min-height: 43px;
    max-height: 110px;

    resize: none;

    border: 1px solid #dfe6e2;

    border-radius: 13px;

    padding: 11px;

    background: #f9fbfa;

    color: #172033;

    outline: none;

    font-size: 11px;

    line-height: 1.4;
}

.reply-form textarea:focus {
    border-color: #0b7a3b;

    background: #ffffff;
}

.send-btn {
    width: 43px;
    height: 43px;

    flex: 0 0 43px;

    border: none;

    border-radius: 13px;

    background: #0b7a3b;

    color: #ffffff;

    font-size: 19px;

    font-weight: 900;

    cursor: pointer;
}

.send-btn:disabled {
    opacity: .5;
}


/* =========================================
   BOTTOM NAV
========================================= */

.support-bottom-nav {
    position: fixed;

    left: 0;
    right: 0;
    bottom: 0;

    z-index: 2000;

    height: 78px;

    display: flex;

    align-items: center;

    justify-content: space-around;

    background: rgba(255,255,255,.97);

    border-top: 1px solid #e2e7e4;

    box-shadow:
        0 -5px 18px rgba(0,0,0,.06);

    padding-bottom:
        env(safe-area-inset-bottom);
}

.support-bottom-nav button {
    min-width: 65px;

    border: none;

    background: transparent;

    color: #7b847f;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    gap: 4px;

    cursor: pointer;
}

.support-bottom-nav span {
    font-size: 20px;

    line-height: 1;
}

.support-bottom-nav small {
    font-size: 9px;

    font-weight: 700;
}

.support-bottom-nav button.active {
    color: #0b7a3b;
}


/* =========================================
   TABLET / DESKTOP
========================================= */

@media (min-width: 600px) {

    body {
        padding-bottom: 0;
    }

    .support-main {
        padding:
            30px 24px 50px;
    }

    .support-bottom-nav {
        display: none;
    }

    .conversation-card {
        left: 50%;

        right: auto;

        bottom: 50%;

        width: 560px;

        max-width: calc(100% - 30px);

        height: 700px;

        max-height: 90vh;

        transform: translate(
            -50%,
            50%
        );

        border-radius: 22px;
    }

}