/* --- Custom Management for CPTs Styles (v1.5.0) --- */

/* 1. Manage Animals List (/manage-animals/ page) - NEW DESIGN */
.my-animals-list-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.cmc-animal-card {
    border: 1px solid #e9ecef;
    background: #fff;
    box-shadow: 0 4px 6px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Ensures image corners are rounded */
}

.cmc-animal-card .featured-image-link img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3; /* A common, pleasant aspect ratio */
    object-fit: cover;
    display: block;
    margin: 0;
}

.cmc-animal-card .card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Makes the content area fill available space */
}

.cmc-animal-card h2 {
    margin: 0 0 10px;
    font-size: 1.4rem;
    color: #1e293b;
}

.cmc-animal-card .card-excerpt {
    color: #475569;
    font-size: 1rem;
    line-height: 1.6;
    flex-grow: 1; /* Pushes buttons to the bottom */
}

.cmc-animal-card .button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    border-top: 1px solid #e9ecef;
    padding-top: 15px;
}

.cmc-animal-card .button { /* Style for Blocksy's default button class */
    flex-grow: 1;
}

.cmc-animal-card .cmc-delete-post-btn {
    background-color: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
    padding: 8px 15px;
    cursor: pointer;
    font-weight: 600;
}
.cmc-animal-card .cmc-delete-post-btn:hover {
    background-color: #d9534f;
    color: #fff;
    border-color: #c9302c;
}


/* 2. Editable Gallery ([cgc_editable_gallery] on /edit/ page) */
.cmc-editable-gallery-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* CHANGED: Max 3 columns */
    gap: 15px;
}

.cmc-gallery-image-wrapper {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1 / 1;
}

.cmc-gallery-image-wrapper img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}

.cmc-remove-image-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #d9534f;
    color: #fff;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    width: 30px;
    height: 30px;
    font-size: 20px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease-in-out;
}
.cmc-remove-image-btn:hover {
    transform: scale(1.1);
    background: #c9302c;
}


/* 3. Responsive Breakpoints */
@media (max-width: 999px) {
    .my-animals-list-container { grid-template-columns: repeat(2, 1fr); }
    .cmc-editable-gallery-container { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 689px) {
    .my-animals-list-container { grid-template-columns: 1fr; }
    .cmc-editable-gallery-container { grid-template-columns: repeat(2, 1fr); }
}

/* --- Ultimate Member Account Tab Fix --- */
/* Hides the redundant 'Save Changes' button that UM adds to our custom tabs. */

.um-account-tab-submit_animal .um-col-alt,
.um-account-tab-manage_animals .um-col-alt {
    display: none !important;
}

/* --- Added in v1.5.5 --- */
/* 4. View Public Profile Link on Edit Page */
.cmc-view-public-link {
    display: inline-flex;
    align-items: center;
    gap: 8px; /* Space between text and icon */
    margin-top: 25px; /* Space above the link */
    font-weight: 600;
    text-decoration: none;
    color: #18383E;
    transition: color 0.2s ease;
}

.cmc-view-public-link:hover {
    color: #bc5d40; /* A nice hover color */
    text-decoration: underline;
}

.cmc-view-public-link svg {
    width: 1em; /* Makes the icon scale with the font size */
    height: 1em;
}