/*
 * PostfixAdmin Modern Light Theme
 * Separate override file; the original Bootstrap CSS is untouched.
 */

:root {
    color-scheme: light;
    --pfa-primary: #2859c5;
    --pfa-primary-hover: #2048a5;
    --pfa-text: #1e293b;
    --pfa-muted: #64748b;
    --pfa-page: #f4f7fb;
    --pfa-surface: #ffffff;
    --pfa-border: #e2e8f0;
    --pfa-soft: #f8fafc;
    --pfa-focus: rgba(40, 89, 197, .18);
    --pfa-shadow: 0 8px 26px rgba(15, 23, 42, .055);
}

html {
    color-scheme: light;
}

body {
    background: var(--pfa-page) !important;
    color: var(--pfa-text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
                 sans-serif;
    font-size: 15px;
    line-height: 1.55;
}

a {
    color: var(--pfa-primary);
    text-decoration: none;
}

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

h1, h2, h3, h4, h5, h6 {
    color: #14213a;
    font-weight: 650;
    letter-spacing: -.018em;
}

h1 {
    margin-bottom: 1.25rem;
}

hr {
    border-color: var(--pfa-border);
    opacity: 1;
}

/* Clean white navigation */
.navbar {
    background: var(--pfa-surface) !important;
    border: 0 !important;
    border-bottom: 1px solid var(--pfa-border) !important;
    box-shadow: 0 3px 16px rgba(15, 23, 42, .04);
    padding-top: .7rem;
    padding-bottom: .7rem;
}

.navbar .navbar-brand {
    color: #14213a !important;
    font-weight: 750;
    letter-spacing: -.025em;
}

.navbar .nav-link,
.navbar .navbar-text {
    color: #475569 !important;
    border-radius: .55rem;
}

.navbar .nav-link {
    padding: .55rem .8rem;
    transition: background-color .15s ease, color .15s ease;
}

.navbar .nav-link:hover,
.navbar .nav-link:focus,
.navbar .nav-link.active {
    background: #eef4ff;
    color: var(--pfa-primary) !important;
}

.navbar .navbar-toggler {
    border-color: var(--pfa-border);
    border-radius: .6rem;
}

/* Headings and page content */
.container,
.container-fluid {
    color: var(--pfa-text);
}

.container > h1,
.container > h2,
.container-fluid > h1,
.container-fluid > h2 {
    margin-top: 1rem;
}

/* Cards and panels */
.card,
.panel {
    background: var(--pfa-surface);
    border: 1px solid var(--pfa-border);
    border-radius: .9rem;
    box-shadow: var(--pfa-shadow);
}

.card-header,
.panel-heading {
    background: var(--pfa-soft);
    border-bottom: 1px solid var(--pfa-border);
    color: var(--pfa-text);
    font-weight: 650;
}

/* Readable mailbox and domain tables */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--pfa-text);
    --bs-table-border-color: var(--pfa-border);
    margin-bottom: 1rem;
}

.table > thead > tr > th,
.table > thead > tr > td {
    background: var(--pfa-soft);
    border-bottom: 1px solid var(--pfa-border);
    color: #526176;
    font-size: .76rem;
    font-weight: 750;
    letter-spacing: .045em;
    padding: .9rem 1rem;
    text-transform: uppercase;
    vertical-align: middle;
    white-space: nowrap;
}

.table > tbody > tr > td,
.table > tbody > tr > th {
    border-color: var(--pfa-border);
    padding: .8rem 1rem;
    vertical-align: middle;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-accent-bg: #fbfcfe;
}

.table-hover > tbody > tr:hover > * {
    --bs-table-accent-bg: #eff5ff;
    color: var(--pfa-text);
}

.table-responsive {
    border-radius: .7rem;
}

/* Forms */
.form-control,
.form-select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
textarea,
select {
    border: 1px solid #cbd5e1;
    border-radius: .6rem;
    min-height: 40px;
}

.form-control,
.form-select {
    padding: .55rem .75rem;
}

.form-control:focus,
.form-select:focus,
input:focus,
textarea:focus,
select:focus {
    border-color: #7da0ee;
    box-shadow: 0 0 0 .22rem var(--pfa-focus);
    outline: none;
}

.form-label,
label {
    color: #334155;
    font-weight: 600;
}

.form-text,
.help-block,
.text-muted {
    color: var(--pfa-muted) !important;
}

.form-check-input:checked {
    background-color: var(--pfa-primary);
    border-color: var(--pfa-primary);
}

/* Consistent action buttons */
.btn {
    border-radius: .6rem;
    font-weight: 600;
    padding: .52rem .9rem;
    transition: background-color .15s ease, border-color .15s ease;
}

