/* Download Buttons Styles - Following front-page.php btn btn-primary style */

.dwc-download-container {
    text-align: center;
    margin-bottom: 12px;
}

.dwc-download-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    font-size: 1rem;
    font-family: inherit;
    background: #7E67B5;
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    min-width: 200px;
    justify-content: center;
    min-height: 50px;
    box-sizing: border-box;
}

.dwc-download-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(126, 103, 181, 0.4);
    background: #6B5B95;
    color: white;
    text-decoration: none;
}

.dwc-download-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(126, 103, 181, 0.3);
}

.dwc-download-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.dwc-download-button:focus {
    outline: 2px solid #7E67B5;
    outline-offset: 2px;
}

.dwc-download-icon {
    font-size: 1rem;
    width: 16px;
    text-align: center;
    transition: transform 0.3s ease;
}

.dwc-download-button:hover .dwc-download-icon {
    transform: scale(1.1);
}

.dwc-download-text {
    font-weight: 600;
}

.dwc-download-counter {
    font-size: 14px;
    opacity: 0.9;
    font-weight: 400;
}

.dwc-download-loading {
    font-size: 1rem;
    animation: spin 1s linear infinite;
}

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

/* Button States - Following theme colors */
.dwc-download-button.tracking {
    background: #7E67B5;
    opacity: 0.8;
    cursor: not-allowed;
    transform: none;
    animation: trackingPulse 1.5s ease-in-out infinite;
}

.dwc-download-button.redirecting {
    background: #7E67B5;
    opacity: 0.9;
    cursor: not-allowed;
    transform: none;
    animation: redirectingPulse 1s ease-in-out infinite;
}

@keyframes trackingPulse {
    0%, 100% {
        opacity: 0.8;
        box-shadow: 0 4px 15px rgba(126, 103, 181, 0.3);
    }
    50% {
        opacity: 0.9;
        box-shadow: 0 4px 20px rgba(126, 103, 181, 0.4);
    }
}

@keyframes redirectingPulse {
    0%, 100% {
        opacity: 0.9;
        box-shadow: 0 4px 15px rgba(126, 103, 181, 0.3);
    }
    50% {
        opacity: 1;
        box-shadow: 0 4px 20px rgba(126, 103, 181, 0.4);
    }
}

/* Error State */
.dwc-download-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 16px;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin: 10px 0;
}

/* Success Message */
.dwc-download-success {
    background: #d4edda;
    color: #155724;
    padding: 12px 16px;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    margin: 10px 0;
}

/* Responsive Design - Following circulos-restaurativos pattern */
@media (max-width: 768px) {
    .dwc-download-container {
        margin: 15px 0;
    }
    
    .dwc-download-button {
        width: 100%;
        justify-content: center;
        min-height: 48px;
        box-sizing: border-box;
        padding: 1rem 2rem;
    }
    
    .dwc-download-counter {
        font-size: 12px;
    }
    
    .dwc-download-icon {
        font-size: 16px;
    }
    
    .dwc-download-button[data-file-type] .dwc-download-icon::before {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .dwc-download-button {
        padding: 12px 24px;
        font-size: 14px;
    }
    
    .dwc-download-counter {
        font-size: 11px;
    }
}

/* Animation for button click */
.dwc-download-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.dwc-download-button:active::before {
    width: 300px;
    height: 300px;
}

/* File type icons - Font Awesome icons */
.dwc-download-button[data-file-type="livro"] .dwc-download-icon::before {
    content: "\f02d"; /* fa-book */
}

.dwc-download-button[data-file-type="audio"] .dwc-download-icon::before {
    content: "\f028"; /* fa-volume-up */
}

.dwc-download-button[data-file-type="video"] .dwc-download-icon::before {
    content: "\f03d"; /* fa-play-circle */
}

.dwc-download-button[data-file-type="documento"] .dwc-download-icon::before {
    content: "\f15c"; /* fa-file-alt */
}

.dwc-download-button[data-file-type="apresentacao"] .dwc-download-icon::before {
    content: "\f0f6"; /* fa-file-powerpoint */
}

.dwc-download-button[data-file-type="planilha"] .dwc-download-icon::before {
    content: "\f1c3"; /* fa-file-excel */
}

.dwc-download-button[data-file-type="imagem"] .dwc-download-icon::before {
    content: "\f03e"; /* fa-image */
}

.dwc-download-button[data-file-type="pdf"] .dwc-download-icon::before {
    content: "\f1c1"; /* fa-file-pdf */
}

.dwc-download-button[data-file-type="zip"] .dwc-download-icon::before {
    content: "\f1c6"; /* fa-file-archive */
}

.dwc-download-button[data-file-type="link"] .dwc-download-icon::before {
    content: "\f0c1"; /* fa-link */
}

.dwc-download-button[data-file-type="generic"] .dwc-download-icon::before {
    content: "\f019"; /* fa-download */
}

/* Click button icon - only if not a link type */
.dwc-download-button[data-button-type="click"]:not([data-file-type="link"]) .dwc-download-icon::before {
    content: "\f245"; /* fa-mouse-pointer */
}

/* Accessibility and High Contrast Support */
@media (prefers-contrast: high) {
    .dwc-download-button {
        border: 2px solid currentColor;
    }
    
    .dwc-download-button:focus {
        outline: 3px solid #000;
        outline-offset: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .dwc-download-button {
        transition: none;
    }
    
    .dwc-download-button:hover {
        transform: none;
    }
    
    .dwc-download-loading {
        animation: none;
    }
    
    .dwc-download-button::before {
        transition: none;
    }
    
    .dwc-download-button.tracking,
    .dwc-download-button.redirecting {
        animation: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .dwc-download-error {
        background: #2d1b1b;
        color: #f5c6cb;
        border-color: #721c24;
    }
    
    .dwc-download-success {
        background: #1b2d1b;
        color: #c3e6cb;
        border-color: #155724;
    }
}

