/* ===========================
   Shadcn Component Library
   Professional UI Components
   =========================== */

/* ==================== BUTTONS ==================== */

.btn {
    padding: var(--space-md) var(--space-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    text-decoration: none;
    white-space: nowrap;
}

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

.btn:active {
    transform: scale(0.98);
}

/* Button Primary */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* Button Secondary */
.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border);
    border-color: var(--border-light);
    transform: translateY(-2px);
}

/* Button Ghost */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
}

.btn-ghost:hover:not(:disabled) {
    background: rgba(37, 99, 235, 0.1);
    color: var(--text-primary);
    border-color: rgba(37, 99, 235, 0.2);
}

/* Button Destructive */
.btn-destructive {
    background: var(--error);
    color: white;
}

.btn-destructive:hover:not(:disabled) {
    background: #dc2626;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Button Outline */
.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-outline:hover:not(:disabled) {
    background: var(--bg-tertiary);
    border-color: var(--primary);
}

/* Button Sizes */
.btn-full {
    width: 100%;
}

.btn-small {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-xs);
}

.btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: var(--font-size-xs);
}

.btn-lg {
    padding: var(--space-lg) var(--space-xl);
    font-size: var(--font-size-base);
}

/* ==================== CARDS ==================== */

.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: all var(--transition-base);
}

.card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.card-header {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.card-description {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin-top: var(--space-sm);
}

.card-content {
    margin-bottom: var(--space-lg);
}

.card-footer {
    display: flex;
    gap: var(--space-md);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border);
}

/* ==================== ALERTS ==================== */

.alert {
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    border: 1px solid;
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    animation: slideInDown var(--transition-base);
}

.alert p {
    margin: 0;
    font-size: var(--font-size-sm);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
    color: var(--success);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--error);
    color: var(--error);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--warning);
    color: var(--warning);
}

.alert-info {
    background: rgba(14, 165, 233, 0.1);
    border-color: var(--info);
    color: var(--info);
}

/* ==================== BADGES ==================== */

.badge {
    display: inline-block;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary {
    background: rgba(37, 99, 235, 0.2);
    color: var(--primary-light);
}

.badge-secondary {
    background: rgba(100, 116, 139, 0.2);
    color: var(--secondary-light);
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.badge-error {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

/* ==================== INPUTS ==================== */

.form-input,
.form-textarea,
.form-select {
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    font-family: inherit;
    transition: all var(--transition-base);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-tertiary);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-tertiary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input:disabled,
.form-textarea:disabled,
.form-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-textarea {
    resize: vertical;
    font-family: 'Monaco', 'Courier New', monospace;
}

/* ==================== TABS ==================== */

.tabs {
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 0;
}

.tab-button {
    padding: var(--space-md) var(--space-lg);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
}

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

.tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
    animation: fadeIn var(--transition-base);
}

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

/* ==================== BADGES (Confidence) ==================== */

.confidence-badge {
    display: inline-block;
    padding: var(--space-xs) var(--space-md);
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 600;
}

/* ==================== TOOLTIPS ==================== */

.tooltip-container {
    position: relative;
    display: inline-block;
}

.tooltip-text {
    visibility: hidden;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    text-align: center;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -60px;
    opacity: 0;
    transition: opacity var(--transition-base);
    font-size: var(--font-size-xs);
    white-space: nowrap;
    border: 1px solid var(--border);
}

.tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--bg-tertiary) transparent transparent transparent;
}

.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* ==================== PROGRESS BAR ==================== */

.progress {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    transition: width var(--transition-slow);
    border-radius: var(--radius-sm);
}

/* ==================== SPINNER ==================== */

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(37, 99, 235, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.spinner-small {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.spinner-large {
    width: 32px;
    height: 32px;
    border-width: 4px;
}

/* ==================== SKELETON LOADER ==================== */

.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-light) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
    border-radius: var(--radius-md);
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 16px;
    margin-bottom: var(--space-md);
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

/* ==================== DIVIDER ==================== */

.divider {
    height: 1px;
    background: var(--border);
    margin: var(--space-lg) 0;
}

.divider-text {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    color: var(--text-tertiary);
    font-size: var(--font-size-xs);
}

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

/* ==================== TYPOGRAPHY ==================== */

.text-primary {
    color: var(--text-primary);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-tertiary {
    color: var(--text-tertiary);
}

.text-error {
    color: var(--error);
}

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-info {
    color: var(--info);
}

/* Font sizes */
.text-xs {
    font-size: var(--font-size-xs);
}

.text-sm {
    font-size: var(--font-size-sm);
}

.text-base {
    font-size: var(--font-size-base);
}

.text-lg {
    font-size: var(--font-size-lg);
}

.text-xl {
    font-size: var(--font-size-xl);
}

.text-2xl {
    font-size: var(--font-size-2xl);
}

/* Font weights */
.font-light {
    font-weight: 300;
}

.font-normal {
    font-weight: 400;
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

/* Text alignment */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

/* ==================== UTILITIES ==================== */

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.opacity-50 {
    opacity: 0.5;
}

.opacity-75 {
    opacity: 0.75;
}

.gap-xs {
    gap: var(--space-xs);
}

.gap-sm {
    gap: var(--space-sm);
}

.gap-md {
    gap: var(--space-md);
}

.gap-lg {
    gap: var(--space-lg);
}
