/**
 * Archivio Post Admin Styles
 *
 * @package ArchivioMD
 * @since   1.2.0
 * @updated 1.6.0 – Visual refresh matching Meta Documentation UI
 */

/* ===========================
   Page wrapper
   =========================== */
.archivio-post-admin {
    max-width: 1200px;
    margin: 20px 20px 20px 0;
    background: #f0f0f1;
    border-radius: 8px;
    padding: 0;
}

/* ===========================
   Gradient header
   =========================== */
.archivio-post-page-title {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    margin: 0;
    padding: 28px 36px;
    border-radius: 8px 8px 0 0;
    font-size: 26px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
    line-height: 1.2;
}

.archivio-post-page-title .dashicons {
    font-size: 30px;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
}

.archivio-post-page-subtitle {
    background: #fff;
    padding: 16px 36px;
    border-bottom: 1px solid #e0e0e0;
    margin: 0;
    color: #555;
    font-size: 14px;
    line-height: 1.6;
}

/* ===========================
   Custom tab bar
   =========================== */
.archivio-post-tabs {
    background: #fff;
    padding: 0 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-bottom: 2px solid #e0e0e0;
    margin: 0;
}

.archivio-post-tab-link {
    background: transparent;
    border: none;
    text-decoration: none;
    padding: 14px 18px;
    font-size: 13.5px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    position: relative;
    transition: color 0.2s ease, background 0.2s ease;
    border-radius: 6px 6px 0 0;
    white-space: nowrap;
}

.archivio-post-tab-link:hover {
    color: #667eea;
    background: #f5f5f5;
    text-decoration: none;
}

.archivio-post-tab-link.ap-tab-active {
    color: #667eea;
    background: transparent;
}

.archivio-post-tab-link.ap-tab-active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: #667eea;
    border-radius: 3px 3px 0 0;
}

.archivio-post-tab-link .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* ===========================
   Tab content area
   =========================== */
.archivio-post-content {
    margin: 0;
}

.archivio-post-tab-content {
    background: #fff;
    padding: 28px 36px;
    border-radius: 0 0 8px 8px;
    border: none;
    animation: apFadeIn 0.25s ease;
}

@keyframes apFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===========================
   Section h2 headings
   =========================== */
.archivio-post-tab-content h2 {
    font-size: 18px;
    font-weight: 600;
    color: #1d2327;
    margin: 28px 0 4px;
    padding: 0;
    border: none;
}

.archivio-post-tab-content h2:first-child {
    margin-top: 0;
}

/* ===========================
   Collapsible section buttons
   =========================== */
