/**
 * Tools Horizon Pro - Public Frontend Components
 * Mobile-first, accessible, and performant component library
 * @version 3.0.0
 */

:root {
    --th-primary: #667eea;
    --th-primary-dark: #5a6fd6;
    --th-primary-light: rgba(102, 126, 234, 0.1);
    --th-secondary: #764ba2;
    --th-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --th-gradient-hover: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
    
    --th-success: #10b981;
    --th-success-light: #d1fae5;
    --th-danger: #ef4444;
    --th-danger-light: #fee2e2;
    --th-warning: #f59e0b;
    --th-warning-light: #fef3c7;
    --th-info: #3b82f6;
    --th-info-light: #dbeafe;
    
    --th-text: #1f2937;
    --th-text-light: #374151;
    --th-text-muted: #6b7280;
    --th-text-lighter: #9ca3af;
    
    --th-bg: #ffffff;
    --th-bg-alt: #f9fafb;
    --th-bg-muted: #f3f4f6;
    
    --th-border: #e5e7eb;
    --th-border-dark: #d1d5db;
    
    --th-radius: 8px;
    --th-radius-sm: 4px;
    --th-radius-lg: 12px;
    --th-radius-xl: 16px;
    --th-radius-full: 9999px;
    
    --th-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --th-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --th-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --th-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --th-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --th-transition: all 0.2s ease;
    --th-transition-fast: all 0.15s ease;
    --th-transition-slow: all 0.3s ease;
    
    --th-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

.th-tool-card {
    position: relative;
    background: var(--th-bg);
    border-radius: var(--th-radius-lg);
    box-shadow: var(--th-shadow);
    overflow: hidden;
    transition: var(--th-transition);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.th-tool-card:hover {
    box-shadow: var(--th-shadow-lg);
    transform: translateY(-4px);
}

.th-tool-card-image {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: var(--th-bg-muted);
    overflow: hidden;
}

.th-tool-card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.th-tool-card:hover .th-tool-card-image img {
    transform: scale(1.05);
}

.th-tool-card-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--th-gradient);
    border-radius: var(--th-radius-lg);
    color: #fff;
    font-size: 28px;
}

.th-tool-card-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.th-tool-card-title {
    margin: 0 0 8px;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--th-text);
    line-height: 1.4;
}

.th-tool-card-title a {
    color: inherit;
    text-decoration: none;
}

.th-tool-card-title a:hover {
    color: var(--th-primary);
}

.th-tool-card-excerpt {
    margin: 0 0 16px;
    font-size: 0.875rem;
    color: var(--th-text-muted);
    line-height: 1.6;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.th-tool-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.75rem;
    color: var(--th-text-lighter);
}

.th-tool-card-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.th-tool-card-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--th-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.th-tool-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.th-tool-card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 1;
}

.th-tool-card-favorite {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1;
}

.th-tool-card-compact .th-tool-card-body {
    padding: 16px;
}

.th-tool-card-compact .th-tool-card-title {
    font-size: 1rem;
}

.th-tool-card-horizontal {
    flex-direction: row;
}

.th-tool-card-horizontal .th-tool-card-image {
    width: 200px;
    padding-top: 0;
    flex-shrink: 0;
}

.th-tool-card-horizontal .th-tool-card-image img {
    position: relative;
    height: 100%;
}

@media (max-width: 640px) {
    .th-tool-card-horizontal {
        flex-direction: column;
    }
    
    .th-tool-card-horizontal .th-tool-card-image {
        width: 100%;
        padding-top: 56.25%;
    }
}

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

.th-category-card {
    position: relative;
    background: var(--th-bg);
    border-radius: var(--th-radius-lg);
    box-shadow: var(--th-shadow);
    padding: 24px;
    text-align: center;
    transition: var(--th-transition);
}

.th-category-card:hover {
    box-shadow: var(--th-shadow-lg);
    transform: translateY(-4px);
}

.th-category-card-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--th-primary-light);
    border-radius: var(--th-radius-lg);
    color: var(--th-primary);
    font-size: 32px;
    transition: var(--th-transition);
}

.th-category-card:hover .th-category-card-icon {
    background: var(--th-gradient);
    color: #fff;
}

.th-category-card-title {
    margin: 0 0 8px;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--th-text);
}

.th-category-card-title a {
    color: inherit;
    text-decoration: none;
}

.th-category-card-count {
    font-size: 0.875rem;
    color: var(--th-text-muted);
}

.th-category-card-description {
    margin: 12px 0 0;
    font-size: 0.875rem;
    color: var(--th-text-muted);
    line-height: 1.5;
}

.th-category-card-horizontal {
    display: flex;
    align-items: center;
    text-align: left;
    gap: 16px;
    padding: 16px 20px;
}

