/* Base styles shared across all themes - GitHub-inspired */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
    min-height: 100vh;
    position: relative;
    font-size: 14px;
    line-height: 1.5;
}

/* Top Header */
.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-toggle-button {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.nav-toggle-button:hover {
    background: rgba(175, 184, 193, 0.2);
}

.nav-toggle-button svg {
    width: 16px;
    height: 16px;
}

.site-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}

.active-dashboard-name {
    font-size: 34px;
    font-weight: 600;
    margin: 0;
}

/* Side Navigation */
.side-nav {
    position: fixed;
    top: 64px;
    left: 0;
    bottom: 0;
    width: 280px;
    border-right: 1px solid;
    transform: translateX(-100%);
    transition: transform 0.2s ease-in-out;
    z-index: 200;
    overflow-y: auto;
}

.side-nav.open {
    transform: translateX(0);
}

.side-nav-content {
    padding: 16px 0;
}

.side-nav-section {
    padding: 8px 0;
}

.side-nav-link,
.side-nav-button {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 16px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    border-radius: 0;
    transition: background-color 0.1s;
}

.side-nav-link:hover,
.side-nav-button:hover {
    text-decoration: none;
}

.side-nav-link svg,
.side-nav-button svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.side-nav-link-active {
    font-weight: 600;
}

.side-nav-divider {
    height: 1px;
    margin: 8px 0;
}

/* Side Nav Overlay */
.side-nav-overlay {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
}

.side-nav-overlay.show {
    display: block;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    margin: 10% auto;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 16px;
    border-bottom: 1px solid;
}

