/* ============================================================
   COMPONENTS.CSS — Buttons, Cards, Modals, Forms, Badges
   ============================================================ */

/* ── Buttons ── */
.btn-primary-custom {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.btn-primary-custom:hover { background: #0056b3; }
.btn-primary-custom:disabled { background: #6c757d; cursor: not-allowed; }

.btn-outline-custom {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.btn-outline-custom:hover { background: var(--primary-color); color: white; }

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-normal);
    text-decoration: none;
}
.action-btn:hover { background: var(--tertiary-bg); border-color: var(--primary-color); color: var(--text-primary); }

/* ── Cards ── */
.card-custom {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    transition: var(--transition-normal);
}
.card-custom:hover { border-color: var(--primary-color); }

.card-header-custom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.card-header-custom h3 { color: var(--primary-color); }
.card-header-custom i { font-size: 1.5rem; color: var(--primary-color); }

/* ── Dashboard Grid ── */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}
.dashboard-grid .full-width { grid-column: 1 / -1; }

/* ── Agent Cards ── */
.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.agent-card {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    transition: var(--transition-normal);
    cursor: pointer;
}
.agent-card:hover { border-color: var(--primary-color); }
.agent-card.selected { border-color: var(--primary-color); background: rgba(0,123,255,0.05); }

.agent-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.agent-title { font-size: 1rem; color: var(--primary-color); font-weight: 600; }
.agent-type {
    background: rgba(0,123,255,0.1);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

.agent-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}
.agent-status-item {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    transition: var(--transition-normal);
}
.agent-status-item:hover { border-color: var(--primary-color); }
.agent-name { font-weight: 600; margin-bottom: 0.4rem; color: var(--primary-color); font-size: 0.9rem; }
.agent-specialization { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.4rem; }
.agent-status { padding: 0.2rem 0.5rem; border-radius: 4px; font-size: 0.75rem; font-weight: 500; }

.status-idle { background: rgba(40,167,69,0.1); color: var(--success-color); border: 1px solid var(--success-color); }
.status-busy { background: rgba(255,193,7,0.1); color: var(--warning-color); border: 1px solid var(--warning-color); }
.status-error { background: rgba(220,53,69,0.1); color: var(--danger-color); border: 1px solid var(--danger-color); }

/* ── Capability Tags ── */
.agent-capabilities { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.capability-tag {
    background: var(--tertiary-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* ── Forms ── */
.form-group { margin-bottom: 1.25rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

label { display: block; margin-bottom: 0.4rem; color: var(--text-secondary); font-size: 0.875rem; }

input[type="text"],
select,
textarea {
    width: 100%;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.75rem;
    color: var(--text-primary);
    font-family: inherit;
    transition: var(--transition-normal);
}
input[type="text"]:focus,
select:focus,
textarea:focus { outline: none; border-color: var(--primary-color); }
textarea { min-height: 120px; resize: vertical; }

/* ── Badges ── */
.badge-custom {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-primary { background: rgba(0,123,255,0.15); color: var(--primary-color); border: 1px solid var(--primary-color); }
.badge-success { background: rgba(40,167,69,0.15); color: var(--success-color); border: 1px solid var(--success-color); }
.badge-warning { background: rgba(255,193,7,0.15); color: var(--warning-color); border: 1px solid var(--warning-color); }

/* ── Agent Status Modal ── */
.agent-status-modal {
    display: none;
    position: fixed;
    z-index: 300;
    left: 0; top: 0;
    width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.35);
    align-items: center;
    justify-content: center;
}
.agent-status-modal-content {
    background: var(--secondary-bg);
    color: var(--text-primary);
    margin: auto;
    padding: 2rem 1.5rem 1.5rem;
    border-radius: 8px;
    width: 90vw;
    max-width: 400px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    position: relative;
}
.close-modal {
    position: absolute;
    top: 1rem; right: 1.2rem;
    font-size: 2rem;
    color: var(--text-primary);
    cursor: pointer;
}

/* ── Agent Status FAB ── */
.agent-status-btn {
    position: fixed;
    bottom: 2rem; right: 2rem;
    z-index: 200;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 56px; height: 56px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}
.agent-status-btn:hover { background: #0056b3; }

/* ── Run/Copy Code Buttons ── */
.run-code-btn, .copy-code-btn {
    position: absolute;
    top: 5px;
    background: var(--tertiary-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition-fast);
}
.run-code-btn { right: 70px; }
.copy-code-btn { right: 5px; }
.run-code-btn:hover, .copy-code-btn:hover { background: var(--border-color); }

/* ── Placeholder ── */
.placeholder-content {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    margin-top: 2rem;
}

/* ── Overview Stats ── */
.overview-stats { display: flex; justify-content: space-around; gap: 1rem; flex-wrap: wrap; }
.overview-stat { text-align: center; }
.stat-number { display: block; font-size: 2rem; font-weight: 700; color: var(--success-color); margin-bottom: 0.4rem; }
.stat-text { font-size: 0.875rem; color: var(--text-secondary); }

@media (max-width: 900px) {
    .agent-status-btn { bottom: 1.2rem; right: 1.2rem; width: 48px; height: 48px; font-size: 1.5rem; }
    .agent-status-modal-content { padding: 1.2rem 0.7rem 1rem; width: 96vw; max-width: 98vw; }
    .form-row { grid-template-columns: 1fr; }
}
