﻿/* ==========================================================
   MAIL WORKSPACE
========================================================== */

.axx-mail-workspace {
    display: grid;
    grid-template-columns: 380px 1fr;
    height: calc(100vh - 220px);
    overflow: hidden;
}

.axx-mail-message {
    overflow-y: auto;
}

/* ==========================================================
   MAIL FUNCTIONS
========================================================== */

.axx-mail-functions .card {
    border: none;
    border-radius: .75rem;
    overflow: hidden;
}

.axx-mail-functions .card-header {
    background: var(--axx-surface);
    font-weight: 600;
    font-size: .95rem;
}

.axx-mail-functions .list-group-item {
    border: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .70rem .90rem;
    transition: background-color .15s ease, color .15s ease;
}

    .axx-mail-functions .list-group-item:hover {
        background: var(--axx-hover);
    }

    .axx-mail-functions .list-group-item.active {
        background: var(--axx-primary);
        border-color: var(--axx-primary);
        color: #fff;
    }

        .axx-mail-functions .list-group-item.active svg {
            color: #fff;
        }

.axx-mail-functions .folder-label {
    display: flex;
    align-items: center;
    gap: .60rem;
}

    .axx-mail-functions .folder-label svg {
        width: 18px;
        height: 18px;
    }

.axx-mail-functions .badge {
    font-size: .70rem;
}

.axx-mail-divider {
    height: 10px;
    background: var(--axx-surface);
}

/* ==========================================================
   MAIL LIST
========================================================== */

.axx-mail-list {
    height: 55vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--axx-border);
    border-radius: var(--axx-radius);
    background: var(--axx-bg);
    overflow: hidden;
}

.axx-mail-list-header {
    height: 28px;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 .35rem 0 .5rem;
    background: var(--axx-surface);
    border-bottom: 1px solid var(--axx-border);
}

.axx-mail-list-title {
    font-size: .78rem;
    font-weight: 600;
    color: var(--axx-text);
}

.axx-mail-list-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.axx-mail-row {
    display: flex;
    align-items: stretch;
    min-height: 46px;
    border-bottom: 1px solid var(--axx-border-soft);
}

    .axx-mail-row:nth-child(odd) {
        background: #e7f3ff;
    }

    .axx-mail-row:nth-child(even) {
        background: #f8fbff;
    }

    .axx-mail-row:hover {
        background: var(--axx-hover);
    }

.axx-mail-selector {
    width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .axx-mail-selector input {
        width: 14px;
        height: 14px;
        margin: 0;
    }

.axx-mail-row-link {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .25rem .5rem .25rem .15rem;
    color: var(--axx-text);
    text-decoration: none;
}

.axx-mail-row-main {
    min-width: 0;
}

.axx-mail-subject,
.axx-mail-from {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.axx-mail-subject {
    font-size: .78rem;
}

    .axx-mail-subject.is-unread {
        font-weight: 700;
    }

    .axx-mail-subject.is-read {
        font-weight: 400;
    }

.axx-mail-from,
.axx-mail-date {
    font-size: .70rem;
    color: var(--axx-muted);
}

.axx-mail-date {
    white-space: nowrap;
}

.axx-mail-empty {
    padding: 2rem;
    text-align: center;
    font-size: .78rem;
    color: var(--axx-muted);
}

/* ==========================================================
   SHARED SCROLLBAR
========================================================== */

.email-setup-scroll,
.axx-compose-scroll,
.axx-mail-list-body {
    scrollbar-width: thin;
    scrollbar-color: #9ca3af transparent;
}

.email-setup-scroll,
.axx-compose-scroll {
    overflow-y: auto;
    overflow-x: hidden;
}

.email-setup-scroll {
    height: calc(100vh - 180px);
    padding: 1.5rem;
}

    .email-setup-scroll::-webkit-scrollbar,
    .axx-compose-scroll::-webkit-scrollbar,
    .axx-mail-list-body::-webkit-scrollbar {
        width: 10px;
    }

    .email-setup-scroll::-webkit-scrollbar-track,
    .axx-compose-scroll::-webkit-scrollbar-track,
    .axx-mail-list-body::-webkit-scrollbar-track {
        background: transparent;
    }

    .email-setup-scroll::-webkit-scrollbar-thumb,
    .axx-compose-scroll::-webkit-scrollbar-thumb,
    .axx-mail-list-body::-webkit-scrollbar-thumb {
        background: #9ca3af;
        border-radius: 8px;
    }

        .email-setup-scroll::-webkit-scrollbar-thumb:hover,
        .axx-compose-scroll::-webkit-scrollbar-thumb:hover,
        .axx-mail-list-body::-webkit-scrollbar-thumb:hover {
            background: #6b7280;
        }

/* ==========================================================
   MAIL COMPOSE
========================================================== */

.axx-mail-compose {
    height: 60vh;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.axx-compose-card {
    height: 55vh;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--axx-bg);
    border: 1px solid var(--axx-border);
    border-radius: var(--axx-radius);
    box-shadow: none;
    overflow: hidden;
}

.axx-compose-header,
.axx-compose-footer {
    flex: 0 0 auto;
    background: var(--axx-surface);
    border-color: var(--axx-border);
}

.axx-compose-header {
    padding: .45rem .75rem;
}

.axx-compose-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .55rem .75rem;
    border-top: 1px solid var(--axx-border);
}

.axx-compose-title {
    display: flex;
    align-items: center;
    gap: .6rem;
}

    .axx-compose-title svg {
        width: 18px;
        height: 18px;
        color: var(--axx-primary);
    }

    .axx-compose-title h5 {
        margin: 0;
        font-size: .95rem;
        font-weight: 600;
    }

    .axx-compose-title small {
        display: block;
        margin-top: -.15rem;
        font-size: .72rem;
        color: var(--axx-muted);
    }

.axx-compose-body {
    min-height: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}

.axx-compose-scroll {
    flex: 1 1 auto;
    min-height: 0;
}

/* ==========================================================
   COMPOSE TOOLBAR
========================================================== */

.axx-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .35rem;
    flex-wrap: wrap;
    background: transparent;
    border: 0;
    padding: 0;
}

    .axx-toolbar .btn-group {
        flex: 0 0 auto;
    }

