/* TikTok Embed Pro - Frontend Styles */

/* Main TikTok Wrapper */
.tiktok-wrapper {
    text-align: center;
    margin: 10px auto;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    max-width: 100%;
}

.tiktok-wrapper:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.tiktok-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 64, 129, 0.1), transparent);
    transition: left 0.5s ease;
    z-index: 1;
}

.tiktok-wrapper:hover::before {
    left: 100%;
}

/* Theme Variants */
.tiktok-wrapper.theme-dark {
    background: #2d3748;
    color: #e2e8f0;
}

.tiktok-wrapper.theme-light {
    background: #ffffff;
    color: #2d3748;
}

/* TikTok Container */
.tiktok-container {
    position: relative;
    z-index: 2;
}

/* TikTok Embed Styling */
.tiktok-embed {
    border: none !important;
    margin: 0 auto !important;
    display: block !important;
    position: relative;
}

/* Caption Styling */
.tiktok-caption {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
    text-align: center;
}

.theme-dark .tiktok-caption {
    color: #e2e8f0;
}

/* Loading Animation */
.tiktok-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #ff0050;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.tiktok-loading p {
    color: #666;
    font-size: 14px;
    margin: 0;
}

/* Share Button */
.tiktok-share {
    margin-top: 15px;
    text-align: center;
}

.share-btn {
    background: linear-gradient(45deg, #ff0050, #ff4081);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 0, 80, 0.3);
    text-decoration: none;
    color: white;
}

.share-btn i {
    font-size: 16px;
}

/* Error Messages */
.tiktok-error {
    background: #fed7d7;
    border: 1px solid #fc8181;
    color: #742a2a;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    margin: 20px 0;
    font-size: 14px;
}

/* Grid Layout */
.tiktok-grid {
    display: grid;
    gap: 20px;
    margin: 20px 0;
}

.tiktok-grid .tiktok-wrapper {
    margin: 0;
}

/* Centering */
.tiktok-wrapper[data-center="true"] {
    text-align: center;
}

.tiktok-wrapper[data-center="false"] {
    text-align: left;
}

/* Responsive Design */
@media (max-width: 768px) {
    .tiktok-wrapper {
        margin: 15px 0;
        padding: 15px;
    }
    
    .tiktok-embed {
        max-width: 100% !important;
        min-width: 280px !important;
    }
    
    .tiktok-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }
    
    .tiktok-caption {
        font-size: 14px;
    }
    
    .share-btn {
        padding: 8px 16px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .tiktok-wrapper {
        margin: 10px 0;
        padding: 10px;
    }
    
    .tiktok-embed {
        min-width: 250px !important;
    }
    
    .tiktok-loading {
        min-height: 300px;
    }
    
    .loading-spinner {
        width: 30px;
        height: 30px;
        border-width: 3px;
    }
}

/* Animation Effects */
.tiktok-wrapper.fade-in {
    animation: fadeIn 0.6s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tiktok-wrapper.slide-in {
    animation: slideIn 0.8s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Accessibility */
.tiktok-wrapper:focus-within {
    outline: 2px solid #ff4081;
    outline-offset: 2px;
}

.share-btn:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .tiktok-wrapper {
        break-inside: avoid;
        background: white !important;
        box-shadow: none !important;
        border: 1px solid #ccc;
    }
    
    .share-btn {
        display: none;
    }
    
    .tiktok-loading {
        display: none;
    }
    
    .tiktok-embed::after {
        content: "TikTok Video: " attr(cite);
        display: block;
        font-size: 12px;
        color: #666;
        margin-top: 10px;
        text-align: center;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .tiktok-wrapper {
        border: 2px solid;
        background: white;
    }
    
    .tiktok-wrapper.theme-dark {
        background: black;
        color: white;
        border-color: white;
    }
    
    .share-btn {
        background: black;
        color: white;
        border: 2px solid white;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .tiktok-wrapper,
    .share-btn,
    .loading-spinner {
        transition: none;
        animation: none;
    }
    
    .tiktok-wrapper::before {
        display: none;
    }
}

/* Custom Scrollbar for TikTok Container */
.tiktok-container::-webkit-scrollbar {
    width: 8px;
}

.tiktok-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.tiktok-container::-webkit-scrollbar-thumb {
    background: #ff4081;
    border-radius: 4px;
}

.tiktok-container::-webkit-scrollbar-thumb:hover {
    background: #ff0050;
}
