/* Odyssey LLMS Admin Styles - Version 6.1.13 */

:root {
    /* Modern Color Palette */
    --odyssey-primary: #3b82f6;
    /* Modern Blue */
    --odyssey-primary-hover: #2563eb;
    --odyssey-bg-page: #f3f4f6;
    /* Light Gray Page BG */
    --odyssey-bg-card: #ffffff;
    --odyssey-text-main: #111827;
    --odyssey-text-secondary: #6b7280;
    --odyssey-border: #e5e7eb;
    --odyssey-border-focus: #3b82f6;

    /* Status Colors */
    --odyssey-success-bg: #d1fae5;
    --odyssey-success-text: #065f46;
    --odyssey-warning-bg: #fef3c7;
    --odyssey-warning-text: #92400e;
    --odyssey-error-bg: #fee2e2;
    --odyssey-error-text: #991b1b;
    --odyssey-info-bg: #dbeafe;
    --odyssey-info-text: #1e40af;

    /* Spacing & Radius */
    --odyssey-radius: 8px;
    --odyssey-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --odyssey-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* --- Main Layout & Header --- */
.odyssey-llms-wrap {
    margin-right: 20px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--odyssey-text-main);
}

.odyssey-llms-wrap .odyssey-llms-header {
    background: var(--odyssey-bg-card);
    border: 1px solid var(--odyssey-border);
    border-radius: var(--odyssey-radius);
    padding: 20px 30px;
    margin-bottom: 25px;
    box-shadow: var(--odyssey-shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Fix: Ensure title and notices are spaced */
    border-left: 4px solid var(--odyssey-primary);
    position: relative;
}

.odyssey-llms-wrap h1 {
    display: flex;
    align-items: center;
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--odyssey-text-main);
    letter-spacing: -0.025em;
}

.odyssey-llms-wrap h1 .dashicons {
    font-size: 32px;
    margin-right: 15px;
    height: 32px;
    width: 32px;
    color: var(--odyssey-primary);
}

/* Fix Notice Alignment inside Header */
.odyssey-llms-wrap .odyssey-llms-header .notice {
    margin: 0 0 0 20px;
    /* Add spacing from title */
    position: static;
    /* Prevent absolute positioning issues */
    box-shadow: none;
    max-width: 600px;
}

/* --- Tab Navigation --- */
.nav-tab-wrapper {
    border-bottom: 1px solid var(--odyssey-border);
    margin-bottom: 25px;
    padding-bottom: 0;
}

.nav-tab {
    margin-left: 5px;
    font-size: 14px;
    font-weight: 500;
    color: var(--odyssey-text-secondary);
    background: transparent;
    border: 1px solid transparent;
    border-bottom: none;
    padding: 10px 15px;
    transition: all 0.2s ease;
}

.nav-tab:hover {
    background: var(--odyssey-bg-page);
    color: var(--odyssey-text-main);
}

.nav-tab-active,
.nav-tab-active:hover {
    background: var(--odyssey-bg-card);
    border: 1px solid var(--odyssey-border);
    border-bottom: 1px solid var(--odyssey-bg-card);
    color: var(--odyssey-primary);
    font-weight: 600;
}

/* --- Main Content Layout --- */
.odyssey-llms-content {
    display: grid;
    grid-template-columns: 1fr 320px;
    grid-gap: 25px;
    box-sizing: border-box;
    align-items: start;
}

.odyssey-llms-main {
    min-width: 0;
    /* Prevents grid blowout */
}

.odyssey-llms-main .postbox:first-child {
    margin-top: 0;
}

/* --- Postbox Styling (Modern Cards) --- */
.odyssey-llms-wrap .postbox .hndle {
    padding: 15px 20px;
    border-bottom: 1px solid var(--odyssey-border);
    font-size: 16px;
    font-weight: 600;
    color: var(--odyssey-text-main);
}

.odyssey-llms-main .postbox {
    margin-bottom: 25px;
    border: 1px solid var(--odyssey-border);
    border-radius: var(--odyssey-radius);
    box-shadow: var(--odyssey-shadow);
    background: var(--odyssey-bg-card);
}

