/**
 * Bookmark Center Pro - Reusable Components
 * Buttons, Inputs, Badges, Icons
 * 
 * @package BookmarkCenterPro
 * @version 3.0.0
 */

/* ========================================
   Buttons - Base Styles
======================================== */
.bcp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--bcp-space-2);
    padding: var(--bcp-space-3) var(--bcp-space-5);
    font-family: inherit;
    font-size: var(--bcp-text-sm);
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    border: none;
    border-radius: var(--bcp-radius-md);
    cursor: pointer;
    transition: var(--bcp-transition-normal);
    white-space: nowrap;
    min-height: 44px;
    position: relative;
    overflow: hidden;
}

.bcp-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.bcp-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Button Sizes */
.bcp-btn-xs {
    padding: var(--bcp-space-1) var(--bcp-space-2);
    font-size: var(--bcp-text-xs);
    min-height: 28px;
    border-radius: var(--bcp-radius-sm);
}

.bcp-btn-sm {
    padding: var(--bcp-space-2) var(--bcp-space-3);
    font-size: var(--bcp-text-xs);
    min-height: 36px;
}

.bcp-btn-lg {
    padding: var(--bcp-space-4) var(--bcp-space-8);
    font-size: var(--bcp-text-base);
    min-height: 52px;
}

/* Primary Button */
.bcp-btn-primary {
    background: linear-gradient(135deg, var(--bcp-primary) 0%, var(--bcp-primary-dark) 100%);
    color: white;
    box-shadow: var(--bcp-shadow-primary);
}

.bcp-btn-primary:hover {
    background: linear-gradient(135deg, var(--bcp-primary-light) 0%, var(--bcp-primary) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--bcp-primary-glow);
}

.bcp-btn-primary:active {
    transform: translateY(0);
}

/* Secondary Button */
.bcp-btn-secondary {
    background: var(--bcp-bg-elevated);
    color: var(--bcp-text);
    border: 1px solid var(--bcp-border);
}

.bcp-btn-secondary:hover {
    background: var(--bcp-bg-hover);
    border-color: var(--bcp-primary);
    color: var(--bcp-primary);
}

/* Ghost Button */
.bcp-btn-ghost {
    background: transparent;
    color: var(--bcp-text-secondary);
}

.bcp-btn-ghost:hover {
    background: var(--bcp-bg-hover);
    color: var(--bcp-text);
}

/* Danger Button */
.bcp-btn-danger {
    background: linear-gradient(135deg, var(--bcp-danger) 0%, var(--bcp-danger-hover) 100%);
    color: white;
    box-shadow: 0 4px 12px var(--bcp-danger-glow);
}

.bcp-btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--bcp-danger-glow);
}

/* Success Button */
.bcp-btn-success {
    background: linear-gradient(135deg, var(--bcp-success) 0%, #16a34a 100%);
    color: white;
    box-shadow: 0 4px 12px var(--bcp-success-glow);
}

.bcp-btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--bcp-success-glow);
}

/* Icon Only Button */
.bcp-btn-icon {
    padding: var(--bcp-space-2);
    min-width: 40px;
    min-height: 40px;
    border-radius: var(--bcp-radius-md);
    background: transparent;
    color: var(--bcp-text-muted);
    border: 1px solid transparent;
}

.bcp-btn-icon:hover {
    background: var(--bcp-bg-hover);
    color: var(--bcp-primary);
    border-color: var(--bcp-border);
}

.bcp-btn-icon.active {
    background: var(--bcp-primary-bg);
    color: var(--bcp-primary);
    border-color: var(--bcp-primary);
}

/* Icon Button with Border */
.bcp-btn-icon-bordered {
    background: var(--bcp-bg-elevated);
    border: 1px solid var(--bcp-border);
}

.bcp-btn-icon-bordered:hover {
    border-color: var(--bcp-primary);
    background: var(--bcp-bg-hover);
}

/* Button Group */
.bcp-btn-group {
    display: inline-flex;
    border-radius: var(--bcp-radius-md);
    overflow: hidden;
}

.bcp-btn-group .bcp-btn {
    border-radius: 0;
    margin: 0;
}

