/**
 * DingleDesign Public Styles
 *
 * Frontend styles for download buttons, timer, and product page modifications.
 *
 * @package DingleDesign
 */

/* =========================================================================
   CSS Variables
   ========================================================================= */

:root {
    --dd-pub-primary: #6366f1;
    --dd-pub-primary-light: #818cf8;
    --dd-pub-primary-glow: rgba(99, 102, 241, 0.3);
    --dd-pub-success: #10b981;
    --dd-pub-danger: #ef4444;
    --dd-pub-font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --dd-pub-radius: 10px;
    --dd-pub-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================================================
   Download Section
   ========================================================================= */

.dd-download-section {
    margin: 20px 0;
    font-family: var(--dd-pub-font);
}

.dd-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    background: linear-gradient(135deg, var(--dd-pub-primary), #4f46e5);
    color: #fff !important;
    border: none;
    border-radius: var(--dd-pub-radius);
    font-family: var(--dd-pub-font);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--dd-pub-transition);
    box-shadow: 0 4px 15px var(--dd-pub-primary-glow);
    text-transform: none;
    letter-spacing: 0;
}

.dd-download-btn:hover {
    background: linear-gradient(135deg, var(--dd-pub-primary-light), var(--dd-pub-primary));
    transform: translateY(-2px);
    box-shadow: 0 6px 25px var(--dd-pub-primary-glow);
}

.dd-download-btn:active {
    transform: translateY(0);
}

.dd-download-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.dd-download-btn .dd-btn-icon {
    font-size: 18px;
}

.dd-btn-loading {
    position: relative;
}

/* =========================================================================
   Spinner
   ========================================================================= */

.dd-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: dd-spin 0.8s linear infinite;
}

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

/* =========================================================================
   Timer Container
   ========================================================================= */

.dd-timer-container {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--dd-pub-radius);
    padding: 20px;
    text-align: center;
}

.dd-timer-progress {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.dd-timer-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--dd-pub-primary), #8b5cf6, var(--dd-pub-primary-light));
    background-size: 200% 100%;
    border-radius: 4px;
    animation: dd-shimmer 2s linear infinite;
}

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

.dd-timer-text {
    color: #fff;
    font-family: var(--dd-pub-font);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* =========================================================================
   Frontend Toast
   ========================================================================= */

.dd-frontend-toast {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 99999;
    padding: 16px 24px;
    border-radius: var(--dd-pub-radius);
    font-family: var(--dd-pub-font);
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    animation: dd-toast-slide 0.3s ease;
    max-width: 350px;
}

.dd-frontend-toast.dd-toast-error {
    background: var(--dd-pub-danger);
}

@keyframes dd-toast-slide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================================================
   WooCommerce Product Page Overrides
   ========================================================================= */

.single-product .dd-download-section {
    margin-top: 15px;
}

/* Badge for free/paid type */
.dd-product-type-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.dd-product-type-badge.dd-type-free {
    background: rgba(16, 185, 129, 0.15);
    color: var(--dd-pub-success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.dd-product-type-badge.dd-type-paid {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* =========================================================================
   Responsive
   ========================================================================= */

@media (max-width: 768px) {
    .dd-download-btn {
        width: 100%;
        justify-content: center;
        padding: 16px;
    }

    .dd-timer-container {
        padding: 16px;
    }

    .dd-frontend-toast {
        left: 15px;
        right: 15px;
        max-width: none;
    }
}