.modal-header h2 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.close-button {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.close-button:hover {
    background: rgba(175, 184, 193, 0.2);
}

.close-button:focus-visible {
    outline: 2px solid;
    outline-offset: 2px;
}

.modal-body {
    padding: 16px;
}

.setting-section {
    margin-bottom: 16px;
}

.setting-section:last-child {
    margin-bottom: 0;
}

.theme-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.theme-option {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.1s;
}

.theme-option:hover {
    border-color: var(--border-hover, #666);
}

.theme-option input[type="radio"] {
    width: 16px;
    height: 16px;
    margin-right: 12px;
    cursor: pointer;
}

.theme-label {
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.container {
    max-width: 1280px;
    margin: 80px auto 0;
    padding: 24px;
}

/* Refresh status in header */
.refresh-status-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.refresh-button-header {
    width: 32px;
    height: 32px;
    border: 1px solid;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    padding: 0;
}

.refresh-button-header:hover:not(:disabled) {
    background: rgba(175, 184, 193, 0.2);
}

.refresh-button-header:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.refresh-button-header:focus-visible {
    outline: 2px solid;
    outline-offset: 2px;
}

.refresh-button-header .refresh-icon {
    width: 20px;
    height: 20px;
    display: block;
    transform-origin: center;
}

.refresh-status-header.refreshing .refresh-icon {
    animation: spin 1s linear infinite;
}

.refresh-status-header .refresh-status-text {
    font-size: 14px;
    white-space: nowrap;
}

.refresh-status {
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    border: 1px solid;
}

.refresh-status-icon {
    font-size: 1.2em;
}

.refresh-status.refreshing .refresh-status-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.refresh-status-icon svg {
    width: 20px;
    height: 20px;
    display: block;
}

.refresh-status-text {
    flex: 1;
}

.refresh-button {
    border: 1px solid;
    padding: 5px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.1s;
    flex-shrink: 0;
}

.refresh-button:hover:not(:disabled) {
    background: rgba(175, 184, 193, 0.2);
}

.refresh-button:active:not(:disabled) {
    transform: scale(0.97);
}

.refresh-button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.refresh-button:focus-visible {
    outline: 2px solid;
    outline-offset: 2px;
}

/* Workflow controls */
.workflow-controls {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 16px;
}

.add-workflow-button,
.edit-mode-button {
    display: flex;
    align-items: center;
    gap: 4px;
    border: 1px solid;
    background: transparent;
    padding: 5px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.1s;
}

.edit-mode-button {
    padding: 5px 8px;
    gap: 0;
}

.add-workflow-button svg,
.edit-mode-button svg {
    width: 16px;
    height: 16px;
}

.add-workflow-button:hover,
.edit-mode-button:hover {
    background: rgba(175, 184, 193, 0.2);
}

.add-workflow-button:active,
.edit-mode-button:active {
    transform: scale(0.97);
}

.add-workflow-button:focus-visible,
.edit-mode-button:focus-visible {
    outline: 2px solid;
    outline-offset: 2px;
}

/* Edit mode banner */
.edit-mode-banner {
    padding: 16px;
    border-radius: 6px;
    border: 2px solid;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.edit-mode-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.edit-mode-banner-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.edit-mode-banner-text {
    font-size: 14px;
    font-weight: 500;
}

.edit-mode-banner-actions {
    display: flex;
    gap: 8px;
}

.edit-mode-button-secondary,
.edit-mode-button-primary {
    padding: 5px 16px;
    border: 1px solid;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.1s;
}

.edit-mode-button-secondary {
    background: transparent;
}

.edit-mode-button-primary {
    background: #2da44e;
    border-color: #2da44e;
    color: white;
}

.edit-mode-button-secondary:hover {
    background: rgba(175, 184, 193, 0.2);
}

.edit-mode-button-primary:hover {
    background: #2c974b;
    border-color: #2c974b;
}

.edit-mode-button-secondary:disabled,
.edit-mode-button-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Edit mode active state */
body.edit-mode .workflow-item {
    cursor: move;
}

body.edit-mode .workflow-remove-button {
    display: flex;
    opacity: 1;
}

body.edit-mode .workflow-edit-button {
    display: flex;
    opacity: 1;
}

body.edit-mode .add-workflow-button {
    opacity: 0.5;
    pointer-events: none;
}

/* Drag and drop states */
.workflow-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.workflow-item.drag-over {
    border-style: dashed;
    border-width: 2px;
}

/* Remove button on workflow cards */
.workflow-remove-button {
    position: absolute;
    top: 8px;
    right: 8px;
    border: 1px solid;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.1s;
    padding: 0;
    z-index: 10;
}

.workflow-remove-button:hover {
    background: #cf222e;
    border-color: #cf222e;
    color: white;
}

.workflow-remove-button:focus-visible {
    opacity: 1;
    outline: 2px solid;
    outline-offset: 2px;
}

.workflow-remove-button svg {
    width: 16px;
    height: 16px;
    display: block;
}

/* Edit button on workflow cards */
.workflow-edit-button {
    position: absolute;
    top: 8px;
    left: 8px;
    border: 1px solid;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.1s;
    padding: 0;
    z-index: 10;
}

.workflow-edit-button:hover {
    background: #0969da;
    border-color: #0969da;
    color: white;
}

.workflow-edit-button:focus-visible {
    opacity: 1;
    outline: 2px solid;
    outline-offset: 2px;
}

.workflow-edit-button svg {
    width: 16px;
    height: 16px;
    display: block;
}

/* Workflow label editing state */
.workflow-label-edit-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.workflow-label-input {
    font-size: 14px;
    font-weight: 600;
    padding: 4px 8px;
    border: 2px solid #0969da;
    border-radius: 6px;
    text-align: center;
    min-width: 120px;
    max-width: 100%;
    /* Theme-specific colors will be applied */
}

.workflow-label-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.3);
}

.workflow-label-edit-tooltip {
    font-size: 11px;
    line-height: 1.4;
    padding: 6px 8px;
    border-radius: 4px;
    white-space: nowrap;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
    /* Theme-specific colors will be applied */
}

.workflow-label-edit-tooltip div {
    margin: 0;
    padding: 0;
}

.workflow-item {
    position: relative;
    border-radius: 6px;
    padding: 16px;
    text-align: center;
    transition: all 0.1s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid;
}

.workflow-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

/* Modal form styles */
.modal-description {
    margin-bottom: 12px;
    line-height: 1.5;
    font-size: 14px;
}

.modal-description code {
    padding: 2px 6px;
    border-radius: 3px;
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
    font-size: 12px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
}

.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 5px 12px;
    border: 1px solid;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.1s;
}

.form-group input[type="text"]:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--border-active, #0969da);
    box-shadow: 0 0 0 3px var(--focus-shadow, rgba(9, 105, 218, 0.3));
}

.form-help {
    display: block;
    margin-top: 6px;
    font-size: 12px;
}

.form-error {
    padding: 12px;
    border: 1px solid #cf222e;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

.modal-button {
    padding: 5px 16px;
    border: 1px solid;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.1s;
}

.modal-button:hover:not(:disabled) {
    background: rgba(175, 184, 193, 0.2);
}

.modal-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.modal-button:focus-visible {
    outline: 2px solid;
    outline-offset: 2px;
}

/* Checkbox styles */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-label span {
    line-height: 1.5;
}

/* Radio button styles */
.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    user-select: none;
}

