/* Xaya Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
        Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
}

header {
    background: #2c3e50;
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.xaya-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.xaya-header h1 {
    font-size: 1.5rem;
    margin: 0;
}

.xaya-header .tagline {
    color: #95a5a6;
    font-size: 0.9rem;
}

.xaya-header .user-info {
    margin-left: auto;
    font-size: 0.9rem;
}

.xaya-header .user-info a {
    color: #3498db;
    text-decoration: none;
}

main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

footer {
    text-align: center;
    padding: 2rem;
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.alert-error {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
}

.alert-info {
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    color: #0066cc;
}

/* Login */
.login-container {
    max-width: 400px;
    margin: 4rem auto;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.login-container h2 {
    margin-bottom: 1.5rem;
    text-align: center;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

button[type="submit"] {
    width: 100%;
    padding: 0.75rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 1rem;
}

button[type="submit"]:hover {
    background: #2980b9;
}

/* Dashboard */
.dashboard {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.muted {
    color: #6c757d;
}

.dashboard h2 {
    margin-bottom: 1.5rem;
}

.dashboard-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.widget {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.widget h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.widget ul {
    list-style: none;
}

.widget li {
    margin-bottom: 0.5rem;
}

.widget a {
    color: #3498db;
    text-decoration: none;
}

.widget a:hover {
    text-decoration: underline;
}

/* Plugin Catalog */
.plugin-catalog-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.plugin-catalog-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.plugin-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.plugin-filter-input {
    flex: 1;
    min-width: 280px;
    padding: 0.75rem 0.9rem;
    border: 1px solid #d7dce1;
    border-radius: 6px;
    font-size: 0.95rem;
}

.plugin-count {
    font-size: 0.95rem;
    color: #6c757d;
}

.plugin-table-wrap {
    overflow-x: auto;
}

.plugin-table {
    width: 100%;
    border-collapse: collapse;
}

.plugin-table th,
.plugin-table td {
    padding: 0.9rem 0.75rem;
    border-bottom: 1px solid #e9ecef;
    text-align: left;
    vertical-align: top;
}

.plugin-table th {
    color: #2c3e50;
    font-size: 0.9rem;
}

.plugin-egg {
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.plugin-desc,
.plugin-subtle {
    color: #6c757d;
    font-size: 0.9rem;
}

.plugin-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.plugin-badge-enabled {
    background: #d4edda;
    color: #155724;
}

.plugin-badge-disabled {
    background: #f8d7da;
    color: #721c24;
}

.plugin-btn {
    display: inline-block;
    padding: 0.55rem 0.9rem;
    border-radius: 6px;
    text-decoration: none;
    background: #3498db;
    color: #fff;
    font-weight: 600;
}

.plugin-btn:hover {
    background: #2980b9;
    text-decoration: none;
}

.plugin-btn-secondary {
    background: #eef2f6;
    color: #2c3e50;
}

.plugin-btn-secondary:hover {
    background: #dde5ec;
}

/* Kairos Scheduler / Operations */
.kairos-main {
    max-width: 1600px;
}

/* Modern Card & Header Styling for Kairos */
.kairos-main .card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    overflow: hidden;
    margin-bottom: 2rem;
}

.kairos-main .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: #ffffff;
    border-bottom: 1px solid #edf2f7;
}

.kairos-main .card-header .eyebrow {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #0f62fe;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.kairos-main .card-header h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1a202c;
    margin: 0 0 0.35rem 0;
}

.kairos-main .card-header .muted {
    font-size: 0.9rem;
    color: #718096;
    margin: 0;
}

/* Consistent Padding for the Panel Content */
.kairos-main .panel {
    padding: 1.5rem 2rem 2rem 2rem;
}

/* Modernized Buttons inside Kairos Toolbar */
.kairos-toolbar {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.kairos-toolbar .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    line-height: 1.25rem;
}

.kairos-toolbar .btn-primary {
    background-color: #0f62fe;
    color: #ffffff !important;
    border: 1px solid #0f62fe;
    box-shadow: 0 2px 4px rgba(15, 98, 254, 0.15);
}

.kairos-toolbar .btn-primary:hover {
    background-color: #0353e9;
    border-color: #0353e9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 98, 254, 0.25);
}

.kairos-toolbar .btn-primary:active {
    background-color: #002d9c;
    border-color: #002d9c;
    transform: translateY(0);
}

.kairos-toolbar .btn-secondary {
    background-color: #ffffff;
    color: #393939 !important;
    border: 1px solid #c1c7cd;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.kairos-toolbar .btn-secondary:hover {
    background-color: #f2f4f8;
    border-color: #8d939d;
    color: #161616 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.kairos-toolbar .btn-secondary:active {
    background-color: #e8ebf1;
    border-color: #8d939d;
    transform: translateY(0);
}

.kairos-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.metric-card {
    border-radius: 12px;
    padding: 1rem 1.1rem;
    border: 1px solid #e6ebf1;
    background: linear-gradient(180deg, #fff, #f8fbff);
    box-shadow: 0 6px 16px rgba(27, 39, 51, 0.04);
}

.metric-card-success {
    border-color: #cdebd7;
    background: linear-gradient(180deg, #f8fff9, #f1fbf4);
}

.metric-card-warning {
    border-color: #ffe1b8;
    background: linear-gradient(180deg, #fffaf2, #fff5e8);
}

.metric-card-info {
    border-color: #d6e4ff;
    background: linear-gradient(180deg, #f8fbff, #eff5ff);
}

.metric-label {
    color: #6c757d;
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.metric-value {
    font-size: 2rem;
    line-height: 1;
    font-weight: 700;
    color: #1f2d3d;
}

.metric-note {
    color: #6c757d;
    margin-top: 0.4rem;
    font-size: 0.92rem;
}

.scheduler-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.scheduler-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #0f62fe;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.scheduler-meta-pill {
    padding: 0.6rem 0.9rem;
    border-radius: 999px;
    border: 1px solid rgba(15, 98, 254, 0.14);
    background: rgba(15, 98, 254, 0.08);
    color: #0f62fe;
    font-size: 0.9rem;
    white-space: nowrap;
    font-weight: 700;
}

.scheduler-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 18px;
    border: 1px solid #dbe5ef;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.scheduler-toolbar-row {
    display: grid;
    gap: 0.9rem;
    align-items: end;
}

.scheduler-toolbar-primary {
    grid-template-columns: minmax(180px, 210px) minmax(280px, 1fr) minmax(
            320px,
            auto
        );
}

.scheduler-toolbar-filters {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.scheduler-control {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.scheduler-control label {
    display: block;
    font-size: 0.77rem;
    color: #617086;
    margin-bottom: 0;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.scheduler-control .form-control {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    padding: 10px 14px;
    border-radius: 14px;
    border: 1px solid #cfd8e3;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
}

.scheduler-control .form-control:hover {
    border-color: #b6c4d5;
}

.scheduler-control .form-control:focus {
    border-color: #0f62fe;
    box-shadow: 0 0 0 4px rgba(15, 98, 254, 0.12);
    outline: none;
}

.scheduler-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
}

.scheduler-actions .btn {
    min-height: 46px;
    border-radius: 999px;
    padding-left: 1rem;
    padding-right: 1rem;
    font-weight: 700;
    white-space: nowrap;
}

.scheduler-actions .btn.btn-primary {
    box-shadow: 0 10px 18px rgba(15, 98, 254, 0.15);
}

.scheduler-actions .btn.btn-secondary {
    background: #f7f9fc;
    border-color: #d8e1ec;
    color: #1f2a37;
}

.scheduler-actions .btn.btn-secondary:hover {
    background: #eef3f8;
    border-color: #c9d5e3;
}

.scheduler-toolbar-filters .scheduler-control:last-child {
    grid-column: span 2;
}

.scheduler-filter-help {
    margin-top: 0.25rem;
    font-size: 0.78rem;
    color: #718096;
    line-height: 1.4;
}

.scheduler-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.9fr) minmax(320px, 0.95fr);
    gap: 1rem;
    align-items: start;
}

.scheduler-main {
    min-width: 0;
}

.scheduler-sidebar .panel-stack {
    display: grid;
    gap: 1rem;
}

.sidebar-card {
    background: #fff;
    border: 1px solid #e9edf3;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 4px 14px rgba(27, 39, 51, 0.04);
}

.sidebar-card h3 {
    margin-bottom: 0.85rem;
}

.compact-table th,
.compact-table td {
    padding: 0.55rem 0.45rem;
}

.coverage-list {
    display: grid;
    gap: 0.9rem;
}

.coverage-row-head {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
    font-size: 0.95rem;
}

.coverage-bar {
    height: 10px;
    border-radius: 999px;
    background: #eef2f6;
    overflow: hidden;
}

.coverage-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #0f62fe, #23b26d);
}

.coverage-note {
    color: #6c757d;
    font-size: 0.86rem;
    margin-top: 0.35rem;
}

.timeline-feed {
    list-style: none;
    display: grid;
    gap: 0.7rem;
}

.timeline-feed li {
    padding-left: 0.9rem;
    position: relative;
    color: #34495e;
}

.timeline-feed li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.55rem;
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 999px;
    background: #0f62fe;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.status-chip-high {
    background: #ffe3e6;
    color: #b42318;
}

.status-chip-medium {
    background: #fff1da;
    color: #9a6700;
}

.status-chip-low {
    background: #e8f5e9;
    color: #1e6f3d;
}

.status-chip-confirmed {
    background: #dff3e3;
    color: #175c34;
}

.status-chip-planned {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-chip-draft {
    background: #eceef2;
    color: #4b5563;
}

.pipeline-stages {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 0.9rem;
}

.pipeline-stage,
.trend-card {
    border: 1px solid #e9edf3;
    background: #fbfcfe;
    border-radius: 12px;
    padding: 0.9rem;
}

.pipeline-stage span,
.trend-card span,
.trend-card small {
    color: #6c757d;
    display: block;
}

.pipeline-stage strong,
.trend-card strong {
    display: block;
    margin-top: 0.35rem;
    font-size: 1.4rem;
}

.planner-notes {
    list-style: disc;
    padding-left: 1.2rem;
    display: grid;
    gap: 0.55rem;
    color: #34495e;
}

.kairos-feature-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 1rem;
}

.scheduler-preview-card .mini-agenda {
    display: grid;
    gap: 0.8rem;
    margin-top: 0.8rem;
}

.scheduler-preview-card .mini-agenda div {
    padding: 0.75rem 0.85rem;
    border-radius: 10px;
    background: #f7f9fc;
    border: 1px solid #e6ebf1;
}

.scheduler-preview-card .mini-agenda strong {
    display: block;
    color: #0f62fe;
    font-size: 1rem;
    margin-bottom: 0.2rem;
}

.scheduler-preview-card .mini-agenda span {
    color: #34495e;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.summary-grid strong {
    display: block;
    font-size: 1.8rem;
    line-height: 1;
    color: #0f62fe;
}

.summary-grid span {
    display: block;
    margin-top: 0.3rem;
    color: #6c757d;
    font-size: 0.9rem;
}

.scheduler-bottom-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.trend-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}

/* Server Controls */
.server-controls {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.server-controls h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.server-buttons {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.btn-server {
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    color: white;
    transition:
        background 0.2s,
        opacity 0.2s;
}

.btn-server:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-start {
    background: #27ae60;
}

.btn-start:hover:not(:disabled) {
    background: #219a52;
}

.btn-stop {
    background: #e74c3c;
}

.btn-stop:hover:not(:disabled) {
    background: #c0392b;
}

.btn-restart {
    background: #f39c12;
}

.btn-restart:hover:not(:disabled) {
    background: #d68910;
}

.server-status {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    display: inline-block;
}

.server-status.running {
    background: #d4edda;
    color: #155724;
}

.server-status.stopped {
    background: #f8d7da;
    color: #721c24;
}

.server-status.loading {
    background: #fff3cd;
    color: #856404;
}

@media (max-width: 900px) {
    .plugin-catalog-header,
    .plugin-toolbar,
    .server-buttons,
    .xaya-header,
    .scheduler-hero {
        flex-direction: column;
        align-items: stretch;
    }

    .scheduler-toolbar,
    .scheduler-layout,
    .scheduler-bottom-grid,
    .summary-grid,
    .trend-cards,
    .pipeline-stages,
    .kairos-feature-grid {
        grid-template-columns: 1fr;
    }

    .scheduler-toolbar-row,
    .scheduler-toolbar-primary,
    .scheduler-toolbar-filters {
        grid-template-columns: 1fr;
    }

    .scheduler-actions {
        justify-content: stretch;
    }

    .scheduler-actions .btn {
        width: 100%;
    }

    .scheduler-toolbar-filters .scheduler-control:last-child {
        grid-column: auto;
    }

    .plugin-filter-input {
        min-width: 0;
        width: 100%;
    }
}
