/* Custom CSS for Redesigned TeraBox Downloader Pro */

/* History Section Styles */
.history-section {
    padding: 40px 0;
    background: linear-gradient(135deg, #f8fafc, #f0f4ff);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.history-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-header h2 i {
    color: var(--primary-color);
    font-size: 22px;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(67, 97, 238, 0.3);
}

.history-content {
    min-height: 150px;
}

.history-empty {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
    border: 2px dashed var(--border-color);
}

.history-empty i {
    font-size: 48px;
    color: var(--text-light);
    margin-bottom: 15px;
}

.history-empty p {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.history-empty span {
    font-size: 14px;
    color: var(--text-secondary);
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.history-item {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.history-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-color);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.history-item:hover::before {
    transform: scaleY(1);
}

.history-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.history-item-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    margin-right: 10px;
}

.history-item-date {
    font-size: 12px;
    color: var(--text-light);
    white-space: nowrap;
}

.history-item-info {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.history-item-info span {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
}

.history-item-info i {
    color: var(--primary-color);
    font-size: 12px;
}

.history-item-actions {
    display: flex;
    gap: 10px;
}

.history-item-actions button {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.history-item-actions .btn-reuse {
    background: linear-gradient(135deg, var(--primary-color), #5971ea);
    color: white;
}

.history-item-actions .btn-reuse:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(67, 97, 238, 0.3);
}

.history-item-actions .btn-remove {
    background: #f3f4f6;
    color: var(--text-secondary);
}

.history-item-actions .btn-remove:hover {
    background: #fecaca;
    color: #dc2626;
}

/* Redesigned Preview Section */
.preview-section {
    padding: 40px 0;
    background: #f9fafb;
}

.preview-section.hidden {
    display: none;
}

.preview-container {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    animation: slideUp 0.4s ease;
    max-width: 1200px;
    margin: 0 auto;
}

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

.preview-header {
    background: linear-gradient(135deg, #4361ee, #5a72ee);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
}

.preview-header h2 {
    color: white;
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.preview-header h2 i {
    font-size: 18px;
}

.btn-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.btn-close i {
    color: white;
    font-size: 18px;
}

.preview-content {
        display: flex;
        flex-direction: row;
        gap: 40px;
        padding: 35px;
        align-items: flex-start;
    }

    @media (max-width: 768px) {
        .preview-content {
            flex-direction: column;
            padding: 20px 15px;
            gap: 20px;
        }
        
        .preview-media {
            width: 100%;
            max-width: none;
            margin: 0;
        }
        
        .video-info {
            width: 100%;
        }
    }

    @media (max-width: 480px) {
        .preview-content {
            padding: 15px 12px;
            gap: 15px;
        }
        
        .preview-media {
            width: 100%;
        }
    }

.preview-media {
    flex: 0 0 auto;
    width: 320px;
    max-width: 100%;
}

@media (max-width: 768px) {
    .preview-media {
        width: 100%;
        max-width: none;
    }
}

.video-thumbnail {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, #f0f2f5, #e5e7eb);
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    min-height: 180px;
}

.video-thumbnail:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.video-thumbnail img[src=""] {
    display: none;
}

.video-thumbnail::before {
    content: '\f03e';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 48px;
    color: #9ca3af;
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    z-index: 1;
}

.video-thumbnail img[src]:not([src=""]) ~ ::before {
    display: none;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: relative;
    z-index: 2;
}

.play-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
    z-index: 3;
}

.video-thumbnail:hover .play-overlay {
    opacity: 1;
}

.play-overlay i {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.95);
    color: #4361ee;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    padding-left: 2px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
    backdrop-filter: blur(4px);
}

.video-thumbnail:hover .play-overlay i {
    transform: scale(1.1);
}

.file-type-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(67, 97, 238, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 4;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.video-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.file-header {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 16px;
}

.file-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 8px 0;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.file-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.file-date {
    color: #6b7280;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.file-date i {
    color: #4361ee;
    font-size: 12px;
}

.video-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 0;
    background: transparent;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.detail-icon {
    width: 40px;
    height: 40px;
    background: #f0f4ff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4361ee;
    font-size: 16px;
    flex-shrink: 0;
}

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

.detail-label {
    font-size: 11px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
    display: block;
}

.detail-value {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-ready {
    color: #10b981;
}

.video-actions {
    display: flex;
    gap: 12px;
    padding-top: 8px;
    margin-top: auto;
}

.video-actions .btn {
    flex: 1;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    white-space: nowrap;
    border: none;
    min-height: 44px;
}

.video-actions .btn i {
    font-size: 14px;
}

.video-actions .btn-primary {
    background: linear-gradient(135deg, #4361ee, #5a72ee);
    color: white;
    box-shadow: 0 4px 14px rgba(67, 97, 238, 0.25);
}

.video-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(67, 97, 238, 0.35);
}

.video-actions .btn-secondary {
    background: white;
    color: #4361ee;
    border: 2px solid #4361ee;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.video-actions .btn-secondary:hover {
    background: #4361ee;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(67, 97, 238, 0.25);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .preview-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .history-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .history-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .history-header h2 {
        font-size: 20px;
    }
    
    .btn-outline {
        width: 100%;
        justify-content: center;
    }
    
    .preview-content {
        flex-direction: column;
        padding: 20px 15px;
        gap: 20px;
        align-items: stretch;
    }
    
    .preview-media {
        width: 100%;
        max-width: none;
        margin: 0;
    }
    
    .video-info {
        width: 100%;
    }
    
    .preview-header {
        padding: 15px 20px;
        flex-wrap: wrap;
    }
    
    .preview-header h2 {
        font-size: 18px;
    }
    
    .file-header h3 {
        font-size: 18px;
        line-height: 1.5;
    }
    
    .video-details {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 15px;
    }
    
    .video-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .video-actions .btn {
        width: 100%;
        min-width: unset;
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .history-grid {
        grid-template-columns: 1fr;
    }
    
    .video-thumbnail {
        aspect-ratio: 16/9;
        min-height: 140px;
    }
    
    .play-overlay i {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }
    
    .video-thumbnail::before {
        font-size: 36px;
    }
}

@media (max-width: 480px) {
    .history-section {
        padding: 25px 0;
    }
    
    .preview-section {
        padding: 30px 0 20px;
    }
    
    .preview-container {
        border-radius: 15px;
    }
    
    .preview-content {
        padding: 15px;
        gap: 15px;
    }
    
    .preview-header {
        padding: 12px 15px;
    }
    
    .preview-header h2 {
        font-size: 16px;
        gap: 6px;
    }
    
    .preview-header h2 i {
        font-size: 18px;
    }
    
    .btn-close {
        width: 35px;
        height: 35px;
    }
    
    .btn-close i {
        font-size: 18px;
    }
    
    .file-header {
        padding-bottom: 15px;
    }
    
    .file-header h3 {
        font-size: 16px;
        margin-bottom: 8px;
    }
    
    .file-meta {
        gap: 15px;
    }
    
    .file-date {
        font-size: 13px;
    }
    
    .video-info {
        gap: 15px;
    }
    
    .video-details {
        padding: 12px;
        gap: 12px;
    }
    
    .detail-icon {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .detail-label {
        font-size: 11px;
    }
    
    .detail-value {
        font-size: 13px;
    }
    
    .video-actions {
        padding-top: 15px;
        gap: 8px;
    }
    
    .video-actions .btn {
        padding: 10px 15px;
        font-size: 13px;
        border-radius: 10px;
        gap: 6px;
    }
    
    .video-actions .btn i {
        font-size: 14px;
    }
    
    .video-thumbnail {
        border-radius: 12px;
        aspect-ratio: 16/9;
        min-height: 160px;
    }
    
    .play-overlay i {
        width: 52px;
        height: 52px;
        font-size: 20px;
    }
    
    .video-thumbnail::before {
        font-size: 42px;
    }
    
    .file-type-badge {
        top: 10px;
        right: 10px;
        padding: 4px 10px;
        font-size: 10px;
    }
    
    .history-item {
        padding: 15px;
    }
    
    .history-item-title {
        font-size: 14px;
    }
    
    .history-item-actions button {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.history-item {
    animation: fadeIn 0.5s ease;
}

.preview-media {
    animation: slideInRight 0.6s ease;
}

.video-info {
    animation: slideInRight 0.7s ease;
}

/* Loading States */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 8px;
}

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

/* View All Container */
.view-all-container {
    text-align: center;
    margin-top: 40px;
}

.view-all-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 30px;
    background: linear-gradient(135deg, var(--primary-color), #6b7aee);
    color: white;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(67, 97, 238, 0.3);
}

.view-all-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(67, 97, 238, 0.4);
}

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

.section-header {
    margin-bottom: 40px;
}

.section-header h2 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.section-header p {
    font-size: 16px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

@media (max-width: 480px) {
    .history-section {
        padding: 25px 0;
    }
    
    .preview-section {
        padding: 15px 0 10px;
    }
    
    .preview-container {
        margin: 0 5px;
        border-radius: 10px;
    }
    
    .preview-content {
        padding: 15px 12px;
        gap: 15px;
    }
    
    .preview-header {
        padding: 12px 15px;
        border-radius: 10px 10px 0 0;
    }
    
    .preview-header h2 {
        font-size: 16px;
        gap: 6px;
    }
    
    .preview-header h2 i {
        font-size: 16px;
    }
    
    .btn-close {
        width: 30px;
        height: 30px;
    }
    
    .btn-close i {
        font-size: 16px;
    }
    
    .video-thumbnail {
        border-radius: 8px;
        aspect-ratio: 16/9;
    }
    
    .file-type-badge {
        top: 8px;
        right: 8px;
        padding: 3px 8px;
        font-size: 10px;
    }
    
    .play-overlay i {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    .file-header {
        padding-bottom: 12px;
    }
    
    .file-header h3 {
        font-size: 16px;
        margin-bottom: 6px;
    }
    
    .file-meta {
        flex-direction: column;
        gap: 5px;
    }
    
    .file-date {
        font-size: 12px;
    }
    
    .video-info {
        gap: 15px;
    }
    
    .video-details {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        padding: 12px;
    }
    
    .detail-item {
        padding: 10px;
        border-radius: 8px;
    }
    
    .detail-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .detail-label {
        font-size: 11px;
    }
    
    .detail-value {
        font-size: 13px;
    }
    
    .video-actions {
        padding-top: 15px;
        gap: 8px;
    }
    
    .video-actions .btn {
        padding: 12px 15px;
        font-size: 13px;
        border-radius: 8px;
        gap: 6px;
    }
    
    .video-actions .btn i {
        font-size: 14px;
    }
    
    .history-item {
        padding: 15px;
    }
    
    .history-item-title {
        font-size: 14px;
    }
    
    .history-item-actions button {
        padding: 6px 10px;
        font-size: 12px;
    }
}

@media (max-width: 390px) {
    .preview-content {
        padding: 12px 10px;
        gap: 12px;
    }
    
    .video-details {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .video-actions .btn {
        padding: 10px 12px;
        font-size: 12px;
    }
    
    .file-header h3 {
        font-size: 15px;
    }
    
    .preview-header {
        padding: 10px 12px;
    }
    
    .preview-header h2 {
        font-size: 15px;
    }
}
