/* assets/css/kuaishou-video.css - COMPLETE UPDATED VERSION */

/* CSS Variables for theming - KEEP */
:root {
    --kuaishou-primary: #e11d48;
    --kuaishou-primary-dark: #be123c;
    --kuaishou-success: #10b981;
    --kuaishou-dark: #1f2937;
    --kuaishou-light: #f8fafc;
    --kuaishou-border: #e2e8f0;
    --kuaishou-text-light: #64748b;
    --kuaishou-error-bg: #fee2e2;
    --kuaishou-error-text: #dc2626;
    --kuaishou-success-bg: #d1fae5;
    --kuaishou-success-text: #065f46;
}

/* More specific selector to override theme styles - KEEP */
body.dark .kuaishou-tool-container,
body.dark .kuaishou-tool-container .anas-post-card,
body .kuaishou-tool-container.anas-post-card {
    border: none !important;
    border-top: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
}

.kuaishou-tool-container {
    width: 100%;
    max-width: 100%; /* UPDATED: 420px থেকে 100% */
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 
        rgba(0, 0, 0, 0.4) 0px 2px 4px,
        rgba(0, 0, 0, 0.3) 0px 7px 13px -3px,
        rgba(0, 0, 0, 0.2) 0px -3px 0px inset;
    margin: 8px auto; /* UPDATED: 20px থেকে 8px */
    box-sizing: border-box; /* ADDED: সঠিক সাইজ হিসাবের জন্য */
}

.kuaishou-header {
    background: linear-gradient(135deg, var(--kuaishou-primary), var(--kuaishou-primary-dark));
    color: white;
    padding: 12px 10px;
    text-align: center;
}

.kuaishou-header h1 {
    font-size: 1.2rem;
    margin-bottom: 4px;
    font-weight: 900;
}

.kuaishou-badge {
    display: inline-block;
    font-size: 0.75rem;
    background: rgba(255,255,255,0.25);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
}

.kuaishou-steps-container {
    display: flex;
    justify-content: center;
    padding: 10px 8px;
    gap: 10px;
}

.kuaishou-step {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.kuaishou-step.active {
    background: var(--kuaishou-primary);
    color: white;
    transform: scale(1.1);
}

.kuaishou-step.done {
    background: var(--kuaishou-success);
    color: white;
    font-size: 0;
}

.kuaishou-step.done::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 1rem;
}

.kuaishou-input-section {
    padding: 8px;
    background: #ffffff;
}

.kuaishou-input-group {
    display: flex;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--kuaishou-border);
    box-shadow: 0 4px 14px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.kuaishou-input-group:focus-within {
    border-color: var(--kuaishou-primary);
    box-shadow: 0 4px 14px rgba(225, 29, 72, 0.15);
}

.kuaishou-url-input {
    flex: 1;
    padding: 12px 14px;
    border: none;
    font-size: 0.95rem;
    outline: none;
    background: white;
    min-width: 0;
    color: var(--kuaishou-dark);
}

.kuaishou-url-input::placeholder {
    color: var(--kuaishou-text-light);
}

