/**
 * Admin page styles
 *
 * @package AI_Editor_Post_Switcher
 */

/**
 * 0. Hide WordPress default admin notices on our settings page
 */
.settings_page_ai-editor-post-switcher .notice:not(.ai-editor-notice),
.settings_page_ai-editor-post-switcher #message,
.settings_page_ai-editor-post-switcher .updated,
.settings_page_ai-editor-post-switcher .error,
.settings_page_ai-editor-post-switcher .update-nag {
    display: none !important;
}

/**
 * 1. Frames and common elements styles
 */
.ai-frame {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
    margin-top: 20px;
    padding: 10px 20px 20px;
}

.ai-frame h2 {
    font-size: 1.3em;
    margin: 15px 0 10px;
}

.ai-frame .description {
    font-style: italic;
    margin-bottom: 1rem;
}

/* Version number in main title */
.ai-version-number {
    font-size: 0.5em;
    color: #666;
    margin-left: 1.5em;
    font-weight: normal;
}

/* Version number in main title */
.ai-version-number {
    font-size: 0.5em;
    color: #666;
    margin-left: 1.5em;
    font-weight: normal;
}

/**
 * 2. Settings layout
 */
.ai-settings-row {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.ai-frame-main {
    flex: 2;
    margin-top: 0;
}

.ai-frame-side {
    flex: 1;
    margin-top: 0;
}

/* Post type slug styling */
.ai-post-type-slug {
    background-color: #dcdcde;
    color: #3c434a;
    font-size: 11px;
    font-weight: normal;
    padding: 1px 5px;
    border-radius: 2px;
    margin-left: 5px;
    display: inline-block;
    line-height: 1.4;
}

/**
 * 3. Save badge
 */
.ai-editor-saved-badge {
    animation: ai-fade 3s forwards;
    background-color: #46b450;
    border-radius: 3px;
    color: white;
    display: none;
    font-size: 13px;
    line-height: 1;
    padding: 5px 10px;
}

@keyframes ai-fade {
    0%, 70% { opacity: 1; }
    100% { opacity: 0; }
}

/**
 * 4. Changelog table - Base styles
 */
.ai-changelog-table {
    border-collapse: collapse;
    margin-top: 15px;
    width: 100%;
}

.ai-changelog-table caption {
    font-weight: bold;
    margin-bottom: 10px;
    text-align: left;
}

.ai-changelog-table th,
.ai-changelog-table td {
    padding: 10px;
    text-align: left;
}

.ai-changelog-table td {
    border-bottom: 1px solid #e5e5e5;
    vertical-align: top;
}

.ai-changelog-table th {
    background-color: #f5f5f5;
    font-weight: 600;
}

.ai-changelog-table th:nth-child(1),
.ai-changelog-table td:nth-child(1) {
    width: 7ch;
}

.ai-changelog-table th:nth-child(2),
.ai-changelog-table td:nth-child(2) {
    width: 10ch;
}

.ai-changelog-table tr:hover {
    background-color: #f9f9f9;
}

/* List styles in the table */
.ai-changelog-table td ul {
    margin: 0;
}

.ai-changelog-table td li {
    margin-bottom: 5px;
}

.ai-changelog-table td li:last-child {
    margin-bottom: 0;
}

/**
 * 5. Changelog container with scrollbar
 */
.ai-changelog-wrapper {
    margin-bottom: 20px;
}

/* Header table styling */
.ai-changelog-header thead {
    border-top: 1px solid #e5e5e5;
    border-right: 1px solid #e5e5e5;
    border-left: 1px solid #e5e5e5;
}

/* Scrollable container for the body */
.ai-changelog-container {
    /* Max height will be set by JavaScript */
    min-height: 200px;
    overflow-y: scroll;
    margin-bottom: 20px;
    border: 1px solid #ddd;
}

/* Fixed table headers during scrolling */
.ai-changelog-container thead th {
    position: sticky;
    top: 0;
    background-color: #f5f5f5;
    z-index: 10;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1); /* Shadow under sticky header */
}

/* Ensure the table takes full width of the container */
.ai-changelog-container .ai-changelog-table {
    margin-top: 0;
}

/* Better spacing for scrollable container */
.ai-changelog-container tbody tr:last-child td {
    border-bottom: none;
}

/**
 * 6. Legal footer
 */
.ai-legal-footer-sticky {
    background-color: #f8f8f8;
    border-left: 1px solid #ddd;
    border-top: 1px solid #ddd;
    border-top-left-radius: 4px;
    bottom: 0;
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.05);
    margin: 0;
    max-width: 50%;
    padding: 8px 15px;
    position: fixed;
    right: 0;
    z-index: 100;
}

.ai-legal-text {
    color: #666;
    font-size: 12px;
    font-style: italic;
    margin: 0;
    text-align: right;
}

.ai-legal-text a {
    color: #0073aa;
    text-decoration: none;
}

.ai-legal-text a:hover {
    color: #00a0d2;
    text-decoration: underline;
}

/**
 * 7. Media Queries - Responsive adjustments
 */
@media screen and (max-width: 782px) {
    /* Layout adaptation */
    .ai-settings-row {
        flex-direction: column;
    }
    
    /* Table adaptation */
    .ai-changelog-table th,
    .ai-changelog-table td {
        padding: 6px;
    }
    
    /* Changelog container adaptation */
    .ai-changelog-container {
        min-height: 150px; /* Slightly smaller on mobile */
    }
    
    /* Footer adaptation */
    .ai-legal-footer-sticky {
        border-left: none;
        border-radius: 0;
        max-width: 100%;
        right: 0;
        width: 100%;
    }
}