@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

/* Custom styles for ENA Schedule Creator Demo */
/* ENA Brand Colors */
:root {
  --ena-primary-blue: #00598e;
  --ena-secondary-blue: #009fe3;
  --ena-orange: #ff7232;
  --ena-text-gray: #70747c;
  --ena-light-bg: #f7f8f9;
  --ena-border-gray: #dcdcdc;
  --ena-dark-bg: #eceeef;
}

/* ENA Typography Base */
body {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 400;
  line-height: 1.3;
  color: var(--ena-text-gray);
  background: var(--ena-light-bg);
}

h1 {
  color: var(--ena-orange);
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1.25;
  text-decoration: none;
  margin-bottom: 0;
}

h1 span {
  color: var(--ena-primary-blue);
}

h2 {
  color: var(--ena-primary-blue);
  font-size: 1.375rem;
  font-weight: 500;
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

h3 {
  color: var(--ena-primary-blue);
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.25;
  margin-bottom: 0.333rem;
}

h4 {
  color: var(--ena-text-gray);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.1875rem;
}

strong {
  color: var(--ena-orange);
  font-weight: 500;
}

/* ENA Link Styles */
a {
  color: var(--ena-secondary-blue);
  text-decoration: none;
}

a:hover {
  color: var(--ena-primary-blue);
}

/* ENA Button Styles */
.button,
button {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 500;
  transition: all 0.2s ease-in-out;
}

.button-primary {
  background-color: var(--ena-primary-blue);
  color: white;
}

.button-primary:hover {
  background-color: var(--ena-secondary-blue);
}

.button-orange {
  background-color: var(--ena-orange);
  color: white;
}

/* ENA Panel Styles */
.ena-panel {
  background-color: var(--ena-light-bg);
  padding: 1rem;
}

.ena-tint-panel {
  background-color: var(--ena-light-bg);
  padding: 4rem 0 4.25rem;
}

/* ENA Border/Accent Styles */
.ena-border-top {
  border-top: 1px solid var(--ena-border-gray);
}

.ena-border-bottom {
  border-bottom: 1px solid var(--ena-border-gray);
}

.ena-blue-bar {
  height: 0.625rem;
  background-color: var(--ena-primary-blue);
}

/* ENA Orange Accent Line */
.orange-line {
  height: 3px;
  width: 4.375rem;
  background-color: var(--ena-orange);
  margin: 0.75rem 0;
}

/* ENA Blockquote Style */
blockquote {
  border-top: 1px solid var(--ena-secondary-blue);
  border-bottom: 5px solid var(--ena-primary-blue);
  border-left: none;
  padding: 0.75rem 0 0.5rem;
  margin: 3rem 0 2rem;
  color: var(--ena-primary-blue);
  font-size: 1.625rem;
  line-height: 1.3;
}

/* ENA List Styles */
ul.custom-bullets {
  list-style: none;
}

ul.custom-bullets li::before {
  content: "\2022";
  color: var(--ena-secondary-blue);
  display: inline-block;
  width: 1em;
  margin-left: -1em;
  font-size: 1.3rem;
  line-height: 1;
}

/* ENA Form Input Styles */
input[type="text"],
input[type="search"],
input[type="date"],
input[type="number"],
select {
  border: 1px solid var(--ena-border-gray);
  padding: 0.6875rem 0.75rem;
  font-family: 'Roboto', sans-serif;
  font-size: 1rem;
  color: var(--ena-text-gray);
}

input[type="text"]:focus,
input[type="search"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: var(--ena-secondary-blue);
  box-shadow: 0 0 0 2px rgba(0, 159, 227, 0.2);
}

input::placeholder {
  color: #caccd2;
}

/* ENA Emergency Panel (Orange Alert) */
.emergency-panel {
  background-color: var(--ena-orange);
  padding: 1.4rem 0;
}

.emergency-panel h1,
.emergency-panel h2,
.emergency-panel h3,
.emergency-panel p,
.emergency-panel a {
  color: #000;
  font-size: 1.5rem;
  margin-bottom: 0;
  display: inline-block;
  line-height: 1.2;
}

.emergency-panel a:hover {
  color: var(--ena-primary-blue);
}

/* Tab content */
.tab-content {
    display: block;
}

.tab-content.hidden {
    display: none;
}

.ena-card {
    background: #fff;
    border: 1px solid var(--ena-border-gray);
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.ena-site-header {
    border-top: 4px solid var(--ena-primary-blue);
}

.ena-logo {
    width: auto;
    height: 48px;
    object-fit: contain;
}

@media (max-width: 640px) {
    .ena-logo {
        height: 40px;
    }
}

.tab-button {
    color: var(--ena-text-gray);
}

.tab-button:hover {
    color: var(--ena-primary-blue);
}

.tab-button.border-blue-500,
.tab-button.text-blue-600 {
    border-color: var(--ena-primary-blue) !important;
    color: var(--ena-primary-blue) !important;
}


/* Block grid styling */
.block-cell {
    width: 3rem;
    height: 3rem;
    border: 1px solid #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.block-cell:hover {
    background: #f3f4f6;
}

.block-cell.rota {
    background: #3b82f6;
    color: #fff;
}

.block-cell.rota:hover {
    background: #2563eb;
}

.block-cell.fast {
    background: #ef4444;
    color: #fff;
}

.block-cell.fast:hover {
    background: #dc2626;
}

.block-cell.normal {
    background: #6b7280;
    color: #fff;
}

.block-cell.normal:hover {
    background: #4b5563;
}

.block-cell.empty {
    background: #fff;
}

/* DCRP Grid specific styling */
.dcrp-cell {
    width: 4rem;
    height: 2.5rem;
    border: 1px solid #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.dcrp-cell:hover {
    background: #f3f4f6;
}

.dcrp-cell.selected {
    box-shadow: 0 0 0 2px rgba(0, 89, 142, 0.35);
}

/* IRP item styling */
.irp-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 0.5rem;
}

.irp-blocks {
    display: flex;
    gap: 0.25rem;
}

.irp-block {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 0.25rem;
}

/* Resolution path styling */
.resolution-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
}