.th-category-card-horizontal .th-category-card-icon {
    width: 56px;
    height: 56px;
    margin: 0;
    flex-shrink: 0;
    font-size: 24px;
}

.th-category-card-horizontal .th-category-card-content {
    flex: 1;
    min-width: 0;
}

.th-category-card-horizontal .th-category-card-title {
    margin-bottom: 4px;
}

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

.th-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: var(--th-font-family);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    text-decoration: none;
    border: none;
    border-radius: var(--th-radius);
    cursor: pointer;
    transition: var(--th-transition);
    white-space: nowrap;
}

.th-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.th-btn:disabled,
.th-btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.th-btn-primary {
    background: var(--th-gradient);
    color: #fff;
}

.th-btn-primary:hover {
    background: var(--th-gradient-hover);
    transform: translateY(-1px);
    box-shadow: var(--th-shadow-md);
}

.th-btn-secondary {
    background: var(--th-bg-muted);
    color: var(--th-text-light);
    border: 1px solid var(--th-border);
}

.th-btn-secondary:hover {
    background: var(--th-border);
    border-color: var(--th-border-dark);
}

.th-btn-success {
    background: var(--th-success);
    color: #fff;
}

.th-btn-success:hover {
    background: #059669;
}

.th-btn-danger {
    background: var(--th-danger);
    color: #fff;
}

.th-btn-danger:hover {
    background: #dc2626;
}

.th-btn-outline {
    background: transparent;
    color: var(--th-primary);
    border: 2px solid var(--th-primary);
}

.th-btn-outline:hover {
    background: var(--th-primary);
    color: #fff;
}

.th-btn-ghost {
    background: transparent;
    color: var(--th-text-muted);
}

.th-btn-ghost:hover {
    background: var(--th-bg-muted);
    color: var(--th-text);
}

.th-btn-link {
    background: transparent;
    color: var(--th-primary);
    padding: 0;
}

.th-btn-link:hover {
    text-decoration: underline;
}

.th-btn-xs {
    padding: 4px 10px;
    font-size: 0.75rem;
}

.th-btn-sm {
    padding: 6px 14px;
    font-size: 0.75rem;
}

.th-btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

.th-btn-xl {
    padding: 18px 36px;
    font-size: 1.125rem;
}

.th-btn-block {
    display: flex;
    width: 100%;
}

.th-btn-icon {
    padding: 10px;
    width: 40px;
    height: 40px;
}

.th-btn-icon.th-btn-sm {
    width: 32px;
    height: 32px;
    padding: 6px;
}

.th-btn-icon.th-btn-lg {
    width: 48px;
    height: 48px;
    padding: 12px;
}

.th-btn-group {
    display: inline-flex;
    border-radius: var(--th-radius);
    overflow: hidden;
}

.th-btn-group .th-btn {
    border-radius: 0;
    margin: 0;
}

.th-btn-group .th-btn:first-child {
    border-radius: var(--th-radius) 0 0 var(--th-radius);
}

.th-btn-group .th-btn:last-child {
    border-radius: 0 var(--th-radius) var(--th-radius) 0;
}

.th-btn-loading {
    pointer-events: none;
}

.th-btn-loading .th-btn-text {
    opacity: 0;
}

.th-btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: th-icon-spin 0.6s linear infinite;
}

/* ==========================================================================
   FORMS
   ========================================================================== */

.th-form-group {
    margin-bottom: 20px;
}

.th-form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--th-text);
}

.th-form-label-required::after {
    content: " *";
    color: var(--th-danger);
}

.th-input,
.th-select,
.th-textarea {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-family: var(--th-font-family);
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--th-text);
    background: var(--th-bg);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
    transition: var(--th-transition-fast);
}

.th-input:focus,
.th-select:focus,
.th-textarea:focus {
    outline: none;
    border-color: var(--th-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.th-input::placeholder,
.th-textarea::placeholder {
    color: var(--th-text-lighter);
}

.th-input-sm {
    padding: 6px 10px;
    font-size: 0.75rem;
}

.th-input-lg {
    padding: 14px 18px;
    font-size: 1rem;
}

.th-textarea {
    min-height: 100px;
    resize: vertical;
}

.th-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 10px center;
    background-repeat: no-repeat;
    background-size: 20px;
    padding-right: 40px;
}

.th-input-group {
    display: flex;
}

.th-input-group .th-input {
    flex: 1;
    border-radius: var(--th-radius) 0 0 var(--th-radius);
}

.th-input-group .th-btn {
    border-radius: 0 var(--th-radius) var(--th-radius) 0;
}

.th-input-icon {
    position: relative;
}

.th-input-icon .th-input {
    padding-left: 40px;
}

.th-input-icon .th-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--th-text-lighter);
}

