/* ═══════════════════════════════════════════════
   Q Sine Case Study Downloads Widget — CSS
   Version: 2.0.0
═══════════════════════════════════════════════ */

/* ── GRID ── */
.qsine-dl-wrap { width: 100%; }

.qsine-dl-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

/* ── CARD ── */
.qsine-dl-card {
    background: #FFFFFF;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(107,45,139,0.08);
    border: 1px solid #E8DFF0;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.qsine-dl-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 48px rgba(107,45,139,0.16);
}

/* ── IMAGE ── */
.qsine-dl-image {
    position: relative;
    height: 200px;
    overflow: hidden;
    background: #F0EBF8;
}

.qsine-dl-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.qsine-dl-card:hover .qsine-dl-image img {
    transform: scale(1.05);
}

.qsine-dl-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #EDE4F5, #F5F0FA);
}

.qsine-dl-image-placeholder svg {
    width: 48px;
    height: 48px;
    color: rgba(107,45,139,0.25);
}

/* ── BADGE ── */
.qsine-dl-badge {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.qsine-dl-badge-tag {
    background: #F5A800;
    color: #0A0A0A;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 4px 10px;
    display: block;
}

.qsine-dl-badge-label {
    background: #00A651;
    color: #FFFFFF;
    font-size: 16px;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 8px 14px;
    line-height: 1.1;
    text-align: center;
    display: block;
}

/* All accent variants use green — consistent across all cards */
.qsine-dl-accent-purple .qsine-dl-badge-label  { background: #00A651; }
.qsine-dl-accent-gold .qsine-dl-badge-label    { background: #00A651; }
.qsine-dl-accent-green .qsine-dl-badge-label   { background: #00A651; }
.qsine-dl-accent-gold .qsine-dl-badge-tag      { background: #F5A800; }
.qsine-dl-accent-green .qsine-dl-badge-tag     { background: #F5A800; color: #0A0A0A; }

/* ── OVERLAY INFO ── */
.qsine-dl-overlay-info {
    position: absolute;
    bottom: 0;
    left: 0;
    padding: 10px 12px;
    background: linear-gradient(to top, rgba(74,29,98,0.92) 0%, transparent 100%);
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.qsine-dl-customer-label {
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 2px;
    color: #F5A800;
    text-transform: uppercase;
    line-height: 1.2;
}

.qsine-dl-customer-value {
    font-size: 10px;
    font-weight: 500;
    color: rgba(255,255,255,0.95);
    line-height: 1.3;
    display: block;
}

/* ── BODY ── */
.qsine-dl-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
}

.qsine-dl-title {
    font-size: 15px;
    font-weight: 700;
    color: #1A1A2E;
    line-height: 1.4;
    margin: 0;
}

/* ── DOWNLOAD BUTTON ── */
.qsine-dl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #6B2D8B;
    color: #FFFFFF;
    border: none;
    font-size: 13px;
    font-weight: 700;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    transition: background 0.25s ease, color 0.25s ease, transform 0.2s ease;
    letter-spacing: 0.3px;
    margin-top: auto;
}

.qsine-dl-btn:hover {
    background: #F5A800;
    color: #0A0A0A;
    transform: translateY(-2px);
}

/* ════════════════════════════════════════════
   POPUP OVERLAY
════════════════════════════════════════════ */
.qsine-dl-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,10,10,0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.qsine-dl-popup-overlay.qsine-dl-popup-visible {
    opacity: 1;
}

/* ── POPUP BOX ── */
.qsine-dl-popup-box {
    background: #FFFFFF;
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 520px;
    position: relative;
    box-shadow: 0 32px 80px rgba(0,0,0,0.35);
    transform: translateY(20px) scale(0.97);
    transition: transform 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.qsine-dl-popup-visible .qsine-dl-popup-box {
    transform: translateY(0) scale(1);
}

/* ── CLOSE BUTTON ── */
.qsine-dl-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #F2F2F5;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    color: #1A1A2E;
}

.qsine-dl-close:hover { background: #E8DFF0; }

/* ── POPUP HEADER ── */
.qsine-dl-popup-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.qsine-dl-popup-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, #6B2D8B, #8B44B0);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    flex-shrink: 0;
}

.qsine-dl-popup-title {
    font-size: 22px;
    font-weight: 800;
    color: #1A1A2E;
    margin: 0 0 4px;
    line-height: 1.2;
}

.qsine-dl-popup-subtitle {
    font-size: 13px;
    color: #6B7280;
    margin: 0;
    line-height: 1.5;
}

/* ── DOCUMENT FOR LABEL ── */
.qsine-dl-popup-for {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(245,168,0,0.1);
    border: 1px solid rgba(245,168,0,0.3);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 24px;
    font-size: 13px;
    font-weight: 600;
    color: #C47E00;
}

/* ── FORM GRID ── */
.qsine-dl-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 20px;
}

/* ── FIELD ── */
.qsine-dl-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.qsine-dl-field label {
    font-size: 12px;
    font-weight: 700;
    color: #374151;
    letter-spacing: 0.3px;
}

.qsine-dl-field input {
    border: 1.5px solid #E5E7EB;
    border-radius: 8px;
    padding: 11px 14px;
    font-size: 14px;
    color: #1A1A2E;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #FAFAFA;
    width: 100%;
    box-sizing: border-box;
}

.qsine-dl-field input:focus {
    border-color: #6B2D8B;
    box-shadow: 0 0 0 3px rgba(107,45,139,0.1);
    background: #FFFFFF;
}

.qsine-dl-field input.qsine-dl-field-error {
    border-color: #EF4444;
    box-shadow: 0 0 0 3px rgba(239,68,68,0.1);
}

/* ── SUBMIT BUTTON ── */
.qsine-dl-submit {
    width: 100%;
    background: linear-gradient(135deg, #6B2D8B, #8B44B0);
    color: #FFFFFF;
    border: none;
    border-radius: 10px;
    padding: 15px 24px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.2s ease, transform 0.2s ease;
    letter-spacing: 0.3px;
}

.qsine-dl-submit:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
}

.qsine-dl-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ── SPINNER ── */
.qsine-dl-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: qsine-spin 0.7s linear infinite;
    display: inline-block;
}

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

/* ── PRIVACY NOTE ── */
.qsine-dl-privacy {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #9CA3AF;
    margin: 12px 0 0;
    text-align: center;
    justify-content: center;
}

/* ── SUCCESS / REDIRECT STATE ── */
.qsine-dl-success {
    text-align: center;
    padding: 10px 0 4px;
    position: relative;
    overflow: hidden;
}

/* ── PURE CSS CHECKMARK (no SVG circles) ── */
.qsine-dl-check-outer {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: #F5F0FA;
    border: 5px solid #6B2D8B;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    animation: qsine-ring-pop 0.5s cubic-bezier(0.34,1.56,0.64,1) both;
    box-sizing: border-box;
}

@keyframes qsine-ring-pop {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.qsine-dl-check-inner {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6B2D8B, #8B44B0);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: qsine-inner-pop 0.4s cubic-bezier(0.34,1.56,0.64,1) 0.25s both;
}

@keyframes qsine-inner-pop {
    from { transform: scale(0); }
    to   { transform: scale(1); }
}

/* CSS-only checkmark using borders — no SVG */
.qsine-dl-checkmark {
    width: 22px;
    height: 13px;
    border-left: 3px solid #fff;
    border-bottom: 3px solid #fff;
    transform: rotate(-45deg) translateY(-3px);
    animation: qsine-check-appear 0.3s ease 0.55s both;
}

@keyframes qsine-check-appear {
    from { opacity: 0; transform: rotate(-45deg) translateY(-3px) scale(0.5); }
    to   { opacity: 1; transform: rotate(-45deg) translateY(-3px) scale(1); }
}

/* ── NUCLEAR FORM FIELD FIX: override theme styles ── */
#qsine-dl-popup .qsine-dl-field input,
#qsine-dl-popup .qsine-dl-field input[type="text"],
#qsine-dl-popup .qsine-dl-field input[type="email"],
#qsine-dl-popup .qsine-dl-field input[type="tel"] {
    appearance: none !important;
    -webkit-appearance: none !important;
    background: #FAFAFA !important;
    background-color: #FAFAFA !important;
    color: #1A1A2E !important;
    border: 1.5px solid #E5E7EB !important;
    border-radius: 8px !important;
    padding: 11px 14px !important;
    font-size: 14px !important;
    font-family: inherit !important;
    width: 100% !important;
    box-sizing: border-box !important;
    outline: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    display: block !important;
    height: auto !important;
    line-height: normal !important;
}
#qsine-dl-popup .qsine-dl-field input:focus {
    border-color: #6B2D8B !important;
    box-shadow: 0 0 0 3px rgba(107,45,139,0.1) !important;
    background: #FFFFFF !important;
}
#qsine-dl-popup .qsine-dl-field input::placeholder {
    color: #9CA3AF !important;
    opacity: 1 !important;
}
#qsine-dl-popup .qsine-dl-field label {
    display: block !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    color: #374151 !important;
    margin-bottom: 6px !important;
    background: transparent !important;
}

