/* ============================================================
   AN Stock Portal — Stylesheet
   Used by both WordPress admin page and the client-facing shortcode.
   First Move brand: Navy #2B3672  Teal #3DBFB8  Teal Pale #E8F8F7
   ============================================================ */

/* ── Shared badge styles ───────────────────────────────────── */

.an-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    font-family: Arial, Helvetica, sans-serif;
}

.an-badge-ok  { background: #DCFCE7; color: #15803D; border: 1px solid #BBF7D0; }
.an-badge-low { background: #FEF9C3; color: #A16207; border: 1px solid #FDE68A; }
.an-badge-out { background: #FEE2E2; color: #B91C1C; border: 1px solid #FECACA; }

/* ============================================================
   ADMIN PAGE
   ============================================================ */

.an-stock-admin {
    font-family: Arial, Helvetica, sans-serif;
    max-width: 1200px;
}

/* Header */
.an-admin-header {
    display: flex;
    align-items: center;
    gap: 20px;
    background: #2B3672;
    color: #fff;
    padding: 16px 24px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.an-admin-header h1 {
    color: #fff !important;
    font-size: 22px !important;
    margin: 0 0 4px !important;
    padding: 0 !important;
    border: none !important;
    font-family: Arial, Helvetica, sans-serif;
}

.an-admin-header-text { flex: 1; }
.an-last-updated { color: #E8F8F7; margin: 0; font-size: 13px; }

.an-fm-logo     { height: 44px; border-radius: 4px; }
.an-an-logo-admin { height: 50px; border-radius: 4px; }

/* Summary cards */
.an-summary-cards {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.an-card {
    flex: 1;
    min-width: 120px;
    padding: 16px 20px;
    border-radius: 8px;
    text-align: center;
    background: #fff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.an-card-number {
    display: block;
    font-size: 32px;
    font-weight: 700;
    line-height: 1.1;
    font-family: Arial, Helvetica, sans-serif;
}

.an-card-label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: Arial, Helvetica, sans-serif;
}

.an-card-ok    .an-card-number { color: #15803D; }
.an-card-low   .an-card-number { color: #A16207; }
.an-card-out   .an-card-number { color: #B91C1C; }
.an-card-total .an-card-number { color: #2B3672; }

/* Section wrappers */
.an-section {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.an-section h2 {
    font-size: 16px;
    font-weight: 700;
    color: #2B3672;
    margin: 0 0 12px;
    font-family: Arial, Helvetica, sans-serif;
}

/* Drop zone */
#an-drop-zone {
    border: 2px dashed #3DBFB8;
    border-radius: 8px;
    padding: 32px;
    text-align: center;
    background: #E8F8F7;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    margin-bottom: 16px;
}

#an-drop-zone.an-drag-over {
    border-color: #2B3672;
    background: #ddeeff;
}

.an-drop-inner p {
    margin: 8px 0 0;
    color: #2B3672;
    font-family: Arial, Helvetica, sans-serif;
}

/* Status messages */
.an-status-msg {
    padding: 10px 16px;
    border-radius: 5px;
    margin-bottom: 12px;
    font-size: 14px;
    font-family: Arial, Helvetica, sans-serif;
}

.an-status-success { background: #DCFCE7; color: #15803D; border: 1px solid #BBF7D0; }
.an-status-error   { background: #FEE2E2; color: #B91C1C; border: 1px solid #FECACA; }
.an-status-info    { background: #E8F8F7; color: #2B3672; border: 1px solid #3DBFB8; }

/* Preview actions */
.an-preview-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

/* Table controls */
.an-table-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    align-items: center;
}

.an-table-controls input,
.an-table-controls select {
    font-family: Arial, Helvetica, sans-serif !important;
}

/* Row status colouring in admin */
.an-main-table .an-status-out td:first-child {
    border-left: 3px solid #B91C1C;
}

.an-main-table .an-status-low td:first-child {
    border-left: 3px solid #A16207;
}

.an-main-table .an-status-ok td:first-child {
    border-left: 3px solid #15803D;
}

.an-table-count {
    font-size: 12px;
    color: #888;
    margin-top: 8px;
    font-family: Arial, Helvetica, sans-serif;
}

.an-empty-state {
    color: #888;
    font-style: italic;
    font-family: Arial, Helvetica, sans-serif;
}

/* ============================================================
   CLIENT-FACING PORTAL (shortcode output)
   ============================================================ */

.an-portal-wrap {
    font-family: Arial, Helvetica, sans-serif;
    color: #4A4A4A;
    max-width: 960px;
    margin: 0 auto;
}

/* Portal header */
.an-portal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #2B3672;
    padding: 20px 28px;
    border-radius: 8px 8px 0 0;
    gap: 16px;
}

.an-portal-fm-logo {
    height: 38px;
    border-radius: 3px;
    flex-shrink: 0;
}

.an-portal-an-logo {
    height: 54px;
    border-radius: 4px;
    flex-shrink: 0;
}

.an-portal-header-center {
    flex: 1;
    text-align: center;
}

.an-portal-title {
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 4px;
}

.an-portal-subtitle {
    color: #3DBFB8;
    font-size: 13px;
    margin: 0;
}

/* Meta bar */
.an-portal-meta-bar {
    background: #E8F8F7;
    border: 1px solid #b8e8e5;
    border-top: none;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #2B3672;
    flex-wrap: wrap;
    gap: 8px;
}

.an-portal-meta-bar strong { color: #2B3672; }

.an-legend { display: flex; gap: 8px; align-items: center; }

/* Category blocks */
.an-category-block {
    margin-top: 20px;
    border: 1px solid #dde8f5;
    border-radius: 6px;
    overflow: hidden;
}

.an-cat-header {
    background: #2B3672;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.an-cat-title {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    margin: 0;
    letter-spacing: 0.02em;
}

.an-cat-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #E8F8F7;
}

.an-cat-alert {
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
}

.an-cat-alert-low  { background: #FEF9C3; color: #A16207; }
.an-cat-alert-out  { background: #FEE2E2; color: #B91C1C; }

/* Portal table */
.an-portal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.an-portal-table thead th {
    background: #E8F8F7;
    color: #2B3672;
    font-weight: 700;
    padding: 10px 16px;
    text-align: left;
    border-bottom: 2px solid #b8e8e5;
}

.an-portal-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background .1s;
}

.an-portal-table tbody tr:last-child { border-bottom: none; }

.an-portal-table tbody tr:hover { background: #f9fffe; }

.an-portal-table tbody td {
    padding: 10px 16px;
    color: #4A4A4A;
    vertical-align: middle;
}

/* Out of stock row — subtle highlight */
.an-portal-table tbody tr.an-status-out {
    background: #fff8f8;
}

.an-portal-table tbody tr.an-status-low {
    background: #fffef0;
}

.an-num-col    { text-align: right;  width: 120px; }
.an-status-col { text-align: center; width: 130px; }

/* Portal footer */
.an-portal-footer {
    margin-top: 28px;
    padding: 14px 20px;
    background: #f7f7f7;
    border: 1px solid #e0e0e0;
    border-radius: 0 0 8px 8px;
    text-align: center;
    font-size: 12px;
    color: #888;
}

.an-portal-footer a { color: #3DBFB8; text-decoration: none; }
.an-portal-footer a:hover { text-decoration: underline; }

.an-portal-empty {
    padding: 32px;
    text-align: center;
    color: #888;
    font-style: italic;
}

/* ── Responsive ─────────────────────────────────────────────── */

@media ( max-width: 640px ) {
    .an-portal-header { flex-wrap: wrap; justify-content: center; text-align: center; }
    .an-portal-meta-bar { flex-direction: column; align-items: flex-start; }
    .an-legend { flex-wrap: wrap; }
    .an-portal-table thead th:nth-child(2) { display: none; }
    .an-portal-table tbody td:nth-child(2) { display: none; }
    .an-summary-cards .an-card { min-width: 80px; }
}