.odyssey-llms-main .postbox .inside {
    padding: 20px;
}

/* --- Forms & Tables --- */
.odyssey-llms-wrap .form-table th {
    padding: 20px 10px 20px 0;
    width: 220px;
    vertical-align: top;
    font-weight: 600;
    color: var(--odyssey-text-main);
}

.odyssey-llms-wrap .form-table td {
    padding: 15px 10px;
    vertical-align: top;
}

/* Modernize WP Widefat Tables */
.odyssey-llms-wrap .widefat {
    border: 1px solid var(--odyssey-border);
    border-radius: var(--odyssey-radius);
    box-shadow: none;
    overflow: hidden;
}

.odyssey-llms-wrap .widefat thead th {
    background: var(--odyssey-bg-page);
    border-bottom: 1px solid var(--odyssey-border);
    color: var(--odyssey-text-main);
    font-weight: 600;
    padding: 12px 15px;
}

.odyssey-llms-wrap .widefat td {
    padding: 12px 15px;
    color: var(--odyssey-text-secondary);
}

.odyssey-llms-wrap input[type="text"],
.odyssey-llms-wrap input[type="number"],
.odyssey-llms-wrap input[type="email"],
.odyssey-llms-wrap input[type="password"],
.odyssey-llms-wrap textarea,
.odyssey-llms-wrap select {
    border: 1px solid var(--odyssey-border);
    border-radius: 6px;
    padding: 8px 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

/* Fix: Schedule Dropdown Width */
#odyssey_schedule_select {
    min-width: 220px;
    /* Extended width */
    padding-right: 30px;
}

.odyssey-llms-wrap input:focus,
.odyssey-llms-wrap textarea:focus,
.odyssey-llms-wrap select:focus {
    border-color: var(--odyssey-border-focus);
    box-shadow: 0 0 0 1px var(--odyssey-border-focus);
    outline: none;
}

.odyssey-llms-wrap p.description {
    color: var(--odyssey-text-secondary);
    font-style: normal;
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.5;
}

.warning-text {
    color: var(--odyssey-error-text);
    font-weight: 600;
    background: var(--odyssey-error-bg);
    padding: 10px;
    border-radius: 6px;
    display: inline-block;
    /* Fix: Vertical alignment */
    vertical-align: middle;
    margin-right: 15px;
}

/* --- Buttons --- */
.button.delete {
    background: var(--odyssey-error-bg);
    border-color: var(--odyssey-error-bg);
    color: var(--odyssey-error-text);
}

.button.delete:hover {
    background: #fecaca;
    color: #7f1d1d;
    border-color: #fecaca;
}

.odyssey-llms-actions .button-primary {
    background: var(--odyssey-primary);
    border-color: var(--odyssey-primary);
    color: #fff;
    transition: background 0.2s;
}

.odyssey-llms-actions .button-primary:hover {
    background: var(--odyssey-primary-hover);
    border-color: var(--odyssey-primary-hover);
}

/* Fix: Reset Section Alignment */
#tab-tools-extra-content form {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--odyssey-bg-page);
    padding: 20px;
    border-radius: var(--odyssey-radius);
    border: 1px solid var(--odyssey-border);
}

#tab-tools-extra-content .warning-text {
    margin: 0;
    flex-grow: 1;
    margin-right: 20px;
}

#tab-tools-extra-content .button {
    flex-shrink: 0;
}

/* --- Field Groups --- */
.odyssey-llms-checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    background: var(--odyssey-bg-page);
    border: 1px solid var(--odyssey-border);
    padding: 20px;
    border-radius: var(--odyssey-radius);
}

.odyssey-llms-radio-option {
    margin-bottom: 15px;
    background: var(--odyssey-bg-page);
    padding: 15px;
    border: 1px solid var(--odyssey-border);
    border-radius: var(--odyssey-radius);
    transition: border-color 0.2s;
}

.odyssey-llms-radio-option:hover {
    border-color: var(--odyssey-primary);
}