.th-checkbox,
.th-radio {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.th-checkbox input,
.th-radio input {
    width: 18px;
    height: 18px;
    accent-color: var(--th-primary);
    cursor: pointer;
}

.th-form-error {
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--th-danger);
}

.th-form-hint {
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--th-text-muted);
}

.th-input.is-error,
.th-select.is-error,
.th-textarea.is-error {
    border-color: var(--th-danger);
}

.th-input.is-success,
.th-select.is-success,
.th-textarea.is-success {
    border-color: var(--th-success);
}

/* ==========================================================================
   RESULT BOXES
   ========================================================================== */

.th-result-box {
    padding: 20px;
    background: var(--th-bg-alt);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius-lg);
    margin: 20px 0;
}

.th-result-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--th-border);
}

.th-result-box-title {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--th-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.th-result-box-content {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--th-text);
    line-height: 1.3;
    word-break: break-word;
}

.th-result-box-content.th-result-lg {
    font-size: 2rem;
}

.th-result-box-content.th-result-xl {
    font-size: 2.5rem;
}

.th-result-box-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.th-result-box-success {
    background: var(--th-success-light);
    border-color: var(--th-success);
}

.th-result-box-error {
    background: var(--th-danger-light);
    border-color: var(--th-danger);
}

.th-result-box-warning {
    background: var(--th-warning-light);
    border-color: var(--th-warning);
}

.th-result-box-info {
    background: var(--th-info-light);
    border-color: var(--th-info);
}

.th-result-highlight {
    display: inline-block;
    padding: 4px 10px;
    background: var(--th-gradient);
    color: #fff;
    border-radius: var(--th-radius-sm);
}

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

.th-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1;
    border-radius: var(--th-radius-full);
    white-space: nowrap;
}

.th-badge-primary {
    background: var(--th-primary-light);
    color: var(--th-primary);
}

.th-badge-secondary {
    background: var(--th-bg-muted);
    color: var(--th-text-muted);
}

.th-badge-success {
    background: var(--th-success-light);
    color: var(--th-success);
}

.th-badge-danger {
    background: var(--th-danger-light);
    color: var(--th-danger);
}

.th-badge-warning {
    background: var(--th-warning-light);
    color: #92400e;
}

.th-badge-info {
    background: var(--th-info-light);
    color: var(--th-info);
}

.th-badge-solid-primary {
    background: var(--th-gradient);
    color: #fff;
}

.th-badge-solid-success {
    background: var(--th-success);
    color: #fff;
}

.th-badge-solid-danger {
    background: var(--th-danger);
    color: #fff;
}

.th-badge-sm {
    padding: 2px 6px;
    font-size: 0.625rem;
}

.th-badge-lg {
    padding: 6px 14px;
    font-size: 0.875rem;
}

.th-badge-dot {
    padding: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.th-badge-new {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
}

.th-badge-hot {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
}

.th-badge-featured {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
}

/* ==========================================================================
   STAR RATINGS
   ========================================================================== */

.th-stars {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.th-star {
    color: var(--th-border-dark);
    font-size: 16px;
    cursor: default;
}

.th-star.filled {
    color: #fbbf24;
}

.th-star.half::before {
    content: "\f459";
    color: #fbbf24;
}

.th-stars-interactive .th-star {
    cursor: pointer;
    transition: transform 0.1s ease;
}

.th-stars-interactive .th-star:hover {
    transform: scale(1.2);
}

.th-stars-sm .th-star {
    font-size: 14px;
}

.th-stars-lg .th-star {
    font-size: 20px;
    gap: 4px;
}

.th-stars-xl .th-star {
    font-size: 28px;
    gap: 6px;
}

.th-rating-display {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.th-rating-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--th-text);
}

.th-rating-count {
    font-size: 0.75rem;
    color: var(--th-text-muted);
}

.th-rating-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.th-rating-bar-label {
    font-size: 0.875rem;
    color: var(--th-text-muted);
    min-width: 60px;
}

.th-rating-bar-track {
    flex: 1;
    height: 8px;
    background: var(--th-bg-muted);
    border-radius: var(--th-radius-full);
    overflow: hidden;
}

.th-rating-bar-fill {
    height: 100%;
    background: #fbbf24;
    border-radius: var(--th-radius-full);
    transition: width 0.3s ease;
}

.th-rating-bar-count {
    font-size: 0.75rem;
    color: var(--th-text-muted);
    min-width: 40px;
    text-align: right;
}

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

.th-share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.th-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: var(--th-radius);
    transition: var(--th-transition-fast);
    color: #fff;
}

.th-share-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--th-shadow-md);
}

.th-share-btn-icon {
    padding: 10px;
    border-radius: var(--th-radius);
}

.th-share-btn-circle {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
}