/* ── TITLE ── */
.qsine-dl-success-title {
    font-size: 24px;
    font-weight: 800;
    color: #1A1A2E;
    margin: 0 0 8px;
    animation: qsine-fade-up 0.4s ease 0.8s both;
}

.qsine-dl-success-msg {
    font-size: 14px;
    color: #6B7280;
    margin: 0 0 16px;
    animation: qsine-fade-up 0.4s ease 0.9s both;
}

@keyframes qsine-fade-up {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── DOC CHIP ── */
.qsine-dl-success-doc {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(245,168,0,0.1);
    border: 1px solid rgba(245,168,0,0.35);
    color: #C47E00;
    font-size: 12px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 50px;
    margin-bottom: 24px;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    animation: qsine-fade-up 0.4s ease 1s both;
}

/* ── REDIRECT PROGRESS ── */
.qsine-dl-redirect-wrap {
    margin-bottom: 20px;
    animation: qsine-fade-up 0.4s ease 1.1s both;
}

.qsine-dl-redirect-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    color: #4A1D62;
    margin-bottom: 12px;
    min-height: 28px;
}

/* The big animated number injected via JS */
.qsine-dl-redirect-label strong {
    display: inline-block;
    font-size: 22px !important;
    font-weight: 900 !important;
    color: #6B2D8B !important;
    line-height: 1;
    animation: qsine-num-pop 0.25s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes qsine-num-pop {
    from { transform: scale(1.6); opacity: 0.4; }
    to   { transform: scale(1);   opacity: 1; }
}

.qsine-dl-redirect-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #6B2D8B;
    animation: qsine-pulse 1s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes qsine-pulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50%       { opacity: 1;   transform: scale(1.5); }
}

