/* ================================================
   Download Document – Frontend Styles
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Wrapper */
.dd-search-wrapper {
    display: flex;
    justify-content: center;
    padding: 40px 16px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Card */
.dd-search-card {
    width: 100%;
    max-width: 480px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.07),
        0 10px 30px -5px rgba(0, 0, 0, 0.1);
    padding: 40px 36px;
    position: relative;
    overflow: hidden;
}

/* Decorative top gradient bar */
.dd-search-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #a855f7);
}

/* Header */
.dd-search-header {
    text-align: center;
    margin-bottom: 32px;
}

.dd-icon-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    border-radius: 14px;
    color: #6366f1;
    margin-bottom: 16px;
}

.dd-search-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: #1e1b4b;
    margin: 0 0 8px;
    line-height: 1.3;
}

.dd-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}

/* Form */
.dd-search-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dd-field-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

.dd-input-wrap {
    position: relative;
}

.dd-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
    transition: color 0.2s;
}

.dd-input-wrap input {
    width: 100%;
    padding: 12px 14px 12px 44px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    color: #111827;
    background: #fafafa;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.dd-input-wrap input::placeholder {
    color: #b0b3b8;
}

.dd-input-wrap input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
    background: #fff;
}

.dd-input-wrap input:focus + .dd-input-icon,
.dd-input-wrap input:focus ~ .dd-input-icon {
    color: #6366f1;
}

/* Focus icon color – reverse sibling doesn't work, handled via JS */

.dd-input-wrap.dd-focus .dd-input-icon {
    color: #6366f1;
}

/* Submit button */
.dd-submit-btn {
    width: 100%;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.dd-submit-btn:hover {
    background: linear-gradient(135deg, #4f46e5, #6d28d9);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}

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

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

/* Spinner */
.dd-spinner {
    width: 18px;
    height: 18px;
    animation: dd-spin 0.8s linear infinite;
}

.dd-spinner circle {
    stroke: #fff;
    stroke-dasharray: 80;
    stroke-dashoffset: 60;
    stroke-linecap: round;
}

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

/* Result area */
.dd-result {
    margin-top: 24px;
    border-radius: 10px;
    padding: 20px;
    animation: dd-fadeIn 0.35s ease;
}

@keyframes dd-fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Success result */
.dd-result.dd-success {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border: 1px solid #a7f3d0;
}

.dd-result-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.dd-result-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dd-success .dd-result-icon {
    background: #10b981;
    color: #fff;
}

.dd-result-title {
    font-size: 15px;
    font-weight: 600;
    color: #064e3b;
    margin: 0;
}

.dd-result-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #065f46;
}

.dd-result-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dd-download-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #10b981;
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.dd-download-link:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

/* Error result */
.dd-result.dd-error {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 1px solid #fecaca;
}

.dd-error .dd-result-icon {
    background: #ef4444;
    color: #fff;
}

.dd-error .dd-result-title {
    color: #991b1b;
}

.dd-error-message {
    font-size: 14px;
    color: #7f1d1d;
    margin: 0;
    line-height: 1.5;
}

/* Responsive */
@media (max-width: 540px) {
    .dd-search-card {
        padding: 28px 20px;
    }

    .dd-search-header h2 {
        font-size: 19px;
    }

    .dd-preview-canvas-wrap {
        padding: 12px;
    }
}

/* ================================================
   PDF Preview Section
   ================================================ */

.dd-preview {
    margin-top: 24px;
    animation: dd-fadeIn 0.35s ease;
}

.dd-preview-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f0f4ff, #e8ecff);
    border: 1px solid #c7d2fe;
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    color: #4338ca;
    font-size: 14px;
    font-weight: 600;
}

.dd-preview-canvas-wrap {
    position: relative;
    background: #f8f9fb;
    border: 1px solid #c7d2fe;
    border-radius: 0 0 10px 10px;
    padding: 20px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Loading state */
.dd-preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #6366f1;
    font-size: 13px;
    font-weight: 500;
}

.dd-spinner-preview {
    width: 32px;
    height: 32px;
}

.dd-spinner-preview circle {
    stroke: #6366f1;
}

/* Canvas styling */
#dd-pdf-canvas {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(0, 0, 0, 0.04);
}