.kuaishou-go-button {
    background: linear-gradient(135deg, var(--kuaishou-primary), var(--kuaishou-primary-dark));
    color: white;
    border: none;
    padding: 0 16px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.kuaishou-go-button:hover:not(:disabled) {
    box-shadow: 0 6px 16px rgba(225, 29, 72, 0.35);
}

.kuaishou-go-button:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

.kuaishou-message {
    margin: 8px 0 0;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    display: none;
    background: #ffffff;
}

.kuaishou-error {
    background: var(--kuaishou-error-bg);
    color: var(--kuaishou-error-text);
    border-left: 4px solid var(--kuaishou-error-text);
}

.kuaishou-success {
    background: var(--kuaishou-success-bg);
    color: var(--kuaishou-success-text);
    border-left: 4px solid var(--kuaishou-success);
}

.kuaishou-loading {
    display: none;
    text-align: center;
    padding: 20px 16px;
    background: #ffffff;
}

.kuaishou-spinner {
    width: 36px;
    height: 36px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid var(--kuaishou-primary);
    border-radius: 50%;
    animation: kuaishou-spin 0.8s linear infinite;
    margin: 0 auto 8px;
}

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

.kuaishou-loading p {
    font-size: 0.9rem;
    color: var(--kuaishou-primary);
    font-weight: 600;
}

.kuaishou-result {
    display: none;
    padding: 0 16px 16px;
    background: #ffffff;
}

.kuaishou-preview > * {
    margin-bottom: 10px;
}

.kuaishou-thumbnail-container {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 16px rgba(0,0,0,0.14);
    background: #000;
    display: none;
}

.kuaishou-thumbnail-image, .kuaishou-video-tag {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
}

.kuaishou-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.3rem;
    color: white;
    opacity: 0.9;
    transition: all 0.3s ease;
    cursor: pointer;
    z-index: 2;
}

.kuaishou-play-icon:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.kuaishou-video-controls {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    background: rgba(0,0,0,0.8);
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 3;
}

.kuaishou-thumbnail-container:hover .kuaishou-video-controls {
    opacity: 1;
}

.kuaishou-control-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.kuaishou-control-btn:hover {
    background: rgba(255,255,255,0.2);
}

.kuaishou-volume-control {
    display: flex;
    align-items: center;
    gap: 4px;
}

.kuaishou-volume-slider {
    width: 60px;
    height: 4px;
    border-radius: 2px;
    background: #555;
    outline: none;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.kuaishou-volume-control:hover .kuaishou-volume-slider {
    opacity: 1;
}

.kuaishou-progress-slider {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: #555;
    outline: none;
    cursor: pointer;
}

.kuaishou-time-display {
    color: white;
    font-size: 0.7rem;
    min-width: 40px;
    text-align: center;
}

.kuaishou-buffering-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.7);
    padding: 10px 20px;
    border-radius: 20px;
    color: white;
    font-size: 0.8rem;
    display: none;
    z-index: 2;
}

.kuaishou-buffering-indicator.show {
    display: block;
}

.kuaishou-sound-notification {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    display: none;
    z-index: 2;
}

.kuaishou-sound-notification.show {
    display: block;
    animation: kuaishou-fadeOut 3s forwards;
}

@keyframes kuaishou-fadeOut {
    0% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; }
}

.kuaishou-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 8px 0;
    padding: 8px 12px;
    background: var(--kuaishou-light);
    border: 1.5px solid var(--kuaishou-border);
    border-radius: 10px;
}

.kuaishou-info-item {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.kuaishou-info-item i {
    color: var(--kuaishou-primary);
    font-size: 0.95rem;
    width: 18px;
}

.kuaishou-info-content {
    display: flex;
    align-items: center;
    gap: 4px;
}

.kuaishou-info-label {
    color: var(--kuaishou-text-light);
    font-weight: 500;
    font-size: 0.75rem;
    white-space: nowrap;
}

.kuaishou-info-value {
    color: var(--kuaishou-primary);
    font-weight: 700;
    font-size: 0.75rem;
    white-space: nowrap;
}

.kuaishou-download-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 8px;
}

.kuaishou-download-btn {
    background: linear-gradient(135deg, #FF5001, #FF2E01);
    color: #fff;
    border: 1.8px solid #FF8C01;
    border-radius: 7px;
    padding: 10px 3px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    box-shadow: 0 2px 6px rgba(255, 80, 1, 0.3);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    line-height: 1.1;
}

.kuaishou-download-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.4s;
}

.kuaishou-download-btn:hover::before {
    left: 100%;
}

.kuaishou-download-btn small {
    display: block;
    font-size: 8.5px;
    font-weight: 500;
    margin-top: 0;
    opacity: 0.9;
}

