/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-decoration: none;
}

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

.btn-primary {
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}
.btn-primary:hover { opacity: 0.9; }

.btn-secondary {
    background-color: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
}
.btn-secondary:hover { background-color: hsl(var(--secondary) / 0.8); }

.btn-outline {
    border-color: hsl(var(--border));
    background: transparent;
    color: hsl(var(--foreground));
}
.btn-outline:hover {
    background-color: hsl(var(--secondary));
}

.btn-ghost {
    background: transparent;
    color: hsl(var(--foreground));
}
.btn-ghost:hover {
    background-color: hsl(var(--secondary));
}

.btn-destructive {
    background-color: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
}
.btn-destructive:hover { opacity: 0.9; }

.btn-accent {
    background-color: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}
.btn-accent:hover { opacity: 0.9; }

.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-icon {
    padding: 0.5rem;
    width: 2.25rem;
    height: 2.25rem;
}

.btn-icon-sm {
    padding: 0.375rem;
    width: 2rem;
    height: 2rem;
}

/* ==================== CARDS ==================== */
.card {
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1.5rem;
}

.card-hover:hover {
    border-color: hsl(var(--primary) / 0.3);
    box-shadow: 0 0 20px hsl(var(--primary) / 0.05);
}

.card-sm { padding: 1rem; }
.card-lg { padding: 2rem; }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: hsl(var(--foreground));
}

.card-description {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.25rem;
}

