/**
 * Posts Metadata Box Styles
 */
/* Base table container with resizable wrapper */
.adminease .adminease-table-wrapper {
    height: 400px;
    max-height: 900px;
    resize: vertical;
    overflow: auto;
    margin-bottom: 20px;
}

/* Base table styles */
.adminease .adminease-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    background: #ffffff;
    border: 1px solid #dddddd;
}

.adminease .adminease-metadata-actions > div.col:first-child {
    display: flex;
    gap: 4px;
}

/* Sticky header */
.adminease .adminease-table thead {
    position: sticky;
    top: 0;
    background: #f5f5f5;
    z-index: 10;
}

/* Table header cells */
.adminease .adminease-table th {
    padding: 8px;
    border-bottom: 2px solid #dddddd;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    text-align: left;
    min-width: 50px;
}

/* Table data cells */
.adminease .adminease-table td {
    padding: 8px;
    border-bottom: 1px solid #f0f0f0;
    color: #555555;
    font-size: 13px;
    vertical-align: middle;
    word-break: break-word;
}

/* Row hover and striping */
.adminease .adminease-table tbody tr {
    transition: background-color 0.2s;
}

.adminease .adminease-table tbody tr:nth-child(even) {
    background: #f9f9f9;
}

.adminease .adminease-table tbody tr:hover {
    background: #f0f6fc;
}

/* Fade-in animation for rows */
.adminease .adminease-table tbody tr {
    animation: adminease-fadeIn 0.3s ease-in;
}

@keyframes adminease-fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Focus state for accessibility */
.adminease .adminease-table:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* Legacy table support (for backward compatibility) */
.adminease table {
    width: 100%;
    border-collapse: collapse;
}

.adminease table th,
.adminease table td {
    padding: 5px 10px;
    border: 1px solid #dddddd;
    font-size: 14px;
}

.adminease table td {
    background-color: white;
}

.adminease-posts-metadata-box {
    padding: 15px;
}

.adminease-metadata-header {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.adminease-metadata-header .button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.adminease-metadata-header .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 16px;
}

#adminease-metadata-table-container {
    margin-top: 15px;
}

/* Uses base .adminease-table styles from AdminEase.css */
.adminease-metadata-table {
    /* Additional overrides for metadata table */
}

.adminease-metadata-table th,
.adminease-metadata-table td {
    padding: 8px !important;
}

.adminease-metadata-table td code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
}

.adminease-metadata-table .adminease-meta-protected code {
    background: #fff3cd;
    color: #856404;
}

.adminease-metadata-table .adminease-meta-protected .dashicons-lock {
    color: #856404;
    font-size: 14px;
    vertical-align: middle;
}

/* Image size metadata styles */
.adminease-metadata-table .adminease-meta-image-size code {
    background: #e7f3ff;
    color: #0c5078;
    border: 1px solid #c4e0f5;
}

.adminease-metadata-table .adminease-meta-image-size .dashicons-format-image {
    font-size: 16px;
    vertical-align: middle;
    margin-left: 4px;
}

.adminease-metadata-table .adminease-meta-image-url a {
    color: #2271b1;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}

.adminease-metadata-table .adminease-meta-image-url a:hover {
    color: #135e96;
    text-decoration: underline;
}

.adminease-metadata-table .adminease-meta-image-url .dashicons-external {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.adminease-metadata-table .button-small {
    padding: 2px 8px;
    font-size: 12px;
    line-height: 1.5;
    height: auto;
}

.adminease-metadata-table .button-small .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    line-height: 14px;
}

.adminease-no-metadata {
    padding: 20px;
    text-align: center;
    color: #646970;
    font-style: italic;
}

/* Modal Styles */
.adminease-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: none;
}

.adminease-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.adminease-modal-dialog {
    position: relative;
    z-index: 2;
    width: 90%;
    max-width: 600px;
    margin: 50px auto;
}

.adminease-modal-content {
    background: white;
    border-radius: 5px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.adminease-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    border-bottom: 1px solid #cccccc;
}

.adminease-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.adminease-modal-close {
    background: none;
    border: none;
    padding: 5px;
    cursor: pointer;
    color: #646970;
    font-size: 20px;
    transition: color 0.2s;
}

.adminease-modal-close:hover {
    color: #d32f2f;
}

.adminease-modal-close .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.adminease-modal-body {
    padding: 20px;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
}

.adminease-modal-errors {
    margin-bottom: 15px;
}

.adminease-modal-errors .alert {
    margin: 0 0 10px 0;
}

.adminease-modal-body .form-group {
    margin-bottom: 20px;
}

.adminease-modal-body .form-group:last-child {
    margin-bottom: 0;
}

.adminease-modal-body label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 14px;
}

.adminease-modal-body .field-description {
    margin-top: 5px;
    font-size: 12px;
    color: #646970;
    font-style: italic;
}

.adminease-modal-body input[type="text"],
.adminease-modal-body textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cccccc;
    border-radius: 5px;
    font-size: 14px;
    font-family: monospace;
}

.adminease-modal-body input[type="text"]:focus,
.adminease-modal-body textarea:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 1px #2271b1;
}

.adminease-modal-body textarea {
    resize: vertical;
}

.adminease-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #cccccc;
    background: #f9f9f9;
    border-radius: 0 0 5px 5px;
}

#adminease-posts-metadata-box-inner .button > span.dashicons,
#adminease-metadata-table-container .button > span.dashicons {
    position: relative;
    top: 6px;
    width: 15px;
    height: 15px;
    margin-top: 0px !important;
    font-size: 16px;
}

#adminease-posts-metadata-box-inner .button > span.dashicons {
    top: 7px;
}

#adminease-metadata-table-container .loading {
    position: relative;
    padding-right: 45px;
}

#adminease-metadata-table-container .loading::after {
    content: "";
    position: absolute;
    top: 10px;
    right: 10px;
    width: 16px;
    height: 16px;
    margin-right: 5px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.4s linear infinite;
}

/* Responsive */
@media (max-width: 786px) {
    .adminease-modal-dialog {
        width: 95%;
        margin: 20px auto;
    }

    .adminease-metadata-header {
        flex-direction: column;
    }

    .adminease-metadata-table {
        font-size: 12px;
    }

    #adminease-metadata-table-container {
        position: relative;
        overflow: auto;
    }

    #adminease-metadata-table-container > table {
        min-width: 600px;
    }

    #adminease-metadata-table-container > table button.button {
        min-height: 26px;
        line-height: 2.18181818;
        padding: 0 8px;
        font-size: 11px;
    }

    #adminease-metadata-table-container > table thead th {
        width: 35% !important;
    }

    #adminease-metadata-table-container > table thead th:first-child {
        width: 40% !important;
    }

    #adminease-metadata-table-container > table thead th:last-child {
        width: 25% !important;
    }

    #adminease-metadata-modal .button,
    #adminease-posts-metadata-box-inner .button {
        padding: 0 8px;
        font-size: 14px;
        line-height: 2.18181818;
        height: auto;
        min-height: 26px;
    }
}