.resolution-step.active {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.resolution-step.inactive {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
}

.resolution-step.failed {
    background: #fef2f2;
    border: 1px solid #fecaca;
}

/* Level descriptions */
.level-description {
    font-size: 0.875rem;
    color: var(--ena-text-gray);
    font-style: italic;
}

/* DNO override row */
.dno-override-row {
    transition: background-color 0.15s ease;
}

.dno-override-row:hover {
    background: #f9fafb;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 1.5rem;
    width: 2.75rem;
    border-radius: 9999px;
    transition: background-color 0.2s ease;
    outline: none;
}

.toggle-switch.checked {
    background: var(--ena-primary-blue);
}

.toggle-switch.unchecked {
    background: #e5e7eb;
}

.toggle-switch-handle {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    transform: translateX(0);
    transition: transform 0.2s ease;
    background: #fff;
    border-radius: 9999px;
}

.toggle-switch.checked .toggle-switch-handle {
    transform: translateX(1.25rem);
}

.toggle-switch.unchecked .toggle-switch-handle {
    transform: translateX(0.25rem);
}

/* Schedule grid styling */
.schedule-grid {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.75rem;
}

.schedule-cell {
    text-align: center;
    padding: 0.25rem;
}

.schedule-cell.disconnected {
    background: #fef9c3;
    color: #854d0e;
}

.schedule-cell.connected {
    background: #dcfce7;
    color: #166534;
}

/* Utility classes */
.text-rota {
    color: #3b82f6;
}

.text-fast {
    color: #ef4444;
}

.text-normal {
    color: #6b7280;
}

.bg-rota {
    background-color: #3b82f6;
}

.bg-fast {
    background-color: #ef4444;
}

.bg-normal {
    background-color: #6b7280;
}

/* Animation for transitions */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Scrollbar styling for overflow */
.overflow-x-auto::-webkit-scrollbar {
    height: 8px;
}

.overflow-x-auto::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.overflow-x-auto::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.overflow-x-auto::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.dcrp-matrix-table {
    border-collapse: collapse;
    min-width: auto;
    width: 100%;
    font-size: 11px;
}

.dcrp-matrix-table th,
.dcrp-matrix-table td {
    border: 1px solid #1f2937;
    text-align: center;
    font-weight: 600;
    padding: 2px 1px;
}

.dcrp-header-block {
    background: #f3f4f6;
    font-size: 10px;
    line-height: 1.1;
    width: 28px;
}

.dcrp-header-day {
    background: #d9d9d9;
    font-size: 12px;
    letter-spacing: 0.02em;
}

.dcrp-header-period {
    background: #efefef;
    font-size: 9px;
    width: 32px;
    line-height: 1.1;
    min-width: 32px;
}

.dcrp-header-period div {
    font-size: 8px;
    display: none;
}

.dcrp-row-block {
    background: #f7f7f7;
    width: 28px;
    font-size: 11px;
    font-weight: 700;
}

@media (min-width: 640px) {
    .dcrp-matrix-table {
        font-size: 12px;
    }
    .dcrp-matrix-table th,
    .dcrp-matrix-table td {
        border: 2px solid #1f2937;
        padding: 4px 2px;
    }
    .dcrp-header-block {
        font-size: 14px;
        width: 40px;
    }
    .dcrp-header-period {
        font-size: 10px;
        width: 48px;
        min-width: 48px;
    }
    .dcrp-header-period div {
        display: block;
    }
    .dcrp-row-block {
        width: 40px;
        font-size: 13px;
    }
}

@media (min-width: 1024px) {
    .dcrp-matrix-table {
        min-width: 640px;
        font-size: 13px;
    }
    .dcrp-header-block {
        font-size: 18px;
        width: 54px;
    }
    .dcrp-header-period {
        font-size: 11px;
        width: 72px;
        min-width: 72px;
    }
    .dcrp-header-period div {
        font-size: 10px;
    }
    .dcrp-row-block {
        width: 54px;
        font-size: 14px;
    }
}

.dcrp-cell-green {
    background: #00b050;
    color: transparent;
    cursor: pointer;
    font-size: 8px;
    min-width: 28px;
    min-height: 18px;
}

.dcrp-cell-green::after {
    content: "✓";
    color: #fff;
    font-size: 10px;
}

.dcrp-cell-red {
    background: #ff0000;
    color: transparent;
    cursor: pointer;
    font-size: 8px;
    min-width: 28px;
    min-height: 18px;
}

.dcrp-cell-red::after {
    content: "✕";
    color: #fff;
    font-size: 10px;
}

.dcrp-cell-fast {
    background: #bfbfbf;
    color: transparent;
    min-width: 28px;
    min-height: 18px;
}

@media (min-width: 640px) {
    .dcrp-cell-green,
    .dcrp-cell-red,
    .dcrp-cell-fast {
        min-width: 40px;
        min-height: 24px;
    }
    .dcrp-cell-green::after,
    .dcrp-cell-red::after {
        font-size: 12px;
    }
}

@media (min-width: 1024px) {
    .dcrp-cell-green,
    .dcrp-cell-red,
    .dcrp-cell-fast {
        min-width: 56px;
        min-height: 28px;
    }
    .dcrp-cell-green::after,
    .dcrp-cell-red::after {
        font-size: 14px;
    }
}

.esec-spec-table {
    border-collapse: collapse;
    min-width: 1120px;
    width: 100%;
    table-layout: fixed;
    font-size: 11px;
}

.esec-spec-table th,
.esec-spec-table td {
    border: 1px solid #5f5f5f;
    text-align: center;
    padding: 0;
    height: 20px;
}

.esec-spec-label {
    min-width: 68px;
    background: #f3f4f6;
    font-weight: 700;
}

.esec-spec-day {
    background: #efefef;
    text-transform: uppercase;
    font-weight: 700;
    border-bottom: 2px solid #3f3f3f !important;
}

.esec-spec-period {
    background: #f7f7f7;
    font-weight: 700;
    width: 18px;
    border-right: 2px solid #3f3f3f;
}

.esec-spec-table thead tr:nth-child(2) th:nth-child(8n) {
    border-right: 2px solid #3f3f3f;
}

.esec-spec-block {
    background: #f8f8f8;
    font-weight: 700;
    min-width: 28px;
}

.esec-spec-cell {
    width: 18px;
}

.esec-spec-on {
    background: #ffffff;
}

.esec-spec-off {
    background: #000000;
}

/* ── Overview: Status Banner ─────────────────────────────────────────────── */

.status-banner {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
}

.status-banner-inactive {
    background: #f0fdf4;
    border-left: 4px solid #16a34a;
    color: #15803d;
    font-size: 0.9375rem;
}

.status-banner-active {
    background: #dc2626;
    color: #ffffff;
    border-left: none;
    animation: pulse-active 1.5s ease-in-out infinite;
    border-radius: 0.5rem;
}

@keyframes pulse-active {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.5); }
    50%       { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}

