/* Shared pet form styling — inspired by EditPet page.
   Used by Report Lost Pet, Report Found Pet, Report Sighting and similar forms. */

.pf-page {
    max-width: 1200px;
    margin: 0 auto;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e293bf2 10%, #3341557d 100%);
    overflow: hidden;
}

.pf-back-link {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.875rem;
    color: #e2e8f0;
}

.pf-back-link:hover {
    color: #93c5fd;
    font-weight: bolder;
    text-decoration: underline;
}

.pf-back-icon {
    margin-right: 0.5rem;
}

.pf-page-header {
    padding: 10px 20px 5px 20px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    color: #ffde59;
}

.pf-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 10px;
}

.pf-header-left {
    display: flex;
    flex-direction: column;
}

.pf-header-right {
    display: flex;
    flex-direction: row;
    gap: 5px;
}

.pf-page-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
}

.pf-page-subtitle {
    font-size: 0.9rem;
    color: #cbd5e1;
    margin: 0 0 0.25rem 0;
}

.pf-header-btn {
    backdrop-filter: blur(10px);
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.pf-header-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    font-weight: bolder;
}

.pf-header-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.pf-header-save-btn {
    background: #3b82f6;
    color: #ffffff;
}

.pf-header-save-btn:hover {
    background: #2563eb;
    color: #ffffff;
}

.pf-header-cancel-btn {
    background: #64748b;
    color: #ffffff;
}

/* Main body — white content card below the dark header. */
.pf-main {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 1.5rem;
    min-height: 300px;
}

.pf-section {
    margin-bottom: 1.75rem;
}

.pf-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.pf-section-header h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: #1e293b;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
    width: 100%;
}

.pf-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.pf-form-grid-wide {
    grid-column: 1 / -1;
}

.pf-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.pf-form-group label {
    display: block;
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    color: #374151;
}

/* Floating label container.
   Structure: <div class="pf-float"><input class="pf-control" placeholder=" " /><label>Pet name *</label></div>
   The label MUST come AFTER the input for the adjacent-sibling selector to work. */
.pf-float {
    position: relative;
    display: block;
}

.pf-control {
    width: 100%;
    padding: 1.05rem 0.75rem 0.4rem 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.35rem;
    font-size: 0.95rem;
    background-color: #ffffff;
    color: #1e293b;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.pf-control::placeholder {
    color: transparent;
}

.pf-control:focus {
    outline: none;
    border-color: #93c5fd;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

textarea.pf-control {
    resize: vertical;
    min-height: 80px;
    padding-top: 1.25rem;
}

.pf-float > label {
    position: absolute;
    top: 0.85rem;
    left: 0.75rem;
    margin: 0;
    padding: 0 0.3rem;
    color: #374151;
    font-size: 0.8rem;
    font-weight: 500;
    background: #ffffff;
    pointer-events: none;
    transition: transform 0.15s ease, font-size 0.15s ease, top 0.15s ease;
}

/* Text inputs + textareas — float up on focus or when they have a value.
   Relies on placeholder=" " being set on the input. Floated color = #3b82f6 (EditPet blue). */
.pf-float .pf-control:focus + label,
.pf-float .pf-control:not(:placeholder-shown) + label {
    top: -0.55rem;
    font-size: 0.72rem;
    color: #3b82f6;
}

/* Selects, InputDate, InputNumber always render the label in floated position
   because <select>, type=date and type=number don't support :placeholder-shown. */
.pf-float-always > label {
    top: -0.55rem;
    font-size: 0.72rem;
    color: #3b82f6;
}

.pf-float select.pf-control {
    appearance: auto;
}

.pf-file-input {
    display: block;
    font-size: 0.9rem;
}

.pf-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.pf-preview-tile {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    overflow: hidden;
    background: #f4f4f6;
    border: 1px solid #e2e8f0;
}

.pf-preview-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pf-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    cursor: pointer;
    font-size: 15px;
    line-height: 20px;
    padding: 0;
}

.pf-single-preview {
    margin-top: 10px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.pf-single-preview img {
    max-width: 220px;
    max-height: 180px;
    object-fit: cover;
    border-radius: 10px;
    background: #f4f4f6;
    border: 1px solid #e2e8f0;
}

.pf-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
    padding: 10px 14px;
    border-radius: 8px;
    margin: 12px 0;
    font-size: 0.9rem;
}

.pf-bottom-nav {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 10px;
    border-top: 1px solid #cdbc76;
    background: white;
    border-radius: 0 0 0.5rem 0.5rem;
}

.pf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
}

.pf-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.pf-btn-primary {
    background-color: #3b82f6;
    color: #ffffff;
}

.pf-btn-primary:hover:not(:disabled) {
    background-color: #2563eb;
}

.pf-btn-outline-secondary {
    background-color: #ffffff;
    color: #64748b;
    border: 1px solid #cbd5e1;
}

.pf-btn-outline-secondary:hover:not(:disabled) {
    background-color: #f1f5f9;
}

.pf-btn-danger {
    background-color: #dc2626;
    color: #ffffff;
}

.pf-btn-danger:hover:not(:disabled) {
    background-color: #b91c1c;
}

/* Success state card (when form submission is complete). */
.pf-success {
    background-color: #ffffff;
    border: 1px solid #bbf7d0;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin: 1rem 0;
}

.pf-success h2 {
    color: #16a34a;
    margin-top: 0;
}

.pf-empty {
    color: #94a3b8;
    font-style: italic;
    padding: 0.5rem 0;
}

/* Match-preview grid shown after submission. */
.pf-match-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
    margin-top: 12px;
}

.pf-match-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.pf-match-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: #f1f5f9;
}

.pf-match-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pf-match-score {
    font-weight: 700;
    color: #3b82f6;
}

.pf-match-meta {
    color: #475569;
    font-size: 0.87rem;
}

.pf-spinner {
    display: inline-block;
    width: 0.875rem;
    height: 0.875rem;
    vertical-align: text-bottom;
    border: 0.125rem solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: pf-spinner-border 0.75s linear infinite;
}

@keyframes pf-spinner-border {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 768px) {
    .pf-page-header {
        flex-direction: column;
        gap: 1rem;
    }

    .pf-header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .pf-header-right {
        width: 100%;
        justify-content: flex-end;
    }

    .pf-form-grid {
        grid-template-columns: 1fr;
    }

    .pf-bottom-nav {
        flex-direction: column-reverse;
        gap: 0.5rem;
    }

    .pf-bottom-nav .pf-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .pf-page {
        padding: 0.25rem;
    }

    .pf-header-btn .pf-btn-label {
        display: none;
    }
}
