/**
 * Download Files Plugin - CSS
 * Responsive design cho mọi thiết bị
 */

/* ===== WRAPPER ===== */
.download-files-wrapper {
    display: inline-block;
    width: 100%;
    max-width: 400px;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* ===== BUTTON ===== */
.download-files-btn {
    position: relative;
    width: 100%;
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;

    /* Ngăn chặn hiển thị URL khi hover */
    text-decoration: none !important;
}

.download-files-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.download-files-btn:hover::before {
    opacity: 1;
}

.download-files-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.download-files-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.4);
}

.download-files-btn:disabled,
.download-files-btn.downloading {
    cursor: not-allowed;
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
    box-shadow: 0 2px 8px rgba(148, 163, 184, 0.3);
}

.download-files-btn:disabled:hover,
.download-files-btn.downloading:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(148, 163, 184, 0.3);
}

/* ===== ICON ===== */
.download-icon {
    flex-shrink: 0;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-5px);
    }
    60% {
        transform: translateY(-3px);
    }
}

.download-files-btn.downloading .download-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ===== TEXT ===== */
.download-text {
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.download-countdown {
    display: none;
    font-size: 15px;
    animation: pulse 1s infinite;
}

.download-countdown strong {
    font-size: 18px;
    color: #fbbf24;
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

/* ===== PROGRESS BAR ===== */
.download-progress {
    width: 100%;
    height: 6px;
    background-color: #e2e8f0;
    border-radius: 3px;
    margin-top: 12px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.download-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 3px;
    position: relative;
    overflow: hidden;
}

.download-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* ===== RESPONSIVE - TABLET ===== */
@media screen and (max-width: 768px) {
    .download-files-wrapper {
        max-width: 100%;
    }

    .download-files-btn {
        padding: 14px 28px;
        font-size: 15px;
        border-radius: 10px;
    }

    .download-icon {
        width: 18px;
        height: 18px;
    }

    .download-countdown strong {
        font-size: 17px;
    }
}

/* ===== RESPONSIVE - MOBILE ===== */
@media screen and (max-width: 480px) {
    .download-files-wrapper {
        max-width: 100%;
        margin: 15px 0;
    }

    .download-files-btn {
        padding: 14px 24px;
        font-size: 14px;
        border-radius: 10px;
        gap: 8px;
    }

    .download-icon {
        width: 16px;
        height: 16px;
    }

    .download-text {
        font-size: 14px;
    }

    .download-countdown {
        font-size: 13px;
    }

    .download-countdown strong {
        font-size: 16px;
    }

    .download-progress {
        height: 5px;
        margin-top: 10px;
    }
}

/* ===== RESPONSIVE - SMALL MOBILE ===== */
@media screen and (max-width: 360px) {
    .download-files-btn {
        padding: 12px 20px;
        font-size: 13px;
        gap: 6px;
    }

    .download-icon {
        width: 14px;
        height: 14px;
    }

    .download-text {
        font-size: 13px;
    }

    .download-countdown {
        font-size: 12px;
    }

    .download-countdown strong {
        font-size: 15px;
    }
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
    .download-progress {
        background-color: #334155;
    }
}

/* ===== ACCESSIBILITY ===== */
.download-files-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.download-files-btn:focus:not(:focus-visible) {
    outline: none;
}

.download-files-btn:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* ===== NGĂN CHẶN HIỂN THỊ URL ===== */
.download-files-btn,
.download-files-btn * {
    pointer-events: auto;
    cursor: pointer;
}

.download-files-btn:disabled,
.download-files-btn.downloading {
    pointer-events: auto;
    cursor: not-allowed;
}

/* Ngăn chặn selection */
.download-files-btn::selection,
.download-files-btn *::selection {
    background: transparent;
}

.download-files-btn::-moz-selection,
.download-files-btn *::-moz-selection {
    background: transparent;
}

/* ===== CUSTOM BUTTON STYLES ===== */
/* Người dùng có thể thêm class tùy chỉnh */
.download-files-btn.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.download-files-btn.btn-success:hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

.download-files-btn.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.download-files-btn.btn-danger:hover {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
}

.download-files-btn.btn-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.download-files-btn.btn-info:hover {
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
}

.download-files-btn.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.download-files-btn.btn-warning:hover {
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
}

/* ===== EMAIL GATE & SOCIAL SHARE GATE ===== */
.download-email-gate,
.download-share-gate {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    backdrop-filter: blur(5px);
}

.download-email-gate-content,
.download-share-gate-content {
    background: white;
    border-radius: 16px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

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

.download-email-gate-content h3,
.download-share-gate-content h3 {
    margin: 0 0 20px 0;
    font-size: 24px;
    color: #1d2327;
    text-align: center;
}

.download-email-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.download-email-form input[type="email"] {
    padding: 14px 18px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: border-color 0.3s ease;
}

.download-email-form input[type="email"]:focus {
    outline: none;
    border-color: #667eea;
}

.download-email-submit,
.download-share-btn {
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.download-email-submit:hover,
.download-share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.download-email-close,
.download-share-close {
    padding: 12px;
    background: transparent;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #646970;
    transition: all 0.2s ease;
}

.download-email-close:hover,
.download-share-close:hover {
    border-color: #999;
    color: #1d2327;
}

/* ===== SOCIAL SHARE BUTTONS ===== */
.download-share-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.download-share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
}

.download-share-facebook {
    background: #1877f2;
}

.download-share-facebook:hover {
    box-shadow: 0 6px 20px rgba(24, 119, 242, 0.4);
}

.download-share-twitter {
    background: #1da1f2;
}

.download-share-twitter:hover {
    box-shadow: 0 6px 20px rgba(29, 161, 242, 0.4);
}

.download-share-linkedin {
    background: #0077b5;
}

.download-share-linkedin:hover {
    box-shadow: 0 6px 20px rgba(0, 119, 181, 0.4);
}

.download-share-btn svg {
    width: 20px;
    height: 20px;
}

/* ===== MOBILE RESPONSIVENESS FOR GATES ===== */
@media screen and (max-width: 480px) {
    .download-email-gate-content,
    .download-share-gate-content {
        padding: 30px 20px;
        width: 95%;
    }

    .download-email-gate-content h3,
    .download-share-gate-content h3 {
        font-size: 20px;
    }

    .download-email-form input[type="email"],
    .download-email-submit,
    .download-share-btn {
        padding: 12px 16px;
        font-size: 14px;
    }
}
