/**
 * Scheduler Dashboard Styles
 */

/* Base */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0d1117;
    color: #c9d1d9;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    padding: 20px 0;
    border-bottom: 1px solid #30363d;
    margin-bottom: 30px;
}

header h1 {
    margin: 0 0 10px 0;
    font-size: 2rem;
    color: #58a6ff;
}

header .subtitle {
    margin: 0;
    color: #8b949e;
}

.header-buttons {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.btn-link {
    display: inline-block;
    padding: 8px 16px;
    background: #21262d;
    color: #c9d1d9;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    transition: background 0.2s;
}

.btn-link:hover {
    background: #30363d;
}

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 25px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
}

.status-indicator .status-running {
    color: #3fb950;
}

.status-indicator .status-stopped {
    color: #8b949e;
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    font-size: 2rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: #58a6ff;
}

.stat-label {
    font-size: 0.85rem;
    color: #8b949e;
}

/* Panels */
.panel {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
}

.panel h2 {
    margin: 0 0 20px 0;
    font-size: 1.3rem;
    color: #c9d1d9;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.panel-header h2 {
    margin: 0;
}

/* Form */
.schedule-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    color: #8b949e;
}

.form-group input,
.form-group select {
    padding: 10px 12px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #c9d1d9;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #58a6ff;
}

.checkbox-group {
    flex-direction: row;
    align-items: center;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #c9d1d9;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #238636;
}

.hidden {
    display: none !important;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #238636;
    color: white;
    align-self: flex-start;
}

.btn-primary:hover {
    background: #2ea043;
}

.btn-danger {
    background: #da3633;
    color: white;
}

.btn-danger:hover {
    background: #f85149;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-run {
    background: #1f6feb;
    color: white;
}

.btn-run:hover {
    background: #388bfd;
}

.btn-pause {
    background: #d29922;
    color: black;
}

.btn-pause:hover {
    background: #e3b341;
}

.btn-delete {
    background: #21262d;
    color: #f85149;
    border: 1px solid #30363d;
}

.btn-delete:hover {
    background: #da3633;
    color: white;
}

.btn-refresh {
    background: #21262d;
    color: #8b949e;
    border: 1px solid #30363d;
}

.btn-refresh:hover {
    background: #30363d;
    color: #c9d1d9;
}

/* Schedules List */
.schedules-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 15px;
}

.schedule-card {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 15px;
    border-left: 4px solid #238636;
}

.schedule-card.paused {
    border-left-color: #d29922;
    opacity: 0.85;
}

.schedule-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.schedule-icon {
    font-size: 1.5rem;
}

.schedule-name {
    font-weight: bold;
    color: #c9d1d9;
    flex: 1;
}

.schedule-status {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 12px;
}

.schedule-status.active {
    background: rgba(35, 134, 54, 0.2);
    color: #3fb950;
}

.schedule-status.paused {
    background: rgba(210, 153, 34, 0.2);
    color: #d29922;
}

.schedule-status.disabled {
    background: rgba(139, 148, 158, 0.2);
    color: #8b949e;
}

.schedule-body {
    font-size: 13px;
    color: #8b949e;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.next-run {
    color: #58a6ff;
    font-weight: 500;
}

.schedule-stats {
    font-size: 12px;
    color: #6e7681;
}

.schedule-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.option-tag {
    font-size: 11px;
    padding: 2px 8px;
    background: rgba(88, 166, 255, 0.1);
    color: #58a6ff;
    border-radius: 4px;
}

.option-tag.auto-fix {
    background: rgba(35, 134, 54, 0.1);
    color: #3fb950;
}

.schedule-footer {
    display: flex;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid #21262d;
}

/* Runs List */
.runs-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.run-card {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 12px;
    border-left: 3px solid #30363d;
}

.run-card.completed {
    border-left-color: #238636;
}

.run-card.running {
    border-left-color: #1f6feb;
}

.run-card.failed {
    border-left-color: #da3633;
}

.run-card.skipped {
    border-left-color: #8b949e;
}

.run-card.pending {
    border-left-color: #d29922;
}

.run-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.run-status-icon {
    font-size: 1.2rem;
}

.run-type {
    flex: 1;
    font-weight: 500;
    color: #c9d1d9;
}

.run-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
}

.run-status.completed {
    background: rgba(35, 134, 54, 0.2);
    color: #3fb950;
}

.run-status.running {
    background: rgba(31, 111, 235, 0.2);
    color: #58a6ff;
}

.run-status.failed {
    background: rgba(218, 54, 51, 0.2);
    color: #f85149;
}

.run-status.skipped {
    background: rgba(139, 148, 158, 0.2);
    color: #8b949e;
}

.run-status.pending {
    background: rgba(210, 153, 34, 0.2);
    color: #d29922;
}

.run-body {
    font-size: 13px;
    color: #8b949e;
}

.run-findings {
    color: #c9d1d9;
    margin-top: 4px;
}

.run-error {
    margin-top: 8px;
    padding: 8px;
    background: rgba(218, 54, 51, 0.1);
    border-radius: 4px;
    color: #f85149;
    font-size: 12px;
}

/* Loading & Empty States */
.loading {
    text-align: center;
    padding: 40px;
    color: #8b949e;
}

.empty {
    text-align: center;
    padding: 40px;
    color: #8b949e;
    font-style: italic;
}

.error {
    text-align: center;
    padding: 20px;
    color: #f85149;
    background: rgba(218, 54, 51, 0.1);
    border-radius: 6px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    animation: slideIn 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.toast-success {
    background: #238636;
}

.toast-error {
    background: #da3633;
}

.toast-info {
    background: #1f6feb;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .schedules-list {
        grid-template-columns: 1fr;
    }

    .status-bar {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}