.th-share-facebook { background: #1877f2; }
.th-share-facebook:hover { background: #166fe5; }

.th-share-twitter { background: #1da1f2; }
.th-share-twitter:hover { background: #1a91da; }

.th-share-linkedin { background: #0a66c2; }
.th-share-linkedin:hover { background: #004182; }

.th-share-pinterest { background: #e60023; }
.th-share-pinterest:hover { background: #ad081b; }

.th-share-whatsapp { background: #25d366; }
.th-share-whatsapp:hover { background: #128c7e; }

.th-share-telegram { background: #0088cc; }
.th-share-telegram:hover { background: #006699; }

.th-share-email { background: var(--th-text-muted); }
.th-share-email:hover { background: var(--th-text-light); }

.th-share-copy { 
    background: var(--th-bg-muted); 
    color: var(--th-text);
    border: 1px solid var(--th-border);
}
.th-share-copy:hover { 
    background: var(--th-border); 
    color: var(--th-text);
}

.th-share-print {
    background: var(--th-bg-muted);
    color: var(--th-text);
    border: 1px solid var(--th-border);
}
.th-share-print:hover {
    background: var(--th-border);
    color: var(--th-text);
}

/* ==========================================================================
   PAGINATION
   ========================================================================== */

.th-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
    margin: 32px 0;
}

.th-pagination-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--th-text-muted);
    text-decoration: none;
    background: var(--th-bg);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
    transition: var(--th-transition-fast);
}

.th-pagination-item:hover {
    color: var(--th-primary);
    border-color: var(--th-primary);
    background: var(--th-primary-light);
}

.th-pagination-item.active {
    color: #fff;
    background: var(--th-gradient);
    border-color: transparent;
}

.th-pagination-item.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.th-pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    color: var(--th-text-lighter);
}

.th-pagination-prev,
.th-pagination-next {
    padding: 0 16px;
}

.th-pagination-info {
    font-size: 0.875rem;
    color: var(--th-text-muted);
    margin: 0 16px;
}

@media (max-width: 640px) {
    .th-pagination-item {
        min-width: 36px;
        height: 36px;
        padding: 0 8px;
        font-size: 0.75rem;
    }
    
    .th-pagination-text {
        display: none;
    }
}

/* ==========================================================================
   ALERTS & NOTICES
   ========================================================================== */

.th-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    border-radius: var(--th-radius);
    margin-bottom: 16px;
}

.th-alert-icon {
    flex-shrink: 0;
    font-size: 20px;
}

.th-alert-content {
    flex: 1;
    min-width: 0;
}

.th-alert-title {
    margin: 0 0 4px;
    font-size: 0.875rem;
    font-weight: 600;
}

.th-alert-message {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.5;
}

.th-alert-close {
    flex-shrink: 0;
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.th-alert-close:hover {
    opacity: 1;
}

.th-alert-success {
    background: var(--th-success-light);
    border-left: 4px solid var(--th-success);
    color: #065f46;
}

.th-alert-danger {
    background: var(--th-danger-light);
    border-left: 4px solid var(--th-danger);
    color: #991b1b;
}

.th-alert-warning {
    background: var(--th-warning-light);
    border-left: 4px solid var(--th-warning);
    color: #92400e;
}

.th-alert-info {
    background: var(--th-info-light);
    border-left: 4px solid var(--th-info);
    color: #1e40af;
}

/* ==========================================================================
   SPINNERS & LOADERS
   ========================================================================== */

.th-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--th-border);
    border-top-color: var(--th-primary);
    border-radius: 50%;
    animation: th-spin 0.8s linear infinite;
}

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

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

.th-spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 4px;
}

.th-spinner-white {
    border-color: rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
}

.th-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.8);
    z-index: 100;
}

.th-skeleton {
    background: linear-gradient(90deg, var(--th-bg-muted) 25%, var(--th-border) 50%, var(--th-bg-muted) 75%);
    background-size: 200% 100%;
    animation: th-skeleton 1.5s ease-in-out infinite;
    border-radius: var(--th-radius-sm);
}

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

.th-skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.th-skeleton-circle {
    border-radius: 50%;
}

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

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

.th-tooltip-content {
    position: absolute;
    z-index: 1000;
    background: var(--th-text);
    color: #fff;
    padding: 8px 12px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--th-radius-sm);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: var(--th-transition-fast);
    pointer-events: none;
}

.th-tooltip-content::after {
    content: "";
    position: absolute;
    border: 6px solid transparent;
}

.th-tooltip:hover .th-tooltip-content {
    opacity: 1;
    visibility: visible;
}

.th-tooltip-top .th-tooltip-content {
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
}

.th-tooltip-top .th-tooltip-content::after {
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-top-color: var(--th-text);
}

.th-tooltip-bottom .th-tooltip-content {
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
}

.th-tooltip-bottom .th-tooltip-content::after {
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-bottom-color: var(--th-text);
}