.btn-primary {
    background-color: var(--pfa-primary);
    border-color: var(--pfa-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--pfa-primary-hover);
    border-color: var(--pfa-primary-hover);
}

.btn:focus-visible,
a:focus-visible {
    outline: 3px solid var(--pfa-focus);
    outline-offset: 2px;
}

/* Alerts, dropdowns, pagination */
.alert {
    border-radius: .7rem;
    border-width: 1px;
}

.dropdown-menu {
    border: 1px solid var(--pfa-border);
    border-radius: .7rem;
    box-shadow: var(--pfa-shadow);
    padding: .4rem;
}

.dropdown-item {
    border-radius: .4rem;
    padding: .5rem .75rem;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: #eff5ff;
    color: var(--pfa-primary-hover);
}

.pagination .page-link {
    border-color: var(--pfa-border);
    color: var(--pfa-primary);
}

.pagination .active .page-link {
    background: var(--pfa-primary);
    border-color: var(--pfa-primary);
    color: #fff;
}

.badge {
    border-radius: 999px;
    font-weight: 650;
    padding: .38em .65em;
}

footer,
.footer {
    color: var(--pfa-muted);
    font-size: .875rem;
}

/* Keep the interface usable on smaller screens */
@media (max-width: 767.98px) {
    body {
        font-size: 14px;
    }

    .table > thead > tr > th,
    .table > tbody > tr > td,
    .table > tbody > tr > th {
        padding: .65rem .7rem;
    }

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

/* Client logo sizing */
.navbar .navbar-brand img,
#login_header_logo {
    max-height: 42px;
    max-width: 220px;
    width: auto;
    height: auto;
    object-fit: contain;
    vertical-align: middle;
}

/* Larger client logo override */
.navbar .navbar-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.navbar .navbar-brand img,
#login_header_logo {
    max-height: 64px;
    max-width: 320px;
    width: auto;
    height: auto;
    object-fit: contain;
    vertical-align: middle;
}

/* Slightly larger client logo */
img#login_header_logo {
    height: 72px !important;
    max-height: 72px !important;
    max-width: 360px !important;
    width: auto !important;
}

.navbar .navbar-brand {
    min-height: 80px;
}

/* Minimal client dashboard and navigation */
.pfa-minimal-navbar {
    background: #ffffff !important;
    min-height: 88px;
    padding: 8px 12px;
}

.pfa-minimal-navbar .navbar-brand {
    display: flex;
    align-items: center;
    min-height: 78px;
    padding: 6px 16px;
}

.pfa-minimal-navbar #login_header_logo {
    height: 72px !important;
    max-height: 72px !important;
    max-width: 360px !important;
    width: auto !important;
    object-fit: contain;
}

.pfa-minimal-navbar .navbar-nav > li > a {
    color: #334155 !important;
    border-radius: 7px;
    margin: 10px 3px;
    padding: 12px 14px;
}

.pfa-minimal-navbar .navbar-nav > li > a:hover,
.pfa-minimal-navbar .navbar-nav > li > a:focus {
    background: #eff5ff !important;
    color: #2859c5 !important;
}

.pfa-dashboard {
    max-width: 1200px;
    margin: 28px auto;
    padding: 0 16px;
}

.pfa-page-heading {
    margin-bottom: 26px;
}

.pfa-page-heading h1 {
    margin: 0 0 8px;
    font-size: 30px;
    font-weight: 700;
    color: #14213a;
}

.pfa-page-heading p {
    margin: 0;
    color: #64748b;
    font-size: 15px;
}

.pfa-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.pfa-dashboard-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 28px;
    box-shadow: 0 8px 26px rgba(15, 23, 42, .045);
}

.pfa-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    border-radius: 12px;
    background: #eff5ff;
    color: #2859c5;
    font-size: 22px;
}

.pfa-dashboard-card h2 {
    margin: 6px 0 10px;
    font-size: 21px;
    font-weight: 650;
}

.pfa-dashboard-card p {
    min-height: 48px;
    margin-bottom: 22px;
    color: #64748b;
    line-height: 1.65;
}

.pfa-dashboard-card .btn {
    padding: 10px 16px;
}

@media (max-width: 767.98px) {
    .pfa-minimal-navbar {
        padding: 4px 8px;
    }

    .pfa-minimal-navbar .navbar-brand {
        min-height: 70px;
    }

    .pfa-minimal-navbar #login_header_logo {
        height: 60px !important;
        max-height: 60px !important;
        max-width: 280px !important;
    }

    .pfa-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .pfa-dashboard-card {
        padding: 22px;
    }

    .pfa-page-heading h1 {
        font-size: 25px;
    }
}