.radio-label input[type="radio"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: var(--border-active, #0969da);
}

.radio-label span {
    line-height: 1.5;
}

/* Repository section styles */
.repo-section {
    margin-bottom: 32px;
}

.repo-header {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid;
}

.workflow-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.workflow-card-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: inherit;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.workflow-card-link:focus-visible {
    outline: 2px solid;
    outline-offset: -2px;
    border-radius: 4px;
}

.workflow-label {
    font-weight: 600;
    margin-bottom: 12px;
    font-size: 14px;
    word-wrap: break-word;
    width: 100%;
}

.workflow-details {
    width: 100%;
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
    padding: 0 8px;
    align-items: center;
}

.workflow-detail-item {
    font-size: 12px;
    line-height: 1.4;
    opacity: 0.8;
}

.workflow-status {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 24px;
    color: white;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    min-width: 80px;
    text-align: center;
}

.status-success {
    background-color: #1a7f37;
}

.status-failure {
    background-color: #cf222e;
}

.status-running {
    background-color: #bf8700;
}

.status-cancelled,
.status-skipped {
    background-color: #656d76;
}

.status-timeout {
    background-color: #cf222e;
}

.status-unknown {
    background-color: #656d76;
}

.status-loading {
    background-color: #656d76;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.config-error {
    grid-column: 1 / -1;
    border-radius: 6px;
    padding: 16px;
    border: 1px solid;
}

.config-error h3 {
    margin-bottom: 12px;
    font-size: 16px;
}

.config-error ol {
    margin-left: 20px;
    margin-top: 12px;
    margin-bottom: 12px;
}

.config-error li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.config-error code {
    padding: 2px 6px;
    border-radius: 3px;
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
    font-size: 12px;
}

.footer {
    text-align: center;
    margin-top: 48px;
    padding-top: 24px;
    font-size: 12px;
    border-top: 1px solid;
}

/* About page styles */
.about-content {
    max-width: 1024px;
    margin: 0 auto;
}

.about-section {
    margin-bottom: 32px;
    padding: 24px;
    border-radius: 6px;
    border: 1px solid;
}

.about-section h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
}

.about-section p {
    line-height: 1.6;
    margin-bottom: 12px;
    font-size: 14px;
}

.about-section ul {
    margin: 12px 0 12px 20px;
    line-height: 1.6;
}

.about-section li {
    margin-bottom: 8px;
    font-size: 14px;
}

.about-section a {
    text-decoration: none;
    font-weight: 600;
}

.about-section a:hover {
    text-decoration: underline;
}

/* Dashboards List in Modal */
.dashboards-list {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dashboard-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border: 1px solid;
    border-radius: 6px;
    transition: all 0.1s;
}

.dashboard-item:hover {
    background: rgba(175, 184, 193, 0.1);
}

.dashboard-item-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.dashboard-item-name {
    font-weight: 500;
    font-size: 14px;
}

.dashboard-item-badge {
    padding: 2px 7px;
    border: 1px solid;
    border-radius: 24px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.dashboard-item-actions {
    display: flex;
    gap: 4px;
}

.dashboard-item-action {
    padding: 6px;
    border: 1px solid;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
}

.dashboard-item-action:hover {
    background: rgba(175, 184, 193, 0.2);
}

.dashboard-item-action svg {
    width: 14px;
    height: 14px;
}

.dashboard-item-action.danger:hover {
    background: #cf222e;
    border-color: #cf222e;
    color: white;
}

/* Custom Dropdown Styles */
.custom-dropdown {
    position: relative;
    width: 100%;
}

.custom-dropdown-search {
    position: relative;
    display: flex;
    align-items: center;
}

.custom-dropdown-search .search-icon {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    pointer-events: none;
    z-index: 1;
}

.form-group input[type="text"].custom-dropdown-input {
    width: 100%;
    padding: 5px 12px 5px 36px;
    border: 1px solid;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.1s;
}

.form-group input[type="text"].custom-dropdown-input:focus {
    outline: none;
    border-color: var(--border-active, #0969da);
    box-shadow: 0 0 0 3px var(--focus-shadow, rgba(9, 105, 218, 0.3));
}

.custom-dropdown-list {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 8px;
    border: 1px solid;
    border-radius: 6px;
    padding: 4px;
}

.custom-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.1s;
    font-size: 14px;
}

.custom-dropdown-item:hover {
    background: rgba(175, 184, 193, 0.2);
}

.custom-dropdown-item.selected {
    font-weight: 600;
}

.custom-dropdown-item .item-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.custom-dropdown-item .item-check {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-left: auto;
}

.custom-dropdown-item:not(.selected) .item-check {
    visibility: hidden;
}

.custom-dropdown-item .item-text {
    flex: 1;
}

.custom-dropdown-empty {
    padding: 16px;
    text-align: center;
    font-size: 14px;
}

/* Pending change indicators */
.workflow-label-pending {
    font-style: italic;
    opacity: 0.85;
}

.workflow-pending-delete {
    opacity: 0.5;
    position: relative;
}

.workflow-pending-delete::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 2px;
    background: currentColor;
    transform: translateY(-50%);
}

/* Responsive design */
@media (max-width: 768px) {
    .workflow-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .active-dashboard-name {
        font-size: 16px;
    }
    
    .header-center {
        display: none;
    }
    
    .container {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .workflow-grid {
        grid-template-columns: 1fr;
    }
}