/* --- Granular Crawler Rules --- */
.odyssey-llms-crawler-rules {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.crawler-rule-item {
    border: 1px solid var(--odyssey-border);
    border-radius: var(--odyssey-radius);
    background: var(--odyssey-bg-card);
    box-shadow: var(--odyssey-shadow);
    overflow: hidden;
}

.crawler-rule-header {
    background: var(--odyssey-bg-page);
    padding: 15px;
    border-bottom: 1px solid var(--odyssey-border);
}

.crawler-rule-header label {
    font-weight: 600;
    color: var(--odyssey-text-main);
    display: flex;
    align-items: center;
    font-size: 14px;
}

.crawler-rule-header input[type="checkbox"] {
    margin-right: 10px;
}

.crawler-rule-body {
    padding: 15px;
}

.crawler-rule-body textarea {
    width: 100%;
    font-family: 'Menlo', 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    border: 1px solid var(--odyssey-border);
    background: #f9fafb;
}

/* --- Select2 Integration --- */
.odyssey-llms-wrap .form-table td .select2-container {
    width: 100% !important;
    max-width: 600px;
}

.select2-container--default .select2-selection--multiple {
    border: 1px solid var(--odyssey-border);
    padding: 4px;
    min-height: 38px;
    border-radius: 6px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: var(--odyssey-bg-page);
    border: 1px solid var(--odyssey-border);
    color: var(--odyssey-text-main);
    margin-top: 4px;
    margin-right: 4px;
    border-radius: 4px;
}

/* --- Sidebar Status (Enterprise Pills) --- */
.odyssey-llms-sidebar .postbox {
    margin-top: 0;
    border-radius: var(--odyssey-radius);
    overflow: hidden;
}

.odyssey-llms-sidebar .postbox .inside {
    padding: 0;
}

.odyssey-llms-status-box {
    padding: 0;
}

.odyssey-llms-status-box .status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--odyssey-border);
    font-size: 13px;
}

.odyssey-llms-status-box .status-item:last-child {
    border-bottom: none;
}

.odyssey-llms-status-box .status-item strong {
    color: var(--odyssey-text-main);
    font-weight: 600;
}

/* Status Pills */
.status-text {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-active {
    background-color: var(--odyssey-success-bg);
    color: var(--odyssey-success-text);
}

.status-virtual {
    background-color: var(--odyssey-info-bg);
    color: var(--odyssey-info-text);
}

.status-inactive {
    background-color: var(--odyssey-error-bg);
    color: var(--odyssey-error-text);
}

/* Sidebar Buttons Fixed */
.odyssey-llms-status-box .button {
    width: calc(100% - 30px);
    margin: 10px 15px;
    text-align: center;
    height: 36px;
    line-height: 34px;
}

.odyssey-view-file {
    display: block;
    text-align: center;
    text-decoration: none;
    width: calc(100% - 30px);
    margin: 10px 15px;
    box-sizing: border-box;
    border-radius: 4px;
    transition: all 0.2s;
}

/* --- Live Preview & Tools Tab --- */
#odyssey-llms-preview-button,
#odyssey-llms-regenerate-now-button {
    width: 100%;
    text-align: center;
    height: 42px;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-top: 0;
    padding-bottom: 0;
    line-height: normal;
}

#odyssey-llms-preview-container {
    border: 1px solid var(--odyssey-border);
    background-color: #1f2937;
    /* Darker background */
    color: #f3f4f6;
    max-height: 600px;
    overflow-y: auto;
    overflow-x: auto;
    margin-top: 20px;
    border-radius: var(--odyssey-radius);
    padding: 0;
    width: 100%;
    box-sizing: border-box;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3);
}

.odyssey-llms-code-preview {
    padding: 25px;
    font-family: 'Menlo', 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-all;
    margin: 0;
    display: block;
}

/* Syntax Highlighting Colors (Dark Mode) */
.llms-comment {
    color: #9ca3af;
    font-style: italic;
}

.llms-directive {
    color: #f87171;
    font-weight: bold;
}