.ap-section-toggle {
    width: 100%;
    background: linear-gradient(to right, #f8f9fa, #fff);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    text-align: left;
    margin-bottom: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.ap-section-toggle:hover {
    background: linear-gradient(to right, #f0f1f2, #f8f9fa);
    box-shadow: 0 2px 8px rgba(102,126,234,0.10);
}

.ap-section-toggle .ap-toggle-arrow {
    color: #667eea;
    font-size: 20px;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.ap-section-toggle.ap-collapsed .ap-toggle-arrow {
    transform: rotate(-90deg);
}

.ap-section-toggle .ap-toggle-label {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    flex: 1;
}

.ap-section-toggle .ap-toggle-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.ap-section-panel {
    margin-bottom: 20px;
}

.ap-section-panel.ap-collapsed {
    display: none;
}

/* ===========================
   Section cards (inner content)
   =========================== */
.ap-section-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 0 0 8px 8px;
    border-top: none;
    padding: 20px 24px;
    margin-bottom: 20px;
}

/* ===========================
   Status / active badges on toggles
   =========================== */
.ap-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.ap-badge-active   { background: #667eea; color: #fff; }
.ap-badge-enabled  { background: #0a7537; color: #fff; }
.ap-badge-ent      { background: #f0e6ff; color: #6b21a8; border: 1px solid #d8b4fe; }
.ap-badge-w3c      { background: #e6f4ff; color: #0369a1; border: 1px solid #bae6fd; }
.ap-badge-algo     { background: #f0f0f0; color: #1d2327; border: 1px solid #ddd; }

/* ===========================
   Help sections
   =========================== */
.archivio-post-help-section {
    margin-bottom: 30px;
}

.archivio-post-help-section h3 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
    color: #1d2327;
}

.archivio-post-help-section h4 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: #667eea;
}

.archivio-post-help-section p,
.archivio-post-help-section ol,
.archivio-post-help-section ul {
    line-height: 1.8;
}

.archivio-post-help-section pre {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 4px;
    overflow-x: auto;
    border-left: 4px solid #667eea;
}

.archivio-post-help-section code {
    font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace;
    font-size: 13px;
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
}

.archivio-post-help-section pre code {
    background: none;
    padding: 0;
}

/* ===========================
   Audit log table
   =========================== */
#audit-log-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: #fff;
}

#audit-log-table th,
#audit-log-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e5e5e5;
}

#audit-log-table th {
    background: #f9f9f9;
    font-weight: 600;
    color: #1d2327;
    border-bottom: 2px solid #ddd;
    position: sticky;
    top: 0;
}

#audit-log-table tbody tr:hover { background: #f9f9f9; }
#audit-log-table tbody tr:last-child td { border-bottom: none; }

.audit-log-event-generated { color: #0a7537; font-weight: 600; }
.audit-log-event-verified   { color: #2271b1; font-weight: 600; }
.audit-log-event-unverified { color: #d73a49; font-weight: 600; }

.audit-log-hash {
    font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace;
    font-size: 12px;
    word-break: break-all;
    color: #50575e;
}

.audit-log-algo  { font-family: monospace; font-size: 11px; }
.audit-log-mode-hmac     { color: #7c3aed; font-weight: 600; }
.audit-log-mode-standard { color: #646970; }
.audit-log-type-post  { color: #2271b1; font-size: 11px; font-weight: 600; }
.audit-log-type-page  { color: #7c3aed; font-size: 11px; font-weight: 600; }

.audit-log-loading {
    text-align: center;
    padding: 40px;
    color: #50575e;
}

#audit-log-pagination {
    margin-top: 20px;
    text-align: center;
    padding: 15px 0;
    border-top: 1px solid #e5e5e5;
}

#audit-log-pagination button { margin: 0 5px; }

#audit-log-pagination span {
    margin: 0 15px;
    font-weight: 500;
    color: #1d2327;
}

/* ===========================
   Badge preview
   =========================== */
.archivio-post-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 12px;
    vertical-align: middle;
    white-space: nowrap;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.archivio-post-badge-verified   { background: #dafbe1; color: #0a7537; border: 1px solid #0a7537; }
.archivio-post-badge-unverified { background: #ffdce0; color: #d73a49; border: 1px solid #d73a49; }
.archivio-post-badge-not_signed { background: #f1f3f4; color: #6a737d; border: 1px solid #6a737d; }

.archivio-post-icon { width: 16px; height: 16px; flex-shrink: 0; }
.archivio-post-badge-text { line-height: 1; }

.archivio-post-download {
    background: none;
    border: none;
    padding: 2px 4px;
    cursor: pointer;
    color: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    margin-left: 4px;
}

.archivio-post-download:hover { background: rgba(0,0,0,0.1); }
.archivio-post-download svg   { width: 14px; height: 14px; }

/* ===========================
   Notice boxes
   =========================== */
.archivio-post-notice {
    padding: 15px;
    margin: 15px 0;
    border-left: 4px solid;
    border-radius: 4px;
}

.archivio-post-notice-info    { background: #e7f3ff; border-color: #2271b1; color: #1d2327; }
.archivio-post-notice-success { background: #dafbe1; border-color: #0a7537; color: #1d2327; }
.archivio-post-notice-warning { background: #fff8e5; border-color: #dba617; color: #1d2327; }
.archivio-post-notice-error   { background: #ffdce0; border-color: #d73a49; color: #1d2327; }

/* ===========================
   Responsive
   =========================== */
@media (max-width: 782px) {
    .archivio-post-page-title  { padding: 20px 20px; font-size: 20px; }
    .archivio-post-page-subtitle { padding: 12px 20px; }
    .archivio-post-tab-content { padding: 16px 14px; }
    .ap-section-card           { padding: 14px 16px; }
    #audit-log-table           { font-size: 12px; }
    #audit-log-table th,
    #audit-log-table td        { padding: 8px; }
    .audit-log-hash            { font-size: 10px; }
}

@media (max-width: 600px) {
    #audit-log-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    #audit-log-pagination button { font-size: 12px; padding: 4px 8px; }
}

/* ===========================
   Section card colour modifiers
   =========================== */
.ap-card-purple { border-left: 4px solid #7c3aed !important; }
.ap-card-blue   { border-left: 4px solid #0369a1 !important; }
.ap-card-teal   { border-left: 4px solid #0e7490 !important; }