.qsine-dl-progress-track {
    height: 8px;
    background: #E8DFF0;
    border-radius: 50px;
    overflow: hidden;
}

.qsine-dl-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6B2D8B, #F5A800);
    border-radius: 50px;
    transition: background 0.5s ease;
    box-shadow: 0 0 10px rgba(107,45,139,0.4);
}

/* ── PARTICLES ── */
.qsine-dl-particles {
    position: absolute;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    width: 0;
    height: 0;
}

.qsine-dl-particle {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    border-radius: 50%;
    animation: qsine-particle-burst 0.8s ease-out both;
    opacity: 0;
}

@keyframes qsine-particle-burst {
    0%   { opacity: 1; transform: translate(0,0) rotate(0deg) scale(1); }
    100% {
        opacity: 0;
        transform:
            translate(
                calc(cos(var(--angle)) * var(--dist)),
                calc(sin(var(--angle)) * var(--dist))
            )
            rotate(360deg)
            scale(0);
    }
}

/* ── MANUAL FALLBACK BUTTON ── */
.qsine-dl-manual-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1.5px solid #E8DFF0;
    color: #6B7280;
    font-size: 12px;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 8px;
    text-decoration: none;
    transition: border-color 0.2s ease, color 0.2s ease;
    animation: qsine-fade-up 0.4s ease 1.3s both;
}

.qsine-dl-manual-btn:hover {
    border-color: #6B2D8B;
    color: #6B2D8B;
}

/* ════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .qsine-dl-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 767px) {
    .qsine-dl-grid { grid-template-columns: 1fr; gap: 16px; }
    .qsine-dl-popup-box { padding: 28px 20px; }
    .qsine-dl-form-grid { grid-template-columns: 1fr; }
    .qsine-dl-popup-title { font-size: 18px; }
}
