:root {
    --primary-blue: #0ea5e9;
    --primary-blue-rgb: 14 165 233;
    --primary-blue-light: #7dd3fc;
    --primary-blue-dark: #0369a1;
    --primary-green: #10b981;
    --primary-green-rgb: 16 185 129;
    --primary-green-dark: #059669;
    --primary-orange: #ff7a00;
    --primary-orange-rgb: 255 122 0;
    --primary-orange-strong: #e85a00;
    --bg-900: #071029;
    --bg-800: #0b1220;
}

/* Map common Tailwind 'indigo' utility classes to the new blue palette */
[class*="text-indigo"] { color: var(--primary-blue-light) !important; }
[class*="from-indigo"] { --tw-gradient-from: var(--primary-blue-light) !important; }
[class*="to-indigo"] { --tw-gradient-to: var(--primary-blue) !important; }
[class*="bg-indigo"] { background-color: var(--primary-blue) !important; }
[class*="border-indigo"] { border-color: var(--primary-blue) !important; }
[class*="hover:shadow-indigo"] { box-shadow: 0 10px 15px -3px rgba(37,99,235,0.3) !important; }


html {
    scroll-behavior: smooth;
}

nav {
    background-color: rgba(7,10,25,0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

body {
    font-family: 'DM Sans', sans-serif;
    /* prominent blue -> green -> orange gradient layered over dark base */
    /* fallback solid background to avoid a white page if complex gradients are stripped */
    background-color: var(--bg-800) !important;
    background: linear-gradient(135deg, rgba(var(--primary-blue-rgb),0.08), rgba(var(--primary-green-rgb),0.06) 40%, rgba(var(--primary-orange-rgb),0.05) 75%), radial-gradient(800px circle at 10% 10%, rgba(var(--primary-blue-rgb),0.03), transparent 12%), linear-gradient(180deg, var(--bg-900), var(--bg-800));
    background-attachment: fixed;
    color: #e6eef6;
}

.tool-card {
    transition: transform 0.25s cubic-bezier(.2,.8,.2,1), box-shadow 0.25s ease-in-out, background-image 0.35s ease, color 0.18s ease;
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 12px;
    background-color: rgba(255,255,255,0.02);
    box-shadow: 0 4px 10px rgba(2,6,23,0.6);
    overflow: hidden;
}

.tool-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 24px 60px -20px rgba(var(--primary-blue-rgb),0.18), 0 10px 30px rgba(0,0,0,0.55);
    border-color: rgba(var(--primary-blue-rgb),0.2);
    background-image: linear-gradient(135deg, rgba(var(--primary-blue-rgb),0.06), rgba(var(--primary-green-rgb),0.06) 50%, rgba(var(--primary-orange-rgb),0.06) 85%);
    color: #ffffff;
}

.tool-card:hover h3,
.tool-card:hover p,
.tool-card:hover a,
.tool-card:hover .pill {
    color: #ffffff;
}

.btn {
    transition: background-color 0.2s ease-in-out, transform 0.1s ease-in-out;
}

.btn:active {
    transform: scale(0.98);
}

/* Custom file input */
input[type="file"]::file-selector-button {
    @apply bg-indigo-600 text-white font-semibold py-2 px-4 rounded-lg cursor-pointer hover:bg-indigo-700 transition-colors duration-200 mr-4;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1f2937;
}

::-webkit-scrollbar-thumb {
    background-image: linear-gradient(180deg, var(--primary-green), var(--primary-blue));
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background-image: linear-gradient(180deg, var(--primary-orange), var(--primary-blue-dark));
}

/* Style for drag-and-drop placeholder */
.sortable-ghost {
    opacity: 0.4;
    border: 2px dashed var(--primary-blue);
}

#embed-pdf-container>div {
    width: 100%;
    height: 100%;
}

#tool-interface {
    color: var(--primary-blue);
}

.page-thumbnail,
#file-list>li {
    cursor: grab;
}

.sortable-chosen {
    cursor: grabbing;
}

.compare-viewer-wrapper.overlay-mode {
    position: relative;
    width: 100%;
    height: 75vh;
    overflow: auto;
    border: 2px solid #374151;
    border-radius: 0.5rem;
    background-color: #1f2937;
}

/* This rule now ONLY applies to canvases in overlay mode */
.compare-viewer-wrapper.overlay-mode canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
}

.compare-viewer-wrapper.side-by-side-mode {
    display: flex;
    gap: 1rem;
    width: 100%;
}

.pdf-panel {
    flex: 1;
    min-width: 0;
    overflow: auto;
    height: 75vh;
    border: 2px solid #374151;
    border-radius: 0.5rem;
    background-color: #1f2937;
}

/* This rule ensures canvases in side-by-side panels display at their natural rendered size. */
.pdf-panel canvas {
    display: block;
    margin: 0 auto;
}

footer a {
    transition: color 0.2s ease-in-out;
}

.marker {
    position: relative;
    display: inline-block;
}

marker::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    /* height: 30px; */
    background-color: var(--primary-orange);
    /* Orange marker color */
    z-index: -1;
    transform: skew(-20deg);
}

.pill {
    background-color: #374151;
    /* bg-gray-700 */
    color: #d1d5db;
    /* text-gray-300 */
    padding: 8px 16px;
    border-radius: 9999px;
    /* rounded-full */
    font-size: 14px;
    font-weight: 500;
}

.cta-button {
    background-image: linear-gradient(90deg, var(--primary-blue-light), var(--primary-green) 60%, var(--primary-orange) 90%);
    color: white;
    font-weight: 700;
    padding: 14px 28px;
    border-radius: 12px;
    transition: transform 0.12s ease, box-shadow 0.18s ease;
    box-shadow: 0 8px 30px rgba(14,165,233,0.12), 0 2px 8px rgba(16,185,129,0.04);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 40px rgba(14,165,233,0.14), 0 8px 24px rgba(255,122,0,0.06);
}