/* Navigation icon spacing */
.navbar .nav > li > a .glyphicon,
.navbar .nav > li > a .fa,
.navbar .nav > li > a .fas,
.navbar .nav > li > a .far,
.navbar .nav > li > a .fab,
.navbar .nav > li > a .bi,
.navbar .nav > li > a > i {
    margin-right: 8px;
}


/* Admin List dropdown spacing */
.navbar .navbar-nav > li.dropdown > a.dropdown-toggle .caret {
    margin-left: 8px;
}


/* Center company logo only on the login page */
.pfa-login-navbar #login_header_logo {
    display: block !important;
    float: none !important;
    margin: 0 auto 1.5rem !important;
}

/* Center only the login page logo container */
.pfa-login-navbar a:has(#login_header_logo) {
    display: block !important;
    float: none !important;
    width: 100% !important;
    text-align: center !important;
}

.pfa-login-navbar .navbar-header {
    float: none !important;
    width: 100% !important;
    text-align: center !important;
}

/* =========================================================
   PostfixAdmin Email Accounts redesign v1
   Scoped to the account-list page.
   ========================================================= */
.pfa-email-page {
    max-width: 1500px;
    margin: 0 auto 32px;
}

.pfa-email-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin: 12px 0 24px;
}

.pfa-email-page-title h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 7px;
    color: #0f172a;
    font-size: 27px;
    font-weight: 700;
    line-height: 1.35;
}

.pfa-email-page-title h2 .glyphicon {
    color: #2563eb;
    font-size: 24px;
}

.pfa-email-page-title p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}

.pfa-add-email {
    flex-shrink: 0;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(37, 99, 235, .12);
}

.pfa-add-email .glyphicon {
    margin-right: 6px;
}

.pfa-email-toolbar {
    display: grid;
    grid-template-columns: minmax(210px, .8fr) minmax(260px, 1.2fr);
    gap: 18px;
    padding: 18px;
    margin-bottom: 18px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .035);
}

.pfa-domain-selector,
.pfa-email-search {
    min-width: 0;
}

.pfa-domain-selector > label,
.pfa-email-search > label {
    display: block;
    margin-bottom: 7px;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.pfa-domain-selector form,
.pfa-email-search form {
    margin-bottom: 0;
}

.pfa-domain-selector .form-control {
    min-height: 42px;
    border-color: #cbd5e1;
    border-radius: 7px;
}

.pfa-email-search form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pfa-email-search form .form-group {
    flex: 1 1 180px;
    min-width: 0;
    margin-bottom: 0;
}

.pfa-email-search input[type="text"],
.pfa-email-search input[type="search"],
.pfa-email-search .form-control {
    min-height: 42px;
    border-color: #cbd5e1;
    border-radius: 7px;
}

.pfa-email-search button,
.pfa-email-search input[type="submit"] {
    min-height: 40px;
    border-radius: 7px;
}

.pfa-account-summary {
    display: flex;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    padding: 2px 4px 18px;
}

.pfa-summary-count {
    display: flex;
    align-items: baseline;
    gap: 9px;
}

.pfa-summary-number {
    color: #0f172a;
    font-size: 25px;
    font-weight: 750;
    line-height: 1.2;
}

.pfa-summary-label {
    color: #475569;
    font-size: 14px;
}

.pfa-summary-domain,
.pfa-summary-capacity {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.pfa-summary-caption {
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.pfa-summary-domain strong,
.pfa-summary-capacity strong {
    color: #334155;
    font-size: 13px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.pfa-search-summary {
    margin: 2px 0 18px;
    padding: 12px 15px;
    color: #334155;
    background: #eff6ff;
    border: 1px solid #dbeafe;
    border-radius: 8px;
}

.pfa-search-summary .glyphicon {
    margin-right: 8px;
    color: #2563eb;
}

#mailboxes.pfa-email-accounts-panel {
    overflow: visible;
    margin-bottom: 20px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 3px 12px rgba(15, 23, 42, .045);
}

.pfa-email-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
    padding: 10px 18px;
}

.pfa-email-pagination .pagination {
    margin: 0;
}

.pfa-email-table-wrap {
    width: 100%;
    overflow-x: auto;
}

#mailbox_table.pfa-email-table {
    width: 100%;
    min-width: 950px;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    background: #ffffff;
}

.pfa-email-table > thead > tr > th {
    padding: 15px 14px;
    color: #475569;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    font-size: 11px;
    font-weight: 750;
    letter-spacing: .045em;
    text-transform: uppercase;
    white-space: nowrap;
    vertical-align: middle;
}

.pfa-email-table > tbody > tr > td {
    padding: 14px;
    color: #334155;
    border-top: 1px solid #edf0f4;
    vertical-align: middle;
    font-size: 13px;
}

.pfa-email-table > tbody > tr:first-child > td {
    border-top: 0;
}

.pfa-email-table > tbody > tr:hover > td {
    background: #f8fbff;
}

.pfa-email-table .pfa-status-heading,
.pfa-email-table .pfa-status-indicator {
    width: 82px;
    text-align: center;
}

.pfa-email-table .pfa-status-indicator > span {
    display: inline-block;
    min-width: 18px;
    min-height: 12px;
    border-radius: 4px;
    vertical-align: middle;
}

.pfa-email-table .pfa-email-address {
    min-width: 235px;
    color: #1d4ed8;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.pfa-email-table .pfa-email-name {
    min-width: 130px;
    overflow-wrap: anywhere;
}

.pfa-email-table .pfa-not-set {
    color: #94a3b8;
}

.pfa-email-table .pfa-quota-cell {
    min-width: 125px;
    white-space: nowrap;
}

.pfa-email-table .pfa-quota-display {
    min-width: 90px;
}

.pfa-email-table .pfa-last-modified {
    min-width: 135px;
    color: #64748b;
    white-space: nowrap;
}

.pfa-email-table .pfa-account-status,
.pfa-email-table .pfa-smtp-status {
    min-width: 115px;
    white-space: nowrap;
}

.pfa-email-table .pfa-account-toggle {
    min-width: 88px;
    border-radius: 6px;
    font-weight: 600;
}

.pfa-email-table .pfa-row-actions {
    min-width: 245px;
}

.pfa-row-actions-inner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.pfa-row-actions-inner .btn {
    border-radius: 6px;
}

.pfa-row-actions-inner .pfa-delete-form {
    display: inline-block;
    margin: 0;
}

.pfa-email-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 18px;
    border-top: 1px solid #e2e8f0;
    background: #fbfcfe;
    border-radius: 0 0 12px 12px;
}