.bcp-btn-group .bcp-btn:first-child {
    border-radius: var(--bcp-radius-md) 0 0 var(--bcp-radius-md);
}

.bcp-btn-group .bcp-btn:last-child {
    border-radius: 0 var(--bcp-radius-md) var(--bcp-radius-md) 0;
}

/* Button Loading State */
.bcp-btn-loading {
    pointer-events: none;
}

.bcp-btn-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: bcpSpin 0.6s linear infinite;
    margin-right: var(--bcp-space-2);
}

/* ========================================
   Form Inputs
======================================== */
.bcp-input {
    width: 100%;
    padding: var(--bcp-space-3) var(--bcp-space-4);
    font-family: inherit;
    font-size: var(--bcp-text-base);
    color: var(--bcp-text);
    background: var(--bcp-input-bg);
    border: 1px solid var(--bcp-input-border);
    border-radius: var(--bcp-radius-md);
    transition: var(--bcp-transition-normal);
    min-height: 48px;
}

.bcp-input::placeholder {
    color: var(--bcp-text-muted);
}

.bcp-input:hover {
    border-color: var(--bcp-border-light);
}

.bcp-input:focus {
    outline: none;
    border-color: var(--bcp-primary);
    box-shadow: 0 0 0 3px var(--bcp-primary-glow);
    background: var(--bcp-bg-elevated);
}

.bcp-input.error {
    border-color: var(--bcp-danger);
}

.bcp-input.error:focus {
    box-shadow: 0 0 0 3px var(--bcp-danger-glow);
}

/* Input Sizes */
.bcp-input-sm {
    padding: var(--bcp-space-2) var(--bcp-space-3);
    font-size: var(--bcp-text-sm);
    min-height: 40px;
}

.bcp-input-lg {
    padding: var(--bcp-space-4) var(--bcp-space-5);
    font-size: var(--bcp-text-lg);
    min-height: 56px;
}

/* Textarea */
.bcp-textarea {
    resize: vertical;
    min-height: 100px;
    line-height: var(--bcp-line-relaxed);
}

/* Select */
.bcp-select {
    appearance: none;
    cursor: pointer;
    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='%238892a6' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    padding-left: 40px;
}

/* Input with Icon */
.bcp-input-group {
    position: relative;
}

.bcp-input-group .bcp-input {
    padding-right: 44px;
}

.bcp-input-group .bcp-input-icon {
    position: absolute;
    top: 50%;
    right: var(--bcp-space-3);
    transform: translateY(-50%);
    color: var(--bcp-text-muted);
    pointer-events: none;
}

.bcp-input-group .bcp-input-icon svg {
    width: 20px;
    height: 20px;
}

/* Input with Button */
.bcp-input-action {
    display: flex;
    gap: var(--bcp-space-2);
}

.bcp-input-action .bcp-input {
    flex: 1;
}

/* Form Label */
.bcp-label {
    display: flex;
    align-items: center;
    gap: var(--bcp-space-2);
    margin-bottom: var(--bcp-space-2);
    font-size: var(--bcp-text-sm);
    font-weight: 500;
    color: var(--bcp-text-secondary);
}

.bcp-label svg {
    width: 16px;
    height: 16px;
    color: var(--bcp-text-muted);
}

.bcp-label.required::after {
    content: '*';
    color: var(--bcp-danger);
    margin-right: var(--bcp-space-1);
}

/* Form Group */
.bcp-form-group {
    margin-bottom: var(--bcp-space-5);
}

.bcp-form-group:last-child {
    margin-bottom: 0;
}

/* Form Helper Text */
.bcp-helper-text {
    margin-top: var(--bcp-space-1);
    font-size: var(--bcp-text-xs);
    color: var(--bcp-text-muted);
}

.bcp-helper-text.error {
    color: var(--bcp-danger);
}

/* ========================================
   Checkbox & Radio
======================================== */
.bcp-checkbox-group,
.bcp-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--bcp-space-3);
}