.marker-text {
    background-color: rgba(255, 122, 0, 0.12);
    /* Orange marker color */
    padding: 0 5px;
    color: #fff;
    border-radius: 4px;
}

.feature-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
    padding: 24px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.03);
    box-shadow: 0 6px 18px rgba(2,6,23,0.5);
}

.feature-card:hover {
    transform: translateY(-6px);
    background-image: linear-gradient(135deg, rgba(var(--primary-blue-rgb),0.03), rgba(var(--primary-green-rgb),0.03) 50%, rgba(var(--primary-orange-rgb),0.03) 85%);
    box-shadow: 0 18px 40px -10px rgba(var(--primary-blue-rgb),0.08), 0 6px 20px rgba(0,0,0,0.45);
    border-color: rgba(255,255,255,0.04);
}

.nav-link {
    @apply text-gray-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium transition-colors;
}

.mobile-nav-link {
    @apply text-gray-300 hover:bg-gray-700 hover:text-white block px-3 py-2 rounded-md text-base font-medium transition-colors;
}

.marker-slanted {
    position: relative;
    display: inline-block;
}

marker-slanted::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 6px;
    background: linear-gradient(120deg, var(--primary-blue-light), var(--primary-green), var(--primary-orange));
    z-index: -1;
}

.section-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, var(--primary-blue), var(--primary-green) 60%, var(--primary-orange) 80%, transparent);
    /* Fades from transparent to primary blue and back */
    margin: 2rem auto;
    /* my-16 */
    max-width: 42rem;
    /* max-w-xl */
    opacity: 0.5;
}

.btn-gradient {
    display: inline-block;
    padding: 0.75rem 2rem;
    border-radius: 12px;
    background-image: linear-gradient(90deg, var(--primary-green), var(--primary-blue) 60%, var(--primary-orange));
    color: #ffffff;
    font-weight: 700;
    transition: transform 0.15s ease, box-shadow 0.18s ease;
    transform: translateY(0);
}

.btn-gradient:hover {
    box-shadow: 0 18px 40px -10px rgba(14,165,233,0.18), 0 6px 20px rgba(2,6,23,0.35);
    transform: translateY(-0.25rem);
}

.btn-gradient:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px #111827, 0 0 0 4px var(--primary-blue-light);
}

.btn-gradient:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.solid-spinner {
    width: 64px;
    /* w-16 */
    height: 64px;
    /* h-16 */
    border: 5px solid #374151;
    /* border-gray-700 */
    border-bottom-color: var(--primary-green);
    /* border primary blue */
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

#signature-ghost {
    position: absolute;
    z-index: 100;
    pointer-events: none;
    /* Allows clicks to pass through to the canvas */
    opacity: 0.6;
    background-size: contain;
    background-repeat: no-repeat;
}

/* Highlight for selected signature in the saved list */
.saved-signature.selected {
    border-color: var(--primary-blue);
    /* highlight */
    box-shadow: 0 0 10px rgba(var(--primary-blue-rgb), 0.5);
}

/* Cursor change when hovering over a placed signature */
#canvas-sign.movable {
    cursor: move;
}

#canvas-sign.resize-ns {
    cursor: ns-resize;
}

#canvas-sign.resize-ew {
    cursor: ew-resize;
}

#canvas-sign.resize-nesw {
    cursor: nesw-resize;
}

#canvas-sign.resize-nwse {
    cursor: nwse-resize;
}

.faq-item.open .faq-question {
    color: var(--primary-blue-light);
    /* accent */
}

.faq-item.open .faq-icon {
    transform: rotate(180deg);
}

/* Testimonial Card Styles removed */

.pill {
    background: linear-gradient(90deg, rgba(14,165,233,0.06), rgba(16,185,129,0.04));
    color: #e6eef6;
    padding: 6px 12px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(255,255,255,0.02);
}

/* On small screens (640px) and up, revert to the larger size */
@media (min-width: 640px) {
    .pill {
        padding: 8px 16px;
        font-size: 14px;
    }
}

/* Ensure form-field-group contents don't overflow on small screens */
.form-field-group .capitalize {
    word-break: break-all;
}

@media (max-width: 1023px) {
    #form-fields-container {
        overflow-x: auto;
        white-space: nowrap;
    }

    .form-field-group {
        display: inline-block;
        width: 90%;
        /* Adjust as needed */
        margin-right: 1rem;
    }
}

#page-merge-preview {
    display: grid;
    gap: 1rem;
    padding: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
}

.legal-content h2 {
    font-size: 1.5rem;
    line-height: 2rem;
    font-weight: 700;
    color: white;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.legal-content h3 {
    font-size: 1.25rem;
    line-height: 1.75rem;
    font-weight: 600;
    color: var(--primary-blue-light);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.legal-content p {
    margin-bottom: 1rem;
    line-height: 1.625;
    color: rgb(156 163 175);
}

.legal-content ul {
    list-style-type: disc;
    list-style-position: inside;
    margin-bottom: 1rem;
    padding-left: 1rem;
    color: rgb(156 163 175);
}

.legal-content a {
    color: var(--primary-blue-light);
    text-decoration: underline;
}

.legal-content a:hover {
    color: var(--primary-green);
}

details>summary {
    list-style: none;
}

details>summary::-webkit-details-marker {
    display: none;
}

details>summary .icon {
    transition: transform 0.2s ease-in-out;
}

details[open]>summary .icon {
    transform: rotate(45deg);
}