/* ==================== FORM INPUTS ==================== */
.input {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: hsl(var(--foreground));
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input:focus {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.input::placeholder {
    color: hsl(var(--muted-foreground));
}

.input-lg {
    padding: 0.875rem 1rem;
    font-size: 1rem;
}

.textarea {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    color: hsl(var(--foreground));
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius);
    resize: vertical;
    min-height: 5rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.textarea:focus {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.select {
    display: block;
    width: 100%;
    padding: 0.625rem 2.5rem 0.625rem 0.875rem;
    font-size: 0.875rem;
    color: hsl(var(--foreground));
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.select:focus {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
    margin-bottom: 0.375rem;
}

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

/* ==================== BADGES ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.25rem;
    border-radius: 9999px;
    border: 1px solid transparent;
    white-space: nowrap;
}

.badge-primary {
    background-color: hsl(var(--primary) / 0.1);
    color: hsl(var(--primary));
    border-color: hsl(var(--primary) / 0.2);
}

.badge-secondary {
    background-color: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
}

.badge-accent {
    background-color: hsl(var(--accent) / 0.1);
    color: hsl(var(--accent));
    border-color: hsl(var(--accent) / 0.2);
}

.badge-destructive {
    background-color: hsl(var(--destructive) / 0.1);
    color: hsl(var(--destructive));
    border-color: hsl(var(--destructive) / 0.2);
}

.badge-outline {
    background: transparent;
    border-color: hsl(var(--border));
    color: hsl(var(--foreground));
}

.badge-green {
    background-color: rgba(74, 222, 128, 0.1);
    color: #4ade80;
    border-color: rgba(74, 222, 128, 0.2);
}

.badge-amber {
    background-color: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.2);
}

.badge-red {
    background-color: rgba(248, 113, 113, 0.1);
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.2);
}

/* ==================== STATUS BADGES ==================== */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 9999px;
    border: 1px solid;
}

.status-active { background: rgba(74, 222, 128, 0.1); color: #4ade80; border-color: rgba(74, 222, 128, 0.3); }
.status-pass { background: rgba(74, 222, 128, 0.1); color: #4ade80; border-color: rgba(74, 222, 128, 0.3); }
.status-fixed { background: rgba(74, 222, 128, 0.1); color: #4ade80; border-color: rgba(74, 222, 128, 0.3); }
.status-converted { background: rgba(74, 222, 128, 0.1); color: #4ade80; border-color: rgba(74, 222, 128, 0.3); }

.status-auditing { background: hsl(var(--primary) / 0.1); color: hsl(var(--primary)); border-color: hsl(var(--primary) / 0.3); }
.status-in-progress { background: hsl(var(--primary) / 0.1); color: hsl(var(--primary)); border-color: hsl(var(--primary) / 0.3); }
.status-new { background: hsl(var(--primary) / 0.1); color: hsl(var(--primary)); border-color: hsl(var(--primary) / 0.3); }

.status-error { background: rgba(248, 113, 113, 0.1); color: #f87171; border-color: rgba(248, 113, 113, 0.3); }
.status-critical { background: rgba(248, 113, 113, 0.1); color: #f87171; border-color: rgba(248, 113, 113, 0.3); }
.status-fail { background: rgba(248, 113, 113, 0.1); color: #f87171; border-color: rgba(248, 113, 113, 0.3); }
.status-lost { background: rgba(248, 113, 113, 0.1); color: #f87171; border-color: rgba(248, 113, 113, 0.3); }

.status-warning { background: rgba(251, 191, 36, 0.1); color: #fbbf24; border-color: rgba(251, 191, 36, 0.3); }
.status-high { background: rgba(251, 191, 36, 0.1); color: #fbbf24; border-color: rgba(251, 191, 36, 0.3); }
.status-paused { background: rgba(251, 191, 36, 0.1); color: #fbbf24; border-color: rgba(251, 191, 36, 0.3); }
.status-contacted { background: rgba(251, 191, 36, 0.1); color: #fbbf24; border-color: rgba(251, 191, 36, 0.3); }

.status-not-started { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); border-color: hsl(var(--border)); }
.status-pending { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); border-color: hsl(var(--border)); }
.status-dismissed { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); border-color: hsl(var(--border)); }
.status-low { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); border-color: hsl(var(--border)); }
.status-medium { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); border-color: hsl(var(--border)); }
.status-default { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); border-color: hsl(var(--border)); }

/* Priority badges */
.priority-critical { background: rgba(248, 113, 113, 0.1); color: #f87171; border-color: rgba(248, 113, 113, 0.3); }
.priority-high { background: rgba(251, 191, 36, 0.1); color: #fbbf24; border-color: rgba(251, 191, 36, 0.3); }
.priority-medium { background: hsl(var(--primary) / 0.1); color: hsl(var(--primary)); border-color: hsl(var(--primary) / 0.3); }
.priority-low { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); border-color: hsl(var(--border)); }

/* ==================== SCORE COLORS ==================== */
.score-green { color: #4ade80; }
.score-amber { color: #fbbf24; }
.score-red { color: #f87171; }
.score-bg-green { background: rgba(74, 222, 128, 0.1); color: #4ade80; }
.score-bg-amber { background: rgba(251, 191, 36, 0.1); color: #fbbf24; }
.score-bg-red { background: rgba(248, 113, 113, 0.1); color: #f87171; }

/* ==================== ACCORDION ==================== */
.accordion-item {
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.accordion-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: hsl(var(--foreground));
    background: hsl(var(--card));
    cursor: pointer;
    transition: background-color 0.2s;
    border: none;
    text-align: left;
}

.accordion-trigger:hover {
    background: hsl(var(--secondary));
}

.accordion-trigger .chevron {
    transition: transform 0.2s;
    flex-shrink: 0;
}

.accordion-trigger[aria-expanded="true"] .chevron {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: hsl(var(--card));
}

.accordion-content.open {
    max-height: 2000px;
}

.accordion-content-inner {
    padding: 0 1.25rem 1.25rem;
}

/* ==================== TABS ==================== */
.tabs-list {
    display: flex;
    gap: 0.25rem;
    padding: 0.25rem;
    background: hsl(var(--muted));
    border-radius: var(--radius);
    overflow-x: auto;
}

.tab-trigger {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    border: none;
    background: none;
}

.tab-trigger:hover {
    color: hsl(var(--foreground));
}

.tab-trigger.active {
    background: hsl(var(--card));
    color: hsl(var(--foreground));
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ==================== TOGGLE SWITCH ==================== */
.toggle {
    position: relative;
    display: inline-block;
    width: 2.75rem;
    height: 1.5rem;
    cursor: pointer;
}

.toggle input { display: none; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background-color: hsl(var(--muted));
    border-radius: 9999px;
    transition: background-color 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 1.125rem;
    height: 1.125rem;
    left: 0.1875rem;
    bottom: 0.1875rem;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle input:checked + .toggle-slider {
    background-color: hsl(var(--primary));
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(1.25rem);
}

/* ==================== TABLE ==================== */
.table-wrapper {
    overflow-x: auto;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th {
    padding: 0.75rem 1rem;
    font-weight: 500;
    text-align: left;
    color: hsl(var(--muted-foreground));
    background: hsl(var(--muted));
    border-bottom: 1px solid hsl(var(--border));
    white-space: nowrap;
}

.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid hsl(var(--border));
    color: hsl(var(--foreground));
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background: hsl(var(--muted) / 0.5);
}

/* ==================== MODAL / DIALOG ==================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1.5rem;
    max-width: 28rem;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: fade-up 0.2s ease-out;
}

.modal-lg { max-width: 42rem; }

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.modal-description {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    margin-bottom: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

/* ==================== DROPDOWN ==================== */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.5rem;
    min-width: 12rem;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.2);
    z-index: 50;
    display: none;
    overflow: hidden;
}

.dropdown-menu.open {
    display: block;
    animation: fade-in 0.15s ease-out;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: hsl(var(--foreground));
    cursor: pointer;
    transition: background-color 0.15s;
    width: 100%;
    text-align: left;
    border: none;
    background: none;
}

.dropdown-item:hover {
    background: hsl(var(--secondary));
}

.dropdown-separator {
    height: 1px;
    background: hsl(var(--border));
    margin: 0.25rem 0;
}

/* ==================== TOAST ==================== */
.toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.2);
    font-size: 0.875rem;
    animation: slide-in-right 0.3s ease-out;
    min-width: 16rem;
    max-width: 24rem;
}

.toast-success { border-color: rgba(74, 222, 128, 0.3); }
.toast-error { border-color: rgba(248, 113, 113, 0.3); }

.toast-close {
    margin-left: auto;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
    background: none;
    border: none;
    color: hsl(var(--foreground));
}

.toast-close:hover { opacity: 1; }

/* ==================== PROGRESS BAR ==================== */
.progress-bar {
    height: 0.5rem;
    background: hsl(var(--muted));
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.6s ease;
}

.progress-bar-fill-primary { background: hsl(var(--primary)); }
.progress-bar-fill-green { background: #4ade80; }
.progress-bar-fill-amber { background: #fbbf24; }
.progress-bar-fill-red { background: #f87171; }

/* ==================== CODE BLOCK ==================== */
.code-block {
    position: relative;
    background: hsl(var(--background));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1rem;
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.code-block .copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}

/* ==================== AVATAR ==================== */
.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    font-weight: 600;
    text-transform: uppercase;
    flex-shrink: 0;
}

.avatar-sm { width: 2rem; height: 2rem; font-size: 0.75rem; }
.avatar-md { width: 2.5rem; height: 2.5rem; font-size: 0.875rem; }
.avatar-lg { width: 3rem; height: 3rem; font-size: 1rem; }
.avatar-xl { width: 4rem; height: 4rem; font-size: 1.25rem; }

.avatar-primary {
    background: hsl(var(--primary) / 0.15);
    color: hsl(var(--primary));
}

.avatar-accent {
    background: hsl(var(--accent) / 0.15);
    color: hsl(var(--accent));
}

/* ==================== DIVIDER ==================== */
.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: hsl(var(--muted-foreground));
    font-size: 0.8125rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: hsl(var(--border));
}

/* ==================== TOOLTIP ==================== */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    background: hsl(var(--foreground));
    color: hsl(var(--background));
    border-radius: calc(var(--radius) - 2px);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    margin-bottom: 0.375rem;
    z-index: 50;
}

[data-tooltip]:hover::after {
    opacity: 1;
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    color: hsl(var(--muted-foreground));
}

.empty-state svg {
    width: 3rem;
    height: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}