.pfa-email-pagination-bottom {
    padding: 0;
    justify-content: flex-start;
}

.pfa-email-export .btn {
    border-radius: 7px;
}

.pfa-empty-state {
    padding: 48px 20px;
    text-align: center;
    color: #64748b;
}

.pfa-empty-state > .glyphicon {
    color: #94a3b8;
    font-size: 36px;
}

.pfa-empty-state h3 {
    margin: 15px 0 8px;
    color: #334155;
    font-size: 19px;
    font-weight: 650;
}

.pfa-empty-state p {
    margin-bottom: 18px;
}

.pfa-status-legend {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 18px;
    padding: 14px 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    color: #64748b;
    font-size: 12px;
}

.pfa-status-legend-title {
    color: #334155;
}

.pfa-status-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pfa-status-swatch {
    display: inline-block;
    min-width: 18px;
    min-height: 12px;
    border-radius: 3px;
    vertical-align: middle;
}

@media (max-width: 767px) {
    .pfa-email-page-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
    }

    .pfa-email-page-title h2 {
        font-size: 23px;
    }

    .pfa-email-toolbar {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
        padding: 14px;
    }

    .pfa-account-summary {
        gap: 15px 22px;
    }

    .pfa-email-pagination {
        padding: 10px 12px;
    }

    .pfa-email-table > thead > tr > th,
    .pfa-email-table > tbody > tr > td {
        padding: 12px 10px;
    }

    .pfa-email-table-footer {
        align-items: flex-start;
        flex-direction: column;
        padding: 12px;
    }

    .pfa-email-pagination-bottom {
        width: 100%;
        overflow-x: auto;
    }
}


/* Email accounts page: compact top spacing */
#main,
#main.container,
.container:has(> .pfa-email-page) {
    scroll-margin-top: 12px;
}

.pfa-email-page {
    margin-top: 0;
}

.pfa-email-page-header {
    margin-top: 4px;
}

/* Preserve readable spacing for success/error notifications. */
.alert,
.alert-dismissible {
    margin-bottom: 16px;
}

/* Global authenticated-page spacing adjustment */
body:not(.page-login) {
    padding-top: 0 !important;
}

body:not(.page-login) > .container,
body:not(.page-login) > .container-fluid {
    margin-top: 12px !important;
    padding-top: 0 !important;
}

/* Keep notification messages visible and readable. */
body:not(.page-login) .alert {
    margin-top: 0;
    margin-bottom: 16px;
}

/* Keep the Email Accounts heading close to the content above it. */
body:not(.page-login) .pfa-email-page {
    margin-top: 0 !important;
}

body:not(.page-login) .pfa-email-page-header {
    margin-top: 4px !important;
}


/* Login form vertical centering - login page only */
body:has(.pfa-login-navbar) #login {
    min-height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
}