/* ==========================================================
   COMPOSE FIELDS
========================================================== */

.axx-message-fields,
.axx-options-panel,
.axx-editor-section,
.axx-attachments {
    background: var(--axx-bg);
}

.axx-message-fields {
    padding: .65rem .75rem;
}

.axx-options-panel {
    padding: .45rem .75rem;
}

.axx-field-grid {
    display: grid;
    gap: .45rem .75rem;
}

    .axx-field-grid.two-col {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .axx-field-grid.four-col {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

.axx-field-row {
    display: flex;
    align-items: center;
    gap: .35rem;
}

    .axx-field-row label {
        flex: 0 0 38px;
        margin: 0;
        font-size: .76rem;
        font-weight: 600;
        color: var(--axx-text);
    }

.axx-field-control {
    flex: 1;
    min-width: 0;
}

.axx-subject-row {
    margin-top: .45rem;
}

/* ==========================================================
   RECIPIENTS
========================================================== */

.axx-recipient-box {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: .20rem;
    width: 100%;
    height: var(--axx-control-height);
    min-height: var(--axx-control-height);
    padding: 0 .25rem;
    background: var(--axx-bg);
    border: 1px solid var(--axx-border);
    border-radius: var(--axx-radius);
    overflow: hidden;
}

    .axx-recipient-box:focus-within {
        border-color: var(--axx-primary);
        box-shadow: 0 0 0 .12rem rgba(0,122,204,.18);
    }

.axx-recipient-input {
    flex: 1 1 auto;
    min-width: 60px;
    height: 22px;
    padding: 0 .20rem;
    border: 0 !important;
    outline: 0;
    background: transparent !important;
    box-shadow: none !important;
    font-size: .75rem;
    line-height: 22px;
}

.axx-recipient-chip {
    display: inline-flex;
    align-items: center;
    gap: .20rem;
    flex: 0 0 auto;
    height: 18px;
    padding: 0 .35rem;
    font-size: .70rem;
    line-height: 18px;
    color: #fff;
    border-radius: 2px;
    white-space: nowrap;
}

.axx-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 12px;
    height: 12px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

    .axx-chip-remove svg {
        width: 10px;
        height: 10px;
    }

.axx-autocomplete {
    margin-top: .25rem;
}

/* ==========================================================
   MESSAGE OPTIONS
========================================================== */

.axx-options-panel .accordion,
.axx-options-panel .accordion-item,
.axx-accordion-item {
    border: 0;
    box-shadow: none;
    background: transparent;
}

.axx-options-panel .accordion-button,
.axx-options-panel .accordion-button:not(.collapsed),
.axx-accordion-button {
    min-height: 28px;
    padding: 0;
    border: 0;
    border-bottom: 0;
    box-shadow: none;
    background: transparent;
    font-size: .82rem;
    font-weight: 600;
    color: var(--axx-text);
}

    .axx-accordion-button svg {
        width: 15px;
        height: 15px;
        margin-right: .35rem;
        color: var(--axx-primary);
    }

.axx-options-body {
    padding: .15rem 0 0;
}

.axx-message-options-grid,
.axx-check-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .5rem .75rem;
    margin-top: .75rem;
}

.axx-check {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    min-height: var(--axx-control-height);
    font-size: .75rem;
    color: var(--axx-text);
    cursor: pointer;
    user-select: none;
}

    .axx-check input[type="checkbox"] {
        width: 15px;
        height: 15px;
        margin: 0;
        accent-color: var(--axx-primary);
        cursor: pointer;
    }

/* ==========================================================
   EDITOR
========================================================== */

.axx-editor-section {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    border: 1px solid var(--axx-border);
    border-radius: var(--axx-radius);
    overflow: hidden;
}

.axx-editor-status {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .35rem;
    height: var(--axx-control-height);
    min-height: var(--axx-control-height);
    padding: 0 .5rem;
    font-size: .72rem;
    color: var(--axx-muted);
    background: var(--axx-surface);
}

    .axx-editor-status span,
    .axx-status {
        display: inline-flex;
        align-items: center;
        height: 20px;
        padding: 0 .45rem;
        font-size: .72rem;
        border-radius: 3px;
        background: var(--axx-surface);
        color: var(--axx-text);
    }

.axx-editor-host {
    flex: 1 1 auto;
    min-height: 420px;
    overflow: hidden;
}

.axx-compose-editor {
    width: 100%;
    min-height: 420px;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.axx-editor-host textarea.axx-compose-editor {
    height: 420px;
    min-height: 420px;
    line-height: normal;
}

.axx-editor-host .tox-tinymce {
    border: 0;
    border-radius: 0;
    min-height: 420px;
}

.axx-editor-host .tox-editor-container {
    min-height: 420px;
}

.axx-editor-host .tox-toolbar,
.axx-editor-host .tox-toolbar__primary,
.axx-editor-host .tox-toolbar__overflow {
    min-height: var(--axx-control-height);
}

.axx-editor-host .tox-edit-area {
    min-height: 320px;
}

.axx-editor-host .tox-statusbar {
    height: var(--axx-control-height);
    min-height: var(--axx-control-height);
    font-size: .72rem;
}

.axx-validation-message {
    display: block;
    padding: .25rem .5rem;
    font-size: .72rem;
    color: var(--axx-danger);
}

/* ==========================================================
   ATTACHMENTS
========================================================== */

.axx-attachments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .45rem .75rem;
}

.axx-section-title {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .85rem;
    font-weight: 600;
    color: var(--axx-text);
}

    .axx-section-title svg {
        width: 16px;
        height: 16px;
        color: var(--axx-primary);
    }

.axx-drop-wrap {
    padding: .75rem;
}

.axx-drop-zone {
    text-align: center;
    padding: 1.25rem;
    border: 2px dashed var(--axx-border);
    border-radius: var(--axx-radius);
    background: var(--axx-surface);
}

    .axx-drop-zone svg {
        width: 34px;
        height: 34px;
        color: var(--axx-primary);
    }

    .axx-drop-zone h6 {
        margin: .4rem 0 .2rem;
        font-size: .9rem;
        font-weight: 600;
    }

    .axx-drop-zone p {
        margin: 0 0 .55rem;
        font-size: .78rem;
        color: var(--axx-muted);
    }

.axx-attachment-table {
    margin-bottom: 0;
    font-size: .82rem;
}

    .axx-attachment-table .icon-col {
        width: 40px;
    }

    .axx-attachment-table .action-col {
        width: 150px;
    }

.axx-file-name {
    font-weight: 600;
}

.axx-attachment-table small {
    color: var(--axx-muted);
}

.axx-status.ready {
    background: #dcfce7;
    color: #166534;
}

.axx-empty-row {
    padding: 2rem;
    text-align: center;
    color: var(--axx-muted);
}

/* ==========================================================
   FOOTER
========================================================== */

.axx-draft-status {
    font-size: .78rem;
    color: var(--axx-muted);
}

    .axx-draft-status strong {
        color: var(--axx-text);
    }

/* ==========================================================
   RESPONSIVE
========================================================== */

@media (max-width: 992px) {
    .axx-mail-workspace {
        grid-template-columns: 1fr;
        height: auto;
    }

    .axx-mail-compose,
    .axx-compose-card {
        height: auto;
        min-height: 55vh;
    }

    .axx-field-grid.two-col,
    .axx-field-grid.four-col,
    .axx-message-options-grid,
    .axx-check-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .axx-compose-scroll {
        max-height: 60vh;
    }
}

@media (max-width: 576px) {
    .axx-field-grid.two-col,
    .axx-field-grid.four-col,
    .axx-message-options-grid,
    .axx-check-grid {
        grid-template-columns: 1fr;
    }

    .axx-field-row {
        flex-direction: column;
        align-items: stretch;
        gap: .15rem;
    }

        .axx-field-row label {
            flex: 0 0 auto;
        }

    .axx-attachments-header,
    .axx-compose-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .axx-toolbar {
        gap: .25rem;
    }
}