.bcp-checkbox,
.bcp-radio {
    display: flex;
    align-items: center;
    gap: var(--bcp-space-2);
    cursor: pointer;
    font-size: var(--bcp-text-sm);
    color: var(--bcp-text-secondary);
    transition: var(--bcp-transition-fast);
}

.bcp-checkbox:hover,
.bcp-radio:hover {
    color: var(--bcp-text);
}

.bcp-checkbox input,
.bcp-radio input {
    display: none;
}

.bcp-checkbox-mark,
.bcp-radio-mark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--bcp-border);
    background: var(--bcp-input-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--bcp-transition-fast);
    flex-shrink: 0;
}

.bcp-checkbox-mark {
    border-radius: var(--bcp-radius-xs);
}

.bcp-radio-mark {
    border-radius: var(--bcp-radius-full);
}

.bcp-checkbox-mark svg,
.bcp-radio-mark::after {
    opacity: 0;
    transform: scale(0);
    transition: var(--bcp-transition-fast);
}

.bcp-checkbox-mark svg {
    width: 14px;
    height: 14px;
    color: white;
}

.bcp-radio-mark::after {
    content: '';
    width: 8px;
    height: 8px;
    background: white;
    border-radius: var(--bcp-radius-full);
}

.bcp-checkbox input:checked + .bcp-checkbox-mark,
.bcp-radio input:checked + .bcp-radio-mark {
    background: var(--bcp-primary);
    border-color: var(--bcp-primary);
}

.bcp-checkbox input:checked + .bcp-checkbox-mark svg,
.bcp-radio input:checked + .bcp-radio-mark::after {
    opacity: 1;
    transform: scale(1);
}

/* ========================================
   Badges & Tags
======================================== */
.bcp-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--bcp-space-1);
    padding: var(--bcp-space-1) var(--bcp-space-3);
    font-size: var(--bcp-text-xs);
    font-weight: 500;
    border-radius: var(--bcp-radius-full);
    background: var(--bcp-bg-elevated);
    border: 1px solid var(--bcp-border-subtle);
    color: var(--bcp-text-secondary);
    white-space: nowrap;
}

.bcp-badge-primary {
    background: var(--bcp-primary-bg);
    border-color: var(--bcp-primary);
    color: var(--bcp-primary-light);
}

.bcp-badge-success {
    background: var(--bcp-success-bg);
    border-color: var(--bcp-success);
    color: var(--bcp-success-light);
}

.bcp-badge-danger {
    background: var(--bcp-danger-bg);
    border-color: var(--bcp-danger);
    color: var(--bcp-danger-light);
}

.bcp-badge-warning {
    background: var(--bcp-warning-bg);
    border-color: var(--bcp-warning);
    color: var(--bcp-warning-light);
}

/* Tag with Color Dot */
.bcp-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--bcp-space-2);
    padding: var(--bcp-space-1) var(--bcp-space-3);
    font-size: var(--bcp-text-xs);
    font-weight: 500;
    border-radius: var(--bcp-radius-full);
    background: var(--bcp-bg-surface);
    border: 1px solid var(--bcp-border-subtle);
    color: var(--bcp-text-secondary);
    transition: var(--bcp-transition-fast);
}

.bcp-tag:hover {
    border-color: var(--bcp-border);
    background: var(--bcp-bg-hover);
}

.bcp-tag-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--bcp-radius-full);
    flex-shrink: 0;
}

.bcp-tag-removable {
    cursor: pointer;
}

.bcp-tag-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: var(--bcp-radius-full);
    background: transparent;
    color: var(--bcp-text-muted);
    transition: var(--bcp-transition-fast);
    cursor: pointer;
}

.bcp-tag-remove:hover {
    background: var(--bcp-danger-bg);
    color: var(--bcp-danger);
}

.bcp-tag-remove svg {
    width: 12px;
    height: 12px;
}

/* Count Badge */
.bcp-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 var(--bcp-space-2);
    font-size: var(--bcp-text-xs);
    font-weight: 600;
    border-radius: var(--bcp-radius-full);
    background: var(--bcp-bg-elevated);
    color: var(--bcp-text-muted);
}

.bcp-count-primary {
    background: var(--bcp-primary);
    color: white;
}

