/* ============================================================
   Vet Pet Registry – Stylesheet
   ============================================================ */


.vr-wrap *, .vr-wrap *::before, .vr-wrap *::after { box-sizing: border-box; }

/* ── header ── */
.vr-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.vr-title   { margin: 0 0 2px; font-size: 1.45rem; color: #111; }
.vr-count   { font-size: 0.8rem; color: #6b7280; }

/* ── controls row ── */
.vr-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 22px;
    position: relative;
}
.vr-search-box { position: relative; flex: 1 1 240px; min-width: 180px; }
.vr-search {
    width: 100%;
    padding: 9px 34px 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.88rem;
    outline: none;
    transition: border-color .2s;
}
.vr-search:focus { border-color: #6366f1; }
.vr-search-icon { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; }

/* ── filter icon button ── */
.vr-btn-filter-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 1rem;
    color: #6b7280;
    transition: border-color .2s, background .2s;
}
.vr-btn-filter-icon:hover { border-color: #6366f1; background: #eef2ff; color: #6366f1; }
.vr-btn-filter-icon.active { border-color: #6366f1; background: #6366f1; color: #fff; }
.vr-filter-dot {
    position: absolute;
    top: -4px; right: -4px;
    width: 9px; height: 9px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid #fff;
    display: none;
}
.vr-btn-filter-icon.has-filter .vr-filter-dot { display: block; }

/* ── filter popup panel ── */
.vr-filter-popup {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0,0,0,.14);
    padding: 16px;
    z-index: 500;
    display: none;
}
.vr-filter-popup.vr-filter-open { display: block; }
.vr-filter-popup-title {
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #6b7280;
    margin: 0 0 12px;
}
.vr-filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr auto;
    gap: 10px;
    align-items: end;
}
.vr-filter-group { display: flex; flex-direction: column; gap: 4px; }
.vr-filter-group label { font-size: 0.74rem; font-weight: 600; color: #374151; }
.vr-filters { display: none; }

.vr-select {
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.84rem;
    background: #fff;
    outline: none;
    width: 100%;
    cursor: pointer;
}
.vr-select:focus { border-color: #6366f1; }

.vr-daterange { display: flex; align-items: center; gap: 4px; }
.vr-dateinput {
    padding: 8px 8px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.8rem;
    width: 100%;
    outline: none;
}
.vr-dateinput:focus { border-color: #6366f1; }
.vr-daterange span { color: #9ca3af; }

/* ── buttons ── */
.vr-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 15px;
    border: none;
    border-radius: 8px;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .18s, transform .1s;
    white-space: nowrap;
    font-family: inherit;
}
.vr-btn:active { transform: scale(.96); }
@media (max-width: 768px) {
    .vr-btn-add {
        position: fixed !important;
        bottom: 0px !important;
        left: 0px !important;
        right: 0px !important;
        padding: 20px !important;
        font-size: 18px !important;
        height: 10px !important;
        background-color: #007bff !important;
        color: white !important;
        border: none !important;
        cursor: pointer !important;
        z-index: 1000 !important;
        text-align: center !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
}
.vr-btn-add    { background: #6366f1; color: #fff; padding: 9px 18px; font-size: 0.88rem; }
.vr-btn-add:hover { background: #4f46e5; }

.vr-btn-clear  { background: transparent; color: #6b7280; border: 1px solid #d1d5db; font-size: 0.76rem; padding: 6px 10px; }
.vr-btn-clear:hover { background: #f3f4f6; }

.vr-btn-upload { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; font-size: 0.8rem; }
.vr-btn-upload:hover { background: #e5e7eb; }

.vr-btn-cancel { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }
.vr-btn-cancel:hover { background: #e5e7eb; }

.vr-btn-save   { background: #6366f1; color: #fff; }
.vr-btn-save:hover { background: #4f46e5; }
.vr-btn-save:disabled { background: #a5b4fc; cursor: not-allowed; }

.vr-btn-edit   { background: #6366f1; color: #fff; font-size: 0.76rem; padding: 5px 10px; }
.vr-btn-edit:hover { background: #4f46e5; }

.vr-btn-del    { background: #ef4444; color: #fff; font-size: 0.76rem; padding: 5px 10px; }
.vr-btn-del:hover { background: #dc2626; }

/* ── card grid ── */
.vr-grid {
    display: grid;
    grid-template-columns: repeat( auto-fill, minmax(270px, 1fr) );
    gap: 16px;
    min-height: 60px;
}
.vr-empty {
    text-align: center;
    padding: 52px 20px;
    color: #6b7280;
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    border-radius: 12px;
    font-size: 0.92rem;
}

/* ── card ── */
.vr-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: box-shadow .2s, transform .15s;
}
.vr-card:hover {
    box-shadow: 0 4px 18px rgba(99,102,241,.18);
    transform: translateY(-2px);
}

.vr-card-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 14px 6px;
}
.vr-card-thumb {
    width: 62px; height: 62px;
    border-radius: 10px;
    object-fit: cover;
    border: 2px solid #e5e7eb;
    flex-shrink: 0;
    background: #f3f4f6;
}
.vr-card-thumb-ph {
    width: 62px; height: 62px;
    border-radius: 10px;
    background: #f3f4f6;
    border: 2px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.55rem;
    flex-shrink: 0;
}

.vr-card-info { flex: 1; min-width: 0; }
.vr-card-name {
    font-weight: 700;
    font-size: 0.97rem;
    color: #111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 0 3px;
}
.vr-card-petid {
    font-size: 0.68rem;
    font-weight: 700;
    font-family: monospace;
    color: #6366f1;
    background: #eef2ff;
    padding: 2px 7px;
    border-radius: 20px;
    display: inline-block;
}
.vr-badge-cases {
    font-size: 0.66rem;
    font-weight: 600;
    color: #059669;
    background: #d1fae5;
    padding: 2px 6px;
    border-radius: 20px;
    margin-left: 6px;
    display: inline-block;
}

.vr-card-rows { padding: 4px 14px 10px; flex: 1; }
.vr-card-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    padding: 3px 0;
    border-bottom: 1px solid #f3f4f6;
}
.vr-card-row:last-child { border-bottom: none; }
.vr-card-lbl { color: #6b7280; }
.vr-card-val { color: #374151; font-weight: 500; text-align: right; max-width: 58%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.vr-card-foot {
    padding: 9px 14px;
    border-top: 1px solid #f3f4f6;
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

/* ── pagination ── */
.vr-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-top: 24px;
    flex-wrap: wrap;
    margin-bottom:60px;
}
.vr-pg {
    min-width: 34px; height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s;
}
.vr-pg:hover { background: #f3f4f6; border-color: #6366f1; }
.vr-pg.active { background: #6366f1; color: #fff; border-color: #6366f1; }
.vr-pg:disabled { opacity: .35; cursor: not-allowed; }
.vr-pg-dots { border: none; background: transparent; cursor: default; opacity: .5; }
.vr-pg-info { font-size: 0.76rem; color: #6b7280; margin-left: 10px; }

/* ── modals ── */
.vr-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.42);
    z-index: 9990;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.vr-modal {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0,0,0,.28);
}
.vr-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px 12px;
    border-bottom: 1px solid #f3f4f6;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
}
.vr-modal-head h3 { margin: 0; font-size: 1.12rem; color: #111; }
.vr-modal-x {
    background: none; border: none;
    font-size: 1.55rem; color: #6b7280;
    cursor: pointer; line-height: 1;
    padding: 0 4px;
}
.vr-modal-x:hover { color: #111; }
.vr-modal-body { padding: 20px 22px; }
.vr-modal-foot {
    padding: 14px 22px;
    border-top: 1px solid #f3f4f6;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ── view popup inner ── */
.vr-view-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.vr-view-header .vr-card-name { font-size: 1.2rem; white-space: normal; }

.vr-view-sec { margin-bottom: 14px; }
.vr-view-sec-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #6b7280;
    margin: 0 0 6px;
}
.vr-view-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 16px;
}
.vr-view-grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px 14px;
}
.vr-vi { display: flex; flex-direction: column; padding: 4px 0; }
.vr-vi-label { font-size: 0.68rem; color: #9ca3af; line-height: 1.2; }
.vr-vi-value { font-size: 0.82rem; color: #374151; font-weight: 500; line-height: 1.3; }
.vr-vi.vr-wide { grid-column: 1 / -1; }
.vr-view-photo {
    max-width: 100px;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    margin-top: 4px;
}

/* ── form inside modal ── */
.vr-section { margin-bottom: 12px; }
.vr-section-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #374151;
    margin: 0 0 7px;
    padding-bottom: 4px;
    border-bottom: 2px solid #eef2ff;
}
.vr-ast { color: #ef4444; }

/* Always 2-col on ALL screen sizes including mobile */
.vr-fgrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
}

.vr-fgroup { display: flex; flex-direction: column; }

/* Only address + photo use full width */
.vr-fgroup.vr-wide { grid-column: 1 / -1; }

/* Invisible spacer: keeps Email in col-1, pushes Address to its own full-width row */
.vr-hidden-spacer {
    visibility: hidden;
    pointer-events: none;
}

.vr-fgroup label { font-size: 0.76rem; font-weight: 600; color: #374151; margin-bottom: 2px; }
.vr-fgroup input,
.vr-fgroup select,
.vr-fgroup textarea {
    padding: 6px 9px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.84rem;
    color: #374151;
    background: #fff;
    outline: none;
    font-family: inherit;
    transition: border-color .2s;
}
.vr-fgroup input:focus,
.vr-fgroup select:focus,
.vr-fgroup textarea:focus { border-color: #6366f1; }
.vr-fgroup textarea { resize: vertical; }

/* locked fields */
.vr-fgroup input.locked,
.vr-fgroup select.locked {
    background: #f3f4f6;
    color: #6b7280;
    cursor: not-allowed;
    border-color: #e5e7eb;
}

/* lock banner */
.vr-lock-banner {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.78rem;
    color: #92400e;
    margin-bottom: 10px;
}

/* image preview */
.vr-img-preview { margin-top: 8px; min-height: 30px; }
.vr-img-preview img { max-width: 140px; max-height: 130px; border-radius: 8px; border: 2px solid #e5e7eb; }
.vr-img-remove { background: none; border: none; color: #ef4444; font-size: 0.73rem; cursor: pointer; display: block; margin-top: 4px; padding: 0; }
.vr-img-remove:hover { text-decoration: underline; }

.vr-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid #f3f4f6;
    margin-top: 4px;
}

/* ── spinner ── */
.vr-spinner-wrap {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,.55);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.vr-spinner {
    width: 38px; height: 38px;
    border: 4px solid #e5e7eb;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: vr-spin .65s linear infinite;
}
@keyframes vr-spin { to { transform: rotate(360deg); } }

/* ── toast ── */
.vr-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(90px);
    background: #1f2937;
    color: #fff;
    padding: 11px 22px;
    border-radius: 10px;
    font-size: 0.83rem;
    font-weight: 500;
    z-index: 11000;
    transition: transform .28s ease, opacity .28s;
    opacity: 0;
    pointer-events: none;
    max-width: 88vw;
    text-align: center;
    box-shadow: 0 4px 14px rgba(0,0,0,.3);
}
.vr-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.vr-toast.ok   { background: #059669; }
.vr-toast.err  { background: #dc2626; }

/* ── responsive ── */
@media (max-width: 620px) {
    /* Card grid stacks to 1 col on small phones */
    .vr-grid        { grid-template-columns: 1fr; }
    /* View popup grids stay 2-col */
    .vr-view-grid   { grid-template-columns: 1fr 1fr; }
    .vr-view-grid-3 { grid-template-columns: 1fr 1fr; }
    /* Filter popup stacks to 2-col */
    .vr-filter-row  { grid-template-columns: 1fr 1fr; }
    .vr-header      { flex-direction: column; align-items: flex-start; }
    .vr-overlay     { align-items: flex-end; padding: 0; }
    .vr-modal       { border-radius: 14px 14px 0 0; max-height: 92vh; }
    /* NOTE: vr-fgrid intentionally stays 1fr 1fr on mobile — no override here */
}