/* ── Overview: Traffic Light Pills ──────────────────────────────────────── */

.traffic-lights {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.traffic-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3rem 0.75rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 9999px;
    font-size: 0.8125rem;
    color: var(--ena-text-gray);
}

.traffic-dot {
    display: inline-block;
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.traffic-ok       { background: #22c55e; }
.traffic-degraded { background: #f59e0b; }
.traffic-down     { background: #ef4444; }

/* ── Overview: Schedule Cards ────────────────────────────────────────────── */

.overview-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
}

.overview-card-ready {
    border-left: 4px solid #f59e0b;
}

.overview-card-draft {
    border-left: 4px solid #3b82f6;
}

.overview-card-empty {
    border-left: 4px solid #d1d5db;
    background: #f9fafb;
}

/* State badges inside cards */
.state-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.state-badge-ready {
    background: #fef3c7;
    color: #92400e;
}

.state-badge-draft {
    background: #dbeafe;
    color: #1e40af;
}

/* ── Overview: Activity List ─────────────────────────────────────────────── */

.activity-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.activity-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.375rem 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.8125rem;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-action {
    font-weight: 500;
    color: #374151;
}

.activity-meta {
    font-size: 0.75rem;
    color: #9ca3af;
    white-space: nowrap;
}

/* ── Feature toggle pills (ESEC / DCRP enable strip) ────────────────────── */

.feature-toggle-label {
    cursor: pointer;
    user-select: none;
}

.feature-toggle-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    border: 1.5px solid #d1d5db;
    background: #ffffff;
    color: #9ca3af;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.feature-toggle-label input[type="checkbox"]:checked + .feature-toggle-pill {
    background: var(--ena-primary-blue);
    border-color: var(--ena-primary-blue);
    color: #ffffff;
}

.feature-toggle-label:hover .feature-toggle-pill {
    border-color: var(--ena-primary-blue);
    color: var(--ena-primary-blue);
}

.feature-toggle-label:hover input[type="checkbox"]:checked + .feature-toggle-pill {
    background: var(--ena-secondary-blue);
    border-color: var(--ena-secondary-blue);
    color: #ffffff;
}

/* ── ENA brand button utilities ──────────────────────────────────────────── */

.btn-ena-primary {
    background-color: var(--ena-primary-blue) !important;
    color: #ffffff !important;
    border-color: var(--ena-primary-blue) !important;
}

.btn-ena-primary:hover {
    background-color: var(--ena-secondary-blue) !important;
    border-color: var(--ena-secondary-blue) !important;
}

.btn-ena-action {
    background-color: var(--ena-orange) !important;
    color: #ffffff !important;
    border-color: var(--ena-orange) !important;
}

.btn-ena-action:hover {
    background-color: #e55c1e !important;
    border-color: #e55c1e !important;
}

.btn-ena-ghost {
    background-color: #ffffff;
    color: var(--ena-primary-blue);
    border: 1px solid var(--ena-primary-blue);
}

.btn-ena-ghost:hover {
    background-color: rgba(0, 89, 142, 0.06);
}

/* ── Overview card hover ─────────────────────────────────────────────────── */

.overview-card {
    transition: box-shadow 0.15s ease;
}

.overview-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 89, 0.08);
}

/* ── Read-only container (review view) ───────────────────────────────────── */

.read-only-container input:not(.allow-in-readonly),
.read-only-container select:not(.allow-in-readonly),
.read-only-container textarea:not(.allow-in-readonly),
.read-only-container button:not(.allow-in-readonly) {
    pointer-events: none;
    opacity: 0.6;
}

.read-only-container .edit-action {
    display: none;
}

/* ── Mobile touch targets ────────────────────────────────────────────────── */

@media (max-width: 767px) {
    button,
    input[type="button"],
    input[type="submit"] {
        min-height: 44px;
    }

    .activity-item {
        flex-direction: column;
        gap: 0.125rem;
    }

    .activity-meta {
        white-space: normal;
    }

    /* Context bar buttons wrap cleanly on narrow viewports */
    #context-bar-editor .flex.items-center.gap-2,
    #context-bar-review .flex.items-center.gap-2 {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
}
