/* ============================================================
   VTK add-in task panes — "Minimalist Modern" design system.
   Shared by the photos page (Home) and documents page (Doc).
   Scoped to .vtk-pane. Tokens here are the single source of
   truth for the pane look.
   ============================================================ */

.vtk-pane {
    /* --- Design tokens --- */
    --background: #FAFAFA;
    --foreground: #0F172A;
    --muted: #F1F5F9;
    --muted-foreground: #64748B;
    --accent: #0052FF;
    --accent-secondary: #4D7CFF;
    --accent-foreground: #FFFFFF;
    --border: #E2E8F0;
    --card: #FFFFFF;

    position: relative;
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--foreground);
    padding: 8px 2px 28px;
    overflow-x: hidden;
}

/* Ambient accent glow — texture over flatness */
.vtk-pane::before {
    content: "";
    position: absolute;
    top: -80px;
    right: -80px;
    width: 220px;
    height: 220px;
    background: var(--accent);
    opacity: 0.06;
    filter: blur(90px);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

.vtk-pane > * {
    position: relative;
    z-index: 1;
}

/* --- Header (optional, currently unused on both panes) --- */
.vtk-pane .pane-header {
    margin-bottom: 22px;
    animation: paneFadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.section-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(0, 82, 255, 0.3);
    background: rgba(0, 82, 255, 0.05);
    border-radius: 999px;
    padding: 5px 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent);
}

.section-label .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    animation: panePulse 2s ease-in-out infinite;
}

.pane-title {
    font-family: 'Calistoga', Georgia, serif;
    font-weight: 400;
    font-size: 1.7rem;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: 14px 0 4px;
}

.gradient-text {
    background: linear-gradient(to right, var(--accent), var(--accent-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.pane-sub {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--muted-foreground);
}

/* --- Photos / Documents segmented toggle --- */
.pane-toggle {
    display: flex;
    gap: 4px;
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 18px;
}

.pane-toggle-btn {
    flex: 1 1 50%;
    text-align: center;
    padding: 9px 8px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted-foreground);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.pane-toggle-btn:hover:not(.is-active) {
    color: var(--foreground);
}

.pane-toggle-btn.is-active {
    background: linear-gradient(to right, var(--accent), var(--accent-secondary));
    color: var(--accent-foreground);
    box-shadow: 0 2px 8px rgba(0, 82, 255, 0.25);
    cursor: default;
}

/* --- Loading spinner --- */
.pane-spinner {
    width: 34px;
    height: 34px;
    margin: 40px auto;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: paneSpin 0.8s linear infinite;
}

/* --- Form --- */
.pane-form {
    animation: paneFadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.field {
    margin-bottom: 16px;
}

.field-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted-foreground);
    margin-bottom: 7px;
}

/* --- Inputs --- */
.input {
    width: 100%;
    height: 46px;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--card);
    padding: 0 13px;
    font-family: inherit;
    font-size: 15px;
    color: var(--foreground);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input::placeholder {
    color: var(--muted-foreground);
    opacity: 0.6;
}

.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 82, 255, 0.15);
}

.select {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    padding-right: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
}

/* Asset lookup row: input + icon button */
.asset-row {
    display: flex;
    gap: 8px;
}

.asset-row .input {
    flex: 1 1 auto;
    min-width: 0;
}

.btn-icon {
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--card);
    color: var(--muted-foreground);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    border-color: rgba(0, 82, 255, 0.4);
    color: var(--accent);
    box-shadow: 0 4px 14px rgba(0, 82, 255, 0.12);
}

.btn-icon:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 82, 255, 0.15);
}

.btn-icon:active {
    transform: scale(0.96);
}

/* --- Vehicle info surface --- */
.vehicle-info {
    display: grid;
    grid-template-columns: 0.7fr 1.5fr 1.1fr; /* Year narrow, Make widest, Model medium */
    gap: 10px;
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 16px;
}

.vehicle-info > div {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.vi-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted-foreground);
}

.vi-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Loading skeleton shown while the asset lookup is in flight */
.vi-value.is-loading {
    display: block;
    width: 88%;
    height: 13px;
    margin-top: 3px;
    border-radius: 4px;
    color: transparent;
    background: linear-gradient(90deg, #E2E8F0 25%, #EEF3F9 37%, #E2E8F0 63%);
    background-size: 400% 100%;
    animation: paneShimmer 1.3s ease-in-out infinite;
}

@keyframes paneShimmer {
    0%   { background-position: 100% 0; }
    100% { background-position: 0 0; }
}

/* --- Primary button (signature gradient) --- */
.btn-primary {
    width: 100%;
    height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: none;
    border-radius: 13px;
    background: linear-gradient(to right, var(--accent), var(--accent-secondary));
    color: var(--accent-foreground);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    margin: 4px 0 18px;
}

.btn-primary svg {
    transition: transform 0.2s ease;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 82, 255, 0.35);
    filter: brightness(1.07);
}