.llms-url {
    color: #60a5fa;
    text-decoration: underline;
}

.llms-error {
    color: #fca5a5;
    font-weight: bold;
}

/* --- Spinners & Messages --- */
.odyssey-llms-main .spinner.is-active {
    float: none;
    vertical-align: middle;
    margin-left: 10px;
}

.odyssey-success-msg {
    color: var(--odyssey-success-text);
    font-weight: 600;
    display: block;
    margin-top: 15px;
    text-align: center;
    background: var(--odyssey-success-bg);
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--odyssey-success-bg);
}

.odyssey-error-msg {
    color: var(--odyssey-error-text);
    font-weight: 600;
    display: block;
    margin-top: 15px;
    text-align: center;
    background: var(--odyssey-error-bg);
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--odyssey-error-bg);
}

/* --- Analytics Tab --- */
#odysseyChart,
#odysseyLineChart {
    max-height: 350px;
    width: 100%;
    margin: 0 auto;
}

/* Empty State */
.odyssey-empty-state {
    text-align: center;
    padding: 80px 40px;
    background: var(--odyssey-bg-card);
    border: 2px dashed var(--odyssey-border);
    border-radius: var(--odyssey-radius);
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.odyssey-empty-state .dashicons {
    font-size: 64px;
    height: 64px;
    width: 64px;
    color: var(--odyssey-border);
    margin-bottom: 25px;
}

.odyssey-empty-state h3 {
    margin: 0 0 15px;
    color: var(--odyssey-text-main);
    font-size: 20px;
    font-weight: 600;
}

.odyssey-empty-state p {
    color: var(--odyssey-text-secondary);
    font-size: 15px;
    margin-bottom: 25px;
    max-width: 500px;
    line-height: 1.6;
}

/* --- Actions Footer (Save Changes Block) --- */
.odyssey-llms-actions {
    padding: 25px 0;
    margin-top: 30px;
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid var(--odyssey-border);
}

.odyssey-llms-actions .button-primary {
    min-width: 160px;
    text-align: center;
    height: 44px;
    font-size: 15px;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-top: 0;
    padding-bottom: 0;
    line-height: normal;
}

/* --- Custom Bot Repeater --- */
#odyssey-crawler-rules-repeater {
    background: var(--odyssey-bg-card);
    border: 1px solid var(--odyssey-border) !important;
    padding: 20px !important;
    margin-top: 20px !important;
    box-shadow: var(--odyssey-shadow);
}

#odyssey-crawler-rules-repeater table {
    margin-bottom: 15px;
}

#odyssey-crawler-rules-repeater th {
    background: var(--odyssey-bg-page);
    font-weight: 600;
}

#odyssey-crawler-rules-repeater td {
    vertical-align: middle;
}

#odyssey-crawler-rules-repeater input.regular-text {
    width: 100%;
    max-width: 100%;
}

.odyssey-remove-crawler-rule {
    color: #d63638 !important;
    border-color: #d63638 !important;
}

.odyssey-remove-crawler-rule:hover {
    background: #fbe9eb !important;
    color: #d63638 !important;
}

/* Multisite Notice */
.odyssey-multisite-notice {
    border-left-color: var(--odyssey-primary) !important;
    box-shadow: var(--odyssey-shadow);
}

/* --- Responsive Adjustments --- */
@media (max-width: 1200px) {
    .odyssey-llms-crawler-rules {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 960px) {
    .odyssey-llms-content {
        grid-template-columns: 1fr;
    }

    .odyssey-llms-sidebar {
        order: 2;
        /* Sidebar drops below content on mobile */
    }
}

@media (max-width: 782px) {

    .odyssey-llms-wrap .form-table th,
    .odyssey-llms-wrap .form-table td {
        display: block;
        width: 100%;
        padding-left: 0;
        padding-right: 0;
    }

    .odyssey-llms-wrap .form-table th {
        padding-bottom: 5px;
        font-weight: 600;
    }

    .odyssey-llms-actions {
        justify-content: center;
    }

    .odyssey-llms-actions .button-primary {
        width: 100%;
    }
}