.kuaishou-download-btn:hover {
    transform: translateY(-1.5px);
    box-shadow: 0 4px 10px rgba(255, 80, 1, 0.45);
    border-color: #FFFFFF;
    background: linear-gradient(135deg, #FF6001, #FF3E01);
}

.kuaishou-download-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 4px rgba(255, 80, 1, 0.4);
}

.kuaishou-download-btn.kuaishou-sd {
    background: linear-gradient(135deg, #FF7B01, #FF5001);
    border: 1.8px solid #FFA501;
    box-shadow: 0 2px 6px rgba(255, 123, 1, 0.3);
}

.kuaishou-download-btn.kuaishou-sd:hover {
    box-shadow: 0 4px 10px rgba(255, 123, 1, 0.45);
    border-color: #FFFFFF;
    background: linear-gradient(135deg, #FF8B01, #FF6001);
}

.kuaishou-btn-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.kuaishou-btn-icon {
    font-size: 11.5px;
}

.kuaishou-progress-container {
    margin-top: 10px;
    display: none;
}

.kuaishou-progress-info {
    text-align: center;
    margin-bottom: 8px;
    font-size: 0.8rem;
    color: var(--kuaishou-text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.kuaishou-progress-info .kuaishou-dots {
    animation: kuaishou-dotPulse 1.5s infinite;
}

@keyframes kuaishou-dotPulse {
    0%, 20% { opacity: 0.3; }
    50% { opacity: 1; }
    80%, 100% { opacity: 0.3; }
}

.kuaishou-progress-info .kuaishou-save-hint {
    color: var(--kuaishou-primary);
    font-weight: 600;
    cursor: pointer;
    margin-left: 4px;
}

.kuaishou-progress-bar {
    height: 7px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.kuaishou-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--kuaishou-success);
    transition: width 0.3s ease;
}

.kuaishou-progress-text {
    display: block;
    text-align: center;
    margin-top: 5px;
    color: var(--kuaishou-text-light);
    font-size: 0.78rem;
}

.kuaishou-share-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
}

.kuaishou-share-button {
    padding: 10px 8px;
    border: 1.5px solid var(--kuaishou-border);
    border-radius: 10px;
    background: var(--kuaishou-light);
    font-size: 0.78rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
    color: var(--kuaishou-dark);
}

.kuaishou-share-button:hover {
    background: #f1f5f9;
}

.kuaishou-share-button i {
    color: var(--kuaishou-primary);
}

/* Success Page Styles */
.kuaishou-success-page {
    display: none;
    text-align: center;
    padding: 30px 20px;
    background: #ffffff;
}

.kuaishou-success-icon {
    width: 80px;
    height: 80px;
    background: var(--kuaishou-success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: white;
    font-size: 2rem;
    animation: kuaishou-successPulse 0.6s ease-in-out;
}

@keyframes kuaishou-successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.kuaishou-success-page h2 {
    color: var(--kuaishou-success);
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.kuaishou-success-page p {
    color: var(--kuaishou-text-light);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.kuaishou-next-video-btn {
    background: linear-gradient(135deg, var(--kuaishou-primary), var(--kuaishou-primary-dark));
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.kuaishou-next-video-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(225, 29, 72, 0.35);
}

/* Accessibility */
.kuaishou-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Kuaishou Video Tool Dark Mode */
.dark .kuaishou-tool-container {
    background: #303134;
    box-shadow: 0 2px 4px rgba(0,0,0,.3), 0 7px 13px -3px rgba(0,0,0,.2), 0 -3px 0px rgba(0,0,0,.4) inset;
}

.dark .kuaishou-input-section,
.dark .kuaishou-loading,
.dark .kuaishou-result,
.dark .kuaishou-success-page,
.dark .kuaishou-message {
    background: #303134;
}

.dark .kuaishou-url-input {
    background: #202124;
    color: #e8eaed;
    border-color: #5f6368;
}

.dark .kuaishou-url-input::placeholder {
    color: #9aa0a6;
}

.dark .kuaishou-info-row {
    background: #202124;
    border-color: #5f6368;
}

.dark .kuaishou-info-label {
    color: #9aa0a6;
}

.dark .kuaishou-info-value {
    color: #8ab4f8;
}

.dark .kuaishou-share-button {
    background: #202124;
    border-color: #5f6368;
    color: #e8eaed;
}

.dark .kuaishou-share-button:hover {
    background: #3c4043;
}

.dark .kuaishou-message {
    background: #303134;
    border-left-color: #5f6368;
}

.dark .kuaishou-error {
    background: #3c1f1f;
    color: #fca5a5;
    border-left-color: #dc2626;
}

.dark .kuaishou-success {
    background: #1a3a2e;
    color: #86efac;
    border-left-color: #10b981;
}

.dark .kuaishou-loading p {
    color: #8ab4f8;
}

.dark .kuaishou-progress-bar {
    background: #5f6368;
}

.dark .kuaishou-progress-text {
    color: #9aa0a6;
}

.dark .kuaishou-success-page p {
    color: #9aa0a6;
}

/* Video Player Dark Mode */
.dark .kuaishou-video-controls {
    background: rgba(0,0,0,0.9);
}

.dark .kuaishou-control-btn {
    color: #e8eaed;
}

.dark .kuaishou-control-btn:hover {
    background: rgba(255,255,255,0.15);
}

.dark .kuaishou-volume-slider,
.dark .kuaishou-progress-slider {
    background: #5f6368;
}

.dark .kuaishou-buffering-indicator,
.dark .kuaishou-sound-notification {
    background: rgba(0,0,0,0.8);
    color: #e8eaed;
}

/* Mobile optimizations */
@media (max-width: 480px) {
    .kuaishou-tool-container {
        border-radius: 10px;
        margin: 6px auto; /* UPDATED: আরও কম মার্জিন */
    }
    
    .kuaishou-header {
        padding: 12px 12px;
    }
    
    .kuaishou-header h1 {
        font-size: 1.1rem;
    }
    
    .kuaishou-steps-container {
        padding: 8px 6px;
        gap: 8px;
    }
    
    .kuaishou-input-section {
        padding: 10px;
    }
    
    .kuaishou-input-group {
        flex-direction: column;
        border-radius: 8px;
    }
    
    .kuaishou-url-input {
        padding: 10px 12px;
        border-bottom: 1px solid var(--kuaishou-border);
    }
    
    .kuaishou-go-button {
        padding: 10px;
        border-radius: 0 0 4px 4px;
        font-size: 0.85rem;
    }
    
    .kuaishou-result {
        padding: 0 12px 12px;
    }
    
    .kuaishou-info-row {
        padding: 7px 10px;
        gap: 8px;
        margin: 6px 0;
    }
    
    .kuaishou-info-label {
        font-size: 0.68rem;
    }
    
    .kuaishou-info-value {
        font-size: 0.72rem;
    }
    
    .kuaishou-download-row {
        gap: 5px;
    }
    
    .kuaishou-download-btn {
        padding: 8px 2px;
        font-size: 12px;
        min-height: 48px;
        border-radius: 6px;
        border-width: 1.5px;
    }
    
    .kuaishou-download-btn small {
        font-size: 8px;
    }
    
    .kuaishou-btn-icon {
        font-size: 11px;
    }
    
    .kuaishou-share-button {
        font-size: 0.72rem;
        padding: 8px 6px;
    }

    .kuaishou-success-page {
        padding: 20px 15px;
    }

    .kuaishou-success-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    .kuaishou-progress-info {
        font-size: 0.75rem;
    }

    .kuaishou-video-controls {
        padding: 6px;
        gap: 6px;
    }

    .kuaishou-time-display {
        font-size: 0.65rem;
        min-width: 35px;
    }

    .kuaishou-volume-slider {
        width: 40px;
    }

    /* Mobile Dark Mode Adjustments */
    .dark .kuaishou-url-input {
        border-bottom-color: #5f6368;
    }
}

/* Tablets */
@media (min-width: 481px) and (max-width: 768px) {
    .kuaishou-tool-container {
        max-width: 95%; /* ADDED: ট্যাবলেটের জন্য */
        margin: 10px auto;
    }
}

/* Desktop */
@media (min-width: 769px) {
    .kuaishou-tool-container {
        max-width: 90%; /* ADDED: ডেস্কটপের জন্য */
        margin: 12px auto;
    }
}

@media (max-width: 360px) {
    .kuaishou-tool-container {
        margin: 4px auto; /* UPDATED: আরও কম মার্জিন */
        border-radius: 6px;
    }
    
    .kuaishou-steps-container {
        gap: 6px;
    }
    
    .kuaishou-step {
        width: 32px;
        height: 32px;
    }
    
    .kuaishou-info-row {
        flex-wrap: wrap;
        gap: 6px;
        padding: 6px 8px;
    }
    
    .kuaishou-info-item {
        flex: 1 1 calc(50% - 8px);
        min-width: 100px;
    }
    
    .kuaishou-download-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    
    .kuaishou-download-btn {
        min-height: 46px;
        padding: 7px 2px;
    }
    
    .kuaishou-share-button {
        font-size: 0.68rem;
        padding: 7px 5px;
    }

    .kuaishou-progress-info {
        font-size: 0.7rem;
        flex-wrap: wrap;
        gap: 2px;
    }

    .kuaishou-volume-control {
        display: none;
    }

    /* Mobile Dark Mode Adjustments */
    .dark .kuaishou-info-item {
        background: #202124;
    }
}

/* ADD ONLY PERFORMANCE IMPROVEMENTS - NO DELETIONS */

/* 1. Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .kuaishou-spinner,
    .kuaishou-step,
    .kuaishou-download-btn::before,
    .kuaishou-play-icon,
    .kuaishou-control-btn,
    .kuaishou-next-video-btn,
    .kuaishou-share-button,
    .kuaishou-go-button,
    .kuaishou-download-btn {
        animation: none !important;
        transition: none !important;
    }
    
    .kuaishou-success-icon,
    .kuaishou-sound-notification.show,
    .kuaishou-buffering-indicator.show {
        animation: none !important;
    }
    
    .kuaishou-download-btn:hover,
    .kuaishou-next-video-btn:hover,
    .kuaishou-share-button:hover,
    .kuaishou-go-button:hover {
        transform: none !important;
    }
}

/* 2. Print styles */
@media print {
    .kuaishou-go-button,
    .kuaishou-download-btn,
    .kuaishou-share-button,
    .kuaishou-next-video-btn,
    .kuaishou-volume-control,
    .kuaishou-video-controls,
    .kuaishou-play-icon {
        display: none !important;
    }
    
    .kuaishou-tool-container {
        box-shadow: none !important;
        border: 1px solid #000 !important;
        background: white !important;
    }
    
    .kuaishou-info-value,
    .kuaishou-info-label {
        color: #000 !important;
    }
}

/* 3. Font loading optimization */
.kuaishou-tool-container,
.kuaishou-header h1,
.kuaishou-badge,
.kuaishou-url-input,
.kuaishou-go-button,
.kuaishou-message,
.kuaishou-loading p,
.kuaishou-info-label,
.kuaishou-info-value,
.kuaishou-download-btn,
.kuaishou-progress-info,
.kuaishou-progress-text,
.kuaishou-share-button,
.kuaishou-success-page h2,
.kuaishou-success-page p,
.kuaishou-next-video-btn {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* 4. Focus styles for accessibility */
.kuaishou-url-input:focus,
.kuaishou-go-button:focus,
.kuaishou-download-btn:focus,
.kuaishou-share-button:focus,
.kuaishou-next-video-btn:focus {
    outline: 2px solid var(--kuaishou-primary);
    outline-offset: 2px;
}

/* 5. Image loading optimization */
.kuaishou-thumbnail-image,
.kuaishou-video-tag {
    loading: lazy;
    decoding: async;
}