.btn-primary:hover:not(:disabled) svg {
    transform: translateX(3px);
}

.btn-primary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 82, 255, 0.25);
}

.btn-primary:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-primary:disabled {
    background: var(--muted);
    color: var(--muted-foreground);
    box-shadow: none;
    cursor: not-allowed;
}

/* --- Top row: Photos/Documents toggle + Split & file pop-out button --- */
.pane-top {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 18px;
}

.pane-top .pane-toggle {
    flex: 1 1 auto;
    margin-bottom: 0;
}

/* --- Notices --- */
.notice {
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 13px;
    color: var(--muted-foreground);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* --- FilePond theming --- */
.vtk-pane .filepond--root {
    font-family: 'Inter', system-ui, sans-serif;
    margin-top: 2px;
    margin-bottom: 0;
}

.vtk-pane .filepond--panel-root {
    background: var(--card);
    border: 1.5px dashed var(--border);
    border-radius: 14px;
}

.vtk-pane .filepond--root:hover .filepond--panel-root {
    border-color: rgba(0, 82, 255, 0.45);
    background: rgba(0, 82, 255, 0.02);
}

.vtk-pane .filepond--drop-label {
    color: var(--muted-foreground);
    font-size: 14px;
    /* Extra room below the paste hint so the master select-all checkbox (positioned by
       JS in this band) clears both the hint above and the first item below. */
    padding-bottom: 34px;
}

.vtk-pane .filepond--label-action {
    color: var(--accent);
    font-weight: 600;
    text-decoration-color: rgba(0, 82, 255, 0.4);
}

.vtk-pane .paste-hint {
    margin-top: 9px;
    font-size: 12px;
    color: var(--muted-foreground);
}

.vtk-pane .paste-hint kbd {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 1px 6px;
    color: var(--foreground);
}

.vtk-pane .filepond--item-panel {
    border-radius: 10px;
}

/* Hide the filename label overlaid on each preview */
.vtk-pane .filepond--file-info-main {
    display: none;
}

/* Shift the size label clear of the selection checkbox (top-left) */
.vtk-pane .filepond--file-info {
    padding-left: 40px;
}

/* Replace FilePond's remove (X) button with an "include in upload" checkbox */
.vtk-pane .filepond--action-remove-item {
    display: none;
}

.vtk-pane .vtk-select {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 11;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 6px;
    padding: 4px;
    cursor: pointer;
}

.vtk-pane .vtk-select input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--accent);
}

/* Dim previews that won't be uploaded */
.vtk-pane .filepond--item.vtk-unselected .filepond--image-preview {
    opacity: 0.35;
}

/* Master select-all checkbox bar, positioned by JS in the gap above the first item and
   left-aligned with the per-item checkboxes. pointer-events: none lets drag/drop fall
   through to the card; the checkbox itself re-enables it. */
.vtk-pane .select-all-bar {
    position: absolute;
    left: 12px;
    right: 12px;
    z-index: 6;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    pointer-events: none;
}

/* Reuse the per-item .vtk-select look, but sit in flow within the bar (not absolute) */
.vtk-pane .vtk-select-all {
    position: static;
    top: auto;
    left: auto;
    pointer-events: auto;
}

.vtk-pane .filepond--drip-blob {
    background: var(--accent);
}

/* --- Animations --- */
@keyframes paneFadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

@keyframes panePulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.35); opacity: 0.6; }
}

@keyframes paneSpin {
    to { transform: rotate(360deg); }
}

/* --- Automatic dark mode (follows the OS/browser setting; no toggle) --- */
@media (prefers-color-scheme: dark) {
    /* Neutral grays to match Outlook's dark theme (not a blue slate).
       pane.css only loads on the task panes, so this won't darken other pages. */
    body {
        background: #1f1f1f;
    }

    .vtk-pane {
        --background: #1f1f1f;       /* matches Outlook dark canvas */
        --foreground: #ffffff;
        --muted: #2d2d2d;            /* lifted surfaces */
        --muted-foreground: #adadad;
        --accent: #4D7CFF;           /* lighter blue reads better on dark */
        --accent-secondary: #6F9BFF;
        --border: #404040;
        --card: #2d2d2d;
    }

    /* The loading skeleton uses literal light colors — retint for dark surfaces. */
    .vtk-pane .vi-value.is-loading {
        background: linear-gradient(90deg, #2d2d2d 25%, #404040 37%, #2d2d2d 63%);
        background-size: 400% 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .vtk-pane *,
    .vtk-pane *::before,
    .vtk-pane *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* Click a preview to enlarge it in an Office dialog (hint the affordance) */
.vtk-pane .filepond--image-preview { cursor: zoom-in; }
