/* DocVerify Design System
   ─────────────────────────────────────────────────── */

/* ── HTMX indicators ─────────────────────────────── */
.htmx-indicator {
    display: none;
}
.htmx-request .htmx-indicator {
    display: inline-block;
}
.htmx-request.htmx-indicator {
    display: inline-block;
}

/* ── Navigation ──────────────────────────────────── */
.nav-link {
    position: relative;
}
.nav-link::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    right: 50%;
    height: 2px;
    background: #4f46e5;
    border-radius: 1px;
    transition: left 0.2s ease, right 0.2s ease;
}
.nav-link:hover::after,
.nav-link[aria-current="page"]::after {
    left: 0.75rem;
    right: 0.75rem;
}

/* ── Verify Page ─────────────────────────────────── */

/* Country tab transitions */
.country-tab {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.country-tab:not(:has(.z-10)):hover {
    transform: translateY(-2px);
}
.country-tab:active {
    transform: scale(0.98);
}

/* Country panel entrance animation */
.country-panel:not(.hidden) {
    animation: panelFadeIn 0.2s ease forwards;
}
@keyframes panelFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Verification type buttons */
.vtype-card {
    position: relative;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}
.vtype-card:hover {
    transform: translateY(-2px) scale(1.02);
}
.vtype-card:active {
    transform: scale(0.98);
}
.vtype-card.active {
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    color: #4338ca;
    border-color: #818cf8;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.2), 0 0 0 3px rgba(129, 140, 248, 0.1);
    transform: translateY(-2px);
}
.vtype-card.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #818cf8);
    border-radius: 12px 12px 0 0;
}

/* Form area transitions */
#verify-form-area {
    min-height: 0;
    transition: min-height 0.3s ease;
}
#verify-form-area:not(:empty) {
    min-height: 200px;
}
.form-enter {
    animation: formEnter 0.3s ease forwards;
}
@keyframes formEnter {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* File upload drop zone */
.file-drop-zone {
    position: relative;
    border: 2px dashed #cbd5e1;
    border-radius: 1rem;
    padding: 2.5rem 1.5rem;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}
.file-drop-zone:hover {
    border-color: #818cf8;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(129, 140, 248, 0.15);
}
.file-drop-zone:focus-within {
    border-color: #818cf8;
    box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.2);
}
.file-drop-zone.dragover {
    border-color: #4f46e5;
    border-style: solid;
    background: linear-gradient(135deg, #eef2ff 0%, #ddd6fe 100%);
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.2);
    transform: scale(1.02);
}
.file-drop-zone.has-file {
    border-color: #10b981;
    border-style: solid;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}
.file-drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* Submit button */
.verify-submit-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.verify-submit-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}
.verify-submit-btn:hover::before {
    width: 300px;
    height: 300px;
}
.verify-submit-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.4);
}
.verify-submit-btn:active {
    transform: translateY(0) scale(0.98);
}

/* Inline loading indicator (shown in result area during verification) */
.verify-loading-inline {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3rem 1rem;
}
.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e2e8f0;
    border-top-color: #4f46e5;
    border-right-color: #818cf8;
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Result card entrance */
.result-enter {
    animation: resultEnter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes resultEnter {
    from { 
        opacity: 0; 
        transform: scale(0.95) translateY(20px);
    }
    to { 
        opacity: 1; 
        transform: scale(1) translateY(0);
    }
}

.result-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    border-radius: 1rem;
    font-weight: 700;
    font-size: 0.9375rem;
    letter-spacing: 0.01em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.result-status-badge.verified {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    color: #166534;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}
.result-status-badge.not-verified {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #991b1b;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}
.result-status-badge.error {
    background: linear-gradient(135deg, #fef9c3, #fef08a);
    color: #854d0e;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

/* Success pulse animation */
@keyframes success-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
    }
}
.animate-success-pulse {
    animation: success-pulse 2s ease-in-out;
}

/* Detail field rows */
.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.625rem 0;
    border-bottom: 1px solid #f1f5f9;
}
.detail-row:last-child {
    border-bottom: none;
}

/* IBCC tabs */
.ibcc-tab {
    position: relative;
    transition: color 0.2s ease;
    padding-bottom: 0.75rem;
}
.ibcc-tab::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: transparent;
    transition: background 0.2s ease;
    border-radius: 1px;
}
.ibcc-tab.active {
    color: #4f46e5;
}
.ibcc-tab.active::after {
    background: #4f46e5;
}

/* ── Form elements ───────────────────────────────── */

.form-input {
    display: block;
    width: 100%;
    border-radius: 0.75rem;
    border: 1.5px solid #e2e8f0;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: #0f172a;
    background: white;
    transition: all 0.15s ease;
}
.form-input:hover {
    border-color: #c7d2fe;
}
.form-input:focus {
    outline: none;
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.15);
}
.form-input::placeholder {
    color: #94a3b8;
}
/* Invalid state for browser validation */
.form-input:invalid:not(:placeholder-shown):not(:focus) {
    border-color: #fca5a5;
}
select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.375rem;
    letter-spacing: 0.01em;
}

.form-hint {
    margin-top: 0.375rem;
    font-size: 0.75rem;
    color: #94a3b8;
}

/* ── Custom checkboxes (peer-based) ──────────────── */
/* The actual checkmark visibility is managed by Tailwind peer classes in HTML.
   This fallback ensures the SVGs inside the custom checkbox spans work. */
.peer:checked ~ span svg {
    opacity: 1;
}

/* ── Copy button ─────────────────────────────────── */
.copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 0.5rem;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
}
.copy-btn:hover {
    background: #f1f5f9;
    color: #475569;
}
.copy-btn:active {
    transform: scale(0.92);
}
.copy-btn.copied {
    color: #059669;
    background: #ecfdf5;
}
.copy-btn svg {
    width: 15px;
    height: 15px;
}

/* ── Screenshot image ────────────────────────────── */
.screenshot-container {
    position: relative;
    border-radius: 1rem;
    overflow: hidden;
    border: 2px solid #e2e8f0;
    background: #f8fafc;
}
.screenshot-container img {
    width: 100%;
    height: auto;
    display: block;
}

/* ── Screenshot download button ──────────────────── */
.screenshot-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 0.75rem;
    background: white;
    color: #475569;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.screenshot-download-btn:hover {
    border-color: #818cf8;
    color: #4338ca;
    background: #eef2ff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.12);
}
.screenshot-download-btn:active {
    transform: translateY(0) scale(0.98);
}
.screenshot-download-btn.downloading {
    opacity: 0.6;
    pointer-events: none;
}
.screenshot-download-btn svg {
    width: 16px;
    height: 16px;
}

/* ── Table scroll shadow (mobile affordance) ─────── */
.table-scroll-wrapper {
    position: relative;
}
.table-scroll-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 2rem;
    background: linear-gradient(to left, rgba(255,255,255,0.9), transparent);
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.2s ease;
}
/* Hide shadow when scrolled to the end */
.table-scroll-wrapper.scrolled-end::after {
    opacity: 0;
}

/* ── Focus visible ring for non-Tailwind elements ── */
*:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
    border-radius: 4px;
}
/* Override for elements that already have Tailwind focus styles */
[class*="focus-visible:ring"]:focus-visible,
[class*="focus:outline-none"]:focus-visible {
    outline: none;
}

/* ── Reduced motion ──────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