/* ========================================
   Avatars
======================================== */
.bcp-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--bcp-radius-full);
    background: var(--bcp-bg-elevated);
    color: var(--bcp-text-muted);
    font-weight: 600;
    font-size: var(--bcp-text-sm);
    flex-shrink: 0;
    overflow: hidden;
}

.bcp-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bcp-avatar-sm {
    width: 32px;
    height: 32px;
    font-size: var(--bcp-text-xs);
}

.bcp-avatar-lg {
    width: 56px;
    height: 56px;
    font-size: var(--bcp-text-lg);
}

/* ========================================
   Icons Container
======================================== */
.bcp-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bcp-icon svg {
    width: 100%;
    height: 100%;
}

.bcp-icon-xs { width: 14px; height: 14px; }
.bcp-icon-sm { width: 18px; height: 18px; }
.bcp-icon-md { width: 24px; height: 24px; }
.bcp-icon-lg { width: 32px; height: 32px; }
.bcp-icon-xl { width: 48px; height: 48px; }

/* ========================================
   Dividers
======================================== */
.bcp-divider {
    border: none;
    border-top: 1px solid var(--bcp-border-subtle);
    margin: var(--bcp-space-4) 0;
}

.bcp-divider-vertical {
    width: 1px;
    height: 100%;
    background: var(--bcp-border-subtle);
    margin: 0 var(--bcp-space-4);
}

/* ========================================
   Loading States
======================================== */
.bcp-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--bcp-border);
    border-top-color: var(--bcp-primary);
    border-radius: var(--bcp-radius-full);
    animation: bcpSpin 0.6s linear infinite;
}

.bcp-spinner-sm {
    width: 16px;
    height: 16px;
}

.bcp-spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

.bcp-skeleton {
    background: linear-gradient(90deg, var(--bcp-bg-elevated) 25%, var(--bcp-bg-hover) 50%, var(--bcp-bg-elevated) 75%);
    background-size: 200% 100%;
    animation: bcpSkeleton 1.5s ease infinite;
    border-radius: var(--bcp-radius-sm);
}

@keyframes bcpSkeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========================================
   Empty State
======================================== */
.bcp-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--bcp-space-12);
    text-align: center;
}

.bcp-empty-icon {
    width: 80px;
    height: 80px;
    margin-bottom: var(--bcp-space-6);
    color: var(--bcp-text-dim);
}

.bcp-empty-title {
    font-size: var(--bcp-text-xl);
    font-weight: 600;
    color: var(--bcp-text);
    margin-bottom: var(--bcp-space-2);
}

.bcp-empty-description {
    font-size: var(--bcp-text-base);
    color: var(--bcp-text-muted);
    margin-bottom: var(--bcp-space-6);
    max-width: 400px;
}

/* ========================================
   Tooltips
======================================== */
.bcp-tooltip {
    position: relative;
}

.bcp-tooltip::before,
.bcp-tooltip::after {
    position: absolute;
    opacity: 0;
    visibility: hidden;
    transition: var(--bcp-transition-fast);
    pointer-events: none;
    z-index: var(--bcp-z-tooltip);
}

.bcp-tooltip::before {
    content: attr(data-tooltip);
    top: 100%;
    right: 50%;
    transform: translateX(50%);
    margin-top: 8px;
    padding: var(--bcp-space-2) var(--bcp-space-3);
    font-size: var(--bcp-text-xs);
    font-weight: 500;
    color: white;
    background: var(--bcp-bg-dark);
    border-radius: var(--bcp-radius-sm);
    white-space: nowrap;
    box-shadow: var(--bcp-shadow-md);
}

.bcp-tooltip::after {
    content: '';
    top: 100%;
    right: 50%;
    transform: translateX(50%);
    border: 6px solid transparent;
    border-bottom-color: var(--bcp-bg-dark);
}

.bcp-tooltip:hover::before,
.bcp-tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Tooltip Top */
.bcp-tooltip-top::before {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 8px;
}

.bcp-tooltip-top::after {
    top: auto;
    bottom: 100%;
    border-bottom-color: transparent;
    border-top-color: var(--bcp-bg-dark);
}
