/* Responsive styles for Medical History section on mobile (max-width: 900px) */
@media (max-width: 900px) {
       .analysis-form-row {
            display: flex;
            flex-wrap: wrap;
            gap: 12px;
            width: 100%;
            font-size: 1.2em;
            margin-bottom: 8px;
        }
        .analysis-form-row > div {
            flex: 1 1 0;
            min-width: 50%;
            max-width: 100%;
            box-sizing: border-box;
        }

    #medicalhistorySection .ia-form-container {
        padding: 8px 2vw;
    }
    #medicalhistorySection .analysis-form-row {
        flex-direction: column !important;
        gap: 10px !important;
    }
    #medicalhistorySection label {
        font-size: 1em;
        width: 100%;
        margin-bottom: 4px;
    }
    #medicalhistorySection select {
        width: 100%;
        font-size: 1em;
    }
    #medicalHistoryContent {
        padding: 0;
        font-size: 0.98em;
    }
    #medicalHistoryContent table {
        font-size: 0.98em;
    }
    #medicalHistoryContent img {
        max-width: 80px;
        height: auto;
        margin: 0 0 8px 0;
        display: block;
    }
    #medicalHistoryContent > div {
        flex-direction: column !important;
        gap: 8px !important;
    }

    /* Main menu responsive styles */
    header nav {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        padding: 8px 0;
        background: #2d3a4a;
    }
    .nav-button {
        flex: 1 1 45%;
        min-width: 120px;
        max-width: 95vw;
        margin: 2px 0;
        font-size: 1.08em;
        padding: 10px 0;
        background: #4154e2;
        color: #fff;
        border: none;
        border-radius: 6px;
        box-shadow: 0 1px 4px #0002;
        text-align: center;
    }
    .nav-button.active {
        background: #f7b731;
        color: #2d3a4a;
    }
    header nav {
        border-radius: 0 0 10px 10px;
    }
    /* Dog list images and items */
    .dog-list {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 0 2vw;
    }
    .dog-item {
        display: flex;
        align-items: center;
        gap: 12px;
        background: #a1eb64;
        border-radius: 8px;
        padding: 8px 10px;
        box-shadow: 0 1px 4px #0001;
    }
    .dog-list-photo {
        width: 60px;
        height: 60px;
        object-fit: cover;
        border-radius: 8px;
        border: 1px solid #ccc;
    }
    .details-button {
        font-size: 1em;
        padding: 6px 12px;
        border-radius: 6px;
        background: #4154e2;
        color: #fff;
        border: none;
        margin-left: auto;
    }

    /* Main menu and general button styles */
    .nav-button,
    button,
    input[type="submit"],
    input[type="button"] {
        background: #4154e2 !important;
        color: #fff !important;
        font-size: 1em !important;
        border: none;
        border-radius: 6px;
        box-shadow: 0 1px 4px #0002;
        text-align: center;
    }
    .nav-button.active {
        background: #f7b731 !important;
        color: #2d3a4a !important;
    }
}

/* Responsive styles for Medical History section on tablets/small desktops (max-width: 1400px and min-width: 901px) */
@media (max-width: 1400px) and (min-width: 901px) {
    #medicalhistorySection .ia-form-container {
        padding: 14px 4vw;
    }
    #medicalhistorySection .analysis-form-row {
        flex-direction: row;
        gap: 18px;
    }
    #medicalhistorySection label {
        font-size: 1.08em;
        width: auto;
        margin-bottom: 0;
    }
    #medicalhistorySection select {
        width: 100%;
        font-size: 1.08em;
    }
    #medicalHistoryContent {
        padding: 0;
        font-size: 1em;
    }
    #medicalHistoryContent table {
        font-size: 1em;
    }
    #medicalHistoryContent img {
        max-width: 120px;
        height: auto;
        margin: 0 0 10px 0;
        display: block;
    }
    #medicalHistoryContent > div {
        flex-direction: row;
        gap: 14px;
    }
    /* Main menu styles */
    header nav {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px;
        padding: 12px 0;
        background: #2d3a4a;
        border-radius: 0 0 14px 14px;
        margin-left: 15px !important;
        margin-right: 15px !important;
    }
    .nav-button {
        flex: 1 1 22%;
        min-width: 160px;
        max-width: 40vw;
        margin: 4px 0;
        font-size: 1.12em;
        padding: 12px 0;
        background: #4154e2;
        color: #fff;
        border: none;
        border-radius: 8px;
        box-shadow: 0 2px 8px #0001;
        text-align: center;
        transition: background 0.2s, color 0.2s;
    }
    .nav-button.active {
        background: #f7b731 !important;
        color: #2d3a4a !important;
    }
    /* Dog list images and items */
    .dog-list {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 18px;
        padding: 0 3vw;
        justify-content: flex-start;
    }
    .dog-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
        background: #8bec78;
        border-radius: 10px;
        padding: 14px 12px;
        box-shadow: 0 2px 8px #0001;
        min-width: 180px;
        max-width: 220px;
        flex: 1 1 180px;
    }
    .dog-list-photo {
        width: 90px;
        height: 90px;
        object-fit: cover;
        border-radius: 10px;
        border: 1px solid #ccc;
    }
    .details-button {
        font-size: 1em;
        padding: 8px 16px;
        border-radius: 8px;
        background: #4154e2;
        color: #fff;
        border: none;
        margin-top: 8px;
        width: 100%;
    }
    /* General button style for this range */
    .nav-button,
    button,
    input[type="submit"],
    input[type="button"] {
        background: #4154e2;
        color: #fff;
        font-size: 1.08em;
        border: none;
        border-radius: 8px;
        box-shadow: 0 2px 8px #0001;
        text-align: center;
    }
    .nav-button.active {
        background: #f7b731;
        color: #2d3a4a;
    }
}

/* Responsive styles for Analysis section on mobile (max-width: 900px) */
@media (max-width: 900px) {
    #analysisSection .ia-form-container {
        padding: 8px 2vw;
    }
    #analysisSection .analysis-form-row {
        flex-direction: column !important;
        gap: 10px !important;
    }
    #analysisSection .analysis-form-row > div {
        width: 100%;
        min-width: unset;
        margin-bottom: 8px;
    }
    #analysisSection label {
        font-size: 1em;
        width: 100%;
        margin-bottom: 4px;
        display: block;
    }
    #analysisSection select,
    #analysisSection input[type="date"],
    #analysisSection input[type="file"],
    #analysisSection textarea {
        width: 100%;
        font-size: 1em;
        margin-bottom: 8px;
        box-sizing: border-box;
    }
    #analysisSection textarea {
        min-height: 70px;
        resize: vertical;
    }
    #analysisSection .comment-form-row {
        margin-bottom: 10px;
    }
    #analysisSection button,
    #analysisSection input[type="submit"] {
        background: #4154e2;
        color: #fff;
        font-size: 1em;
        border: none;
        border-radius: 6px;
        box-shadow: 0 1px 4px #0002;
        text-align: center;
        padding: 10px 0;
        min-width: 100px;
        margin-top: 8px;
    }
}

/* Responsive styles for Analysis section on tablets/small desktops (max-width: 1400px and min-width: 901px) */
@media (max-width: 1400px) and (min-width: 901px) {
    #analysisSection .ia-form-container {
        padding: 14px 4vw;
    }
    #analysisSection .analysis-form-row {
        display: flex;
        flex-wrap: wrap;
        gap: 18px;
        flex-direction: row;
    }
    #analysisSection .analysis-form-row > div {
        flex: 1 1 220px;
        min-width: 180px;
        margin-bottom: 8px;
    }
    #analysisSection label {
        font-size: 1.08em;
        width: 100%;
        margin-bottom: 4px;
        display: block;
    }
    #analysisSection select,
    #analysisSection input[type="date"],
    #analysisSection input[type="file"],
    #analysisSection textarea {
        width: 100%;
        font-size: 1.08em;
        margin-bottom: 8px;
        box-sizing: border-box;
    }
    #analysisSection textarea {
        min-height: 80px;
        resize: vertical;
    }
    #analysisSection .comment-form-row {
        margin-bottom: 10px;
    }
    #analysisSection button,
    #analysisSection input[type="submit"] {
        background: #4154e2;
        color: #fff;
        font-size: 1.08em;
        border: none;
        border-radius: 8px;
        box-shadow: 0 2px 8px #0001;
        text-align: center;
        padding: 10px 0;
        min-width: 120px;
        margin-top: 8px;
    }
}

/* Responsive styles for Walks section on mobile (max-width: 900px) */
@media (max-width: 900px) {
    #walksSection .ia-form-container {
        padding: 8px 2vw;
    }
    #walksSection .analysis-form-row {
        flex-direction: column !important;
        gap: 10px !important;
    }
    #walksSection .analysis-form-row > div,
    #walksSection .walks-time-row {
        width: 100%;
        min-width: unset;
        margin-bottom: 8px;
    }
    #walksSection label {
        font-size: 1em;
        width: 100%;
        margin-bottom: 4px;
        display: block;
    }
    #walksSection select,
    #walksSection input[type="date"],
    #walksSection input[type="datetime-local"] {
        width: 100%;
        font-size: 1em;
        margin-bottom: 8px;
        box-sizing: border-box;
    }
    #walksSection button,
    #walksSection input[type="submit"] {
        background: #4154e2;
        color: #fff;
        font-size: 1em;
        border: none;
        border-radius: 6px;
        box-shadow: 0 1px 4px #0002;
        text-align: center;
        padding: 10px 0;
        min-width: 100px;
        margin-top: 8px;
    }
}

/* Responsive styles for Walks section on tablets/small desktops (max-width: 1400px and min-width: 901px) */
@media (max-width: 1400px) and (min-width: 901px) {
    #walksSection .ia-form-container {
        padding: 14px 4vw;
    }
    #walksSection .analysis-form-row {
        display: flex;
        flex-wrap: wrap;
        gap: 18px;
        flex-direction: row;
    }
    #walksSection .analysis-form-row > div,
    #walksSection .walks-time-row {
        flex: 1 1 220px;
        min-width: 180px;
        margin-bottom: 8px;
    }
    #walksSection label {
        font-size: 1.08em;
        width: 100%;
        margin-bottom: 4px;
        display: block;
    }
    #walksSection select,
    #walksSection input[type="date"],
    #walksSection input[type="datetime-local"] {
        width: 100%;
        font-size: 1.08em;
        margin-bottom: 8px;
        box-sizing: border-box;
    }
    #walksSection button,
    #walksSection input[type="submit"] {
        background: #4154e2;
        color: #fff;
        font-size: 1.08em;
        border: none;
        border-radius: 8px;
        box-shadow: 0 2px 8px #0001;
        text-align: center;
        padding: 10px 0;
        min-width: 120px;
        margin-top: 8px;
    }
}

/* Responsive styles for Treatments section on mobile (max-width: 900px) */
@media (max-width: 900px) {
    #treatmentsSection .ia-form-container {
        padding: 8px 2vw;
    }
    #treatmentsSection .analysis-form-row,
    #treatmentsSection .comment-form-row {
        flex-direction: column !important;
        gap: 10px !important;
    }
    #treatmentsSection .analysis-form-row > div,
    #treatmentsSection .comment-form-row > div {
        width: 100%;
        min-width: unset;
        margin-bottom: 8px;
    }
    #treatmentsSection label {
        font-size: 1em;
        width: 100%;
        margin-bottom: 4px;
        display: block;
    }
    #treatmentsSection select,
    #treatmentsSection input[type="date"],
    #treatmentsSection input[type="text"],
    #treatmentsSection input[type="number"],
    #treatmentsSection textarea {
        width: 100%;
        font-size: 1em;
        margin-bottom: 8px;
        box-sizing: border-box;
    }
    #treatmentsSection textarea {
        min-height: 60px;
        resize: vertical;
    }
    #treatmentsSection button,
    #treatmentsSection input[type="submit"] {
        background: #4154e2;
        color: #fff;
        font-size: 1em;
        border: none;
        border-radius: 6px;
        box-shadow: 0 1px 4px #0002;
        text-align: center;
        padding: 10px 0;
        min-width: 100px;
        margin-top: 8px;
    }
    #treatmentsSection .analysis-form-row + .comment-form-row {
        margin-top: 10px !important;
    }
}

/* Responsive styles for Treatments section on tablets/small desktops (max-width: 1400px and min-width: 901px) */
@media (max-width: 1400px) and (min-width: 901px) {
    #treatmentsSection .ia-form-container {
        padding: 14px 4vw;
    }
    #treatmentsSection .analysis-form-row,
    #treatmentsSection .comment-form-row {
        display: flex;
        flex-wrap: wrap;
        gap: 18px;
        flex-direction: row;
    }
    #treatmentsSection .analysis-form-row > div,
    #treatmentsSection .comment-form-row > div {
        flex: 1 1 220px;
        min-width: 180px;
        margin-bottom: 8px;
    }
    #treatmentsSection label {
        font-size: 1.08em;
        width: 100%;
        margin-bottom: 4px;
        display: block;
    }
    #treatmentsSection select,
    #treatmentsSection input[type="date"],
    #treatmentsSection input[type="text"],
    #treatmentsSection input[type="number"],
    #treatmentsSection textarea {
        width: 100%;
        font-size: 1.08em;
        margin-bottom: 8px;
        box-sizing: border-box;
    }
    #treatmentsSection textarea {
        min-height: 70px;
        resize: vertical;
    }
    #treatmentsSection button,
    #treatmentsSection input[type="submit"] {
        background: #4154e2;
        color: #fff;
        font-size: 1.08em;
        border: none;
        border-radius: 8px;
        box-shadow: 0 2px 8px #0001;
        text-align: center;
        padding: 10px 0;
        min-width: 120px;
        margin-top: 8px;
    }
    #treatmentsSection .analysis-form-row + .comment-form-row {
        margin-top: 10px;
    }
}

/* Responsive styles for Vaccines section on mobile (max-width: 900px) */
@media (max-width: 900px) {
    #vaccinesSection .ia-form-container {
        padding: 8px 2vw;
    }
    #vaccinesSection .analysis-form-row {
        flex-direction: column !important;
        gap: 10px !important;
    }
    #vaccinesSection .analysis-form-row > div {
        width: 100%;
        min-width: unset;
        margin-bottom: 8px;
    }
    #vaccinesSection label {
        font-size: 1em;
        width: 100%;
        margin-bottom: 4px;
        display: block;
    }
    #vaccinesSection select,
    #vaccinesSection input[type="date"],
    #vaccinesSection input[type="text"],
    #vaccinesSection input[type="number"],
    #vaccinesSection textarea {
        width: 100%;
        font-size: 1em;
        margin-bottom: 8px;
        box-sizing: border-box;
    }
    #vaccinesSection textarea {
        min-height: 60px;
        resize: vertical;
    }
    #vaccinesSection button,
    #vaccinesSection input[type="submit"] {
        background: #4154e2;
        color: #fff;
        font-size: 1em;
        border: none;
        border-radius: 6px;
        box-shadow: 0 1px 4px #0002;
        text-align: center;
        padding: 10px 0;
        min-width: 100px;
        margin-top: 8px;
    }
}

/* Responsive styles for Vaccines section on tablets/small desktops (max-width: 1400px and min-width: 901px) */
@media (max-width: 1400px) and (min-width: 901px) {
    #vaccinesSection .ia-form-container {
        padding: 14px 4vw;
    }
    #vaccinesSection .analysis-form-row {
        display: flex;
        flex-wrap: wrap;
        gap: 18px;
        flex-direction: row;
    }
    #vaccinesSection .analysis-form-row > div {
        flex: 1 1 220px;
        min-width: 180px;
        margin-bottom: 8px;
    }
    #vaccinesSection label {
        font-size: 1.08em;
        width: 100%;
        margin-bottom: 4px;
        display: block;
    }
    #vaccinesSection select,
    #vaccinesSection input[type="date"],
    #vaccinesSection input[type="text"],
    #vaccinesSection input[type="number"],
    #vaccinesSection textarea {
        width: 100%;
        font-size: 1.08em;
        margin-bottom: 8px;
        box-sizing: border-box;
    }
    #vaccinesSection textarea {
        min-height: 70px;
        resize: vertical;
    }
    #vaccinesSection button,
    #vaccinesSection input[type="submit"] {
        background: #4154e2;
        color: #fff;
        font-size: 1.08em;
        border: none;
        border-radius: 8px;
        box-shadow: 0 2px 8px #0001;
        text-align: center;
        padding: 10px 0;
        min-width: 120px;
        margin-top: 8px;
    }
}

/* Responsive styles for Surgery section on mobile (max-width: 900px) */
@media (max-width: 900px) {
    #surgerySection .ia-form-container {
        padding: 8px 2vw;
    }
    #surgerySection .analysis-form-row {
        flex-direction: column !important;
        gap: 10px !important;
    }
    #surgerySection .analysis-form-row > div {
        width: 100%;
        min-width: unset;
        margin-bottom: 8px;
    }
    #surgerySection label {
        font-size: 1em;
        width: 100%;
        margin-bottom: 4px;
        display: block;
    }
    #surgerySection select,
    #surgerySection input[type="date"],
    #surgerySection input[type="text"],
    #surgerySection input[type="number"],
    #surgerySection textarea {
        width: 100%;
        font-size: 1em;
        margin-bottom: 8px;
        box-sizing: border-box;
    }
    #surgerySection textarea {
        min-height: 60px;
        resize: vertical;
    }
    #surgerySection button,
    #surgerySection input[type="submit"] {
        background: #4154e2;
        color: #fff;
        font-size: 1em;
        border: none;
        border-radius: 6px;
        box-shadow: 0 1px 4px #0002;
        text-align: center;
        padding: 10px 0;
        min-width: 100px;
        margin-top: 8px;
    }
}

/* Responsive styles for Surgery section on tablets/small desktops (max-width: 1400px and min-width: 901px) */
@media (max-width: 1400px) and (min-width: 901px) {
    #surgerySection .ia-form-container {
        padding: 14px 4vw;
    }
    #surgerySection .analysis-form-row {
        display: flex;
        flex-wrap: wrap;
        gap: 18px;
        flex-direction: row;
    }
    #surgerySection .analysis-form-row > div {
        flex: 1 1 220px;
        min-width: 180px;
        margin-bottom: 8px;
    }
    #surgerySection label {
        font-size: 1.08em;
        width: 100%;
        margin-bottom: 4px;
        display: block;
    }
    #surgerySection select,
    #surgerySection input[type="date"],
    #surgerySection input[type="text"],
    #surgerySection input[type="number"],
    #surgerySection textarea {
        width: 100%;
        font-size: 1.08em;
        margin-bottom: 8px;
        box-sizing: border-box;
    }
    #surgerySection textarea {
        min-height: 70px;
        resize: vertical;
    }
    #surgerySection button,
    #surgerySection input[type="submit"] {
        background: #4154e2;
        color: #fff;
        font-size: 1.08em;
        border: none;
        border-radius: 8px;
        box-shadow: 0 2px 8px #0001;
        text-align: center;
        padding: 10px 0;
        min-width: 120px;
        margin-top: 8px;
    }
}

/* Surgery section: increase line spacing for readability */
#surgerySection label,
#surgerySection input,
#surgerySection select,
#surgerySection textarea {
    line-height: 20px !important;
}

/* Surgery section: improve vertical spacing between fields */
#surgerySection .analysis-form-row > div,
#surgerySection .comment-form-row > div {
    margin-bottom: 18px !important;
}
#surgerySection .analysis-form-row,
#surgerySection .comment-form-row {
    row-gap: 18px !important;
    gap: 18px !important;
}

/* Surgeries section: custom row class for better visualization */
.surgeries-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    flex-direction: row;
    margin-bottom: 18px;
}
.surgeries-form-row > div {
    flex: 1 1 260px;
    min-width: 200px;
    margin-bottom: 0;
}
@media (max-width: 900px) {
    .surgeries-form-row {
        flex-direction: column !important;
        gap: 16px !important;
        margin-bottom: 14px;
    }
    .surgeries-form-row > div {
        width: 100%;
        min-width: unset;
    }
}

/* Seccion de cirugias */
@media (max-width: 1400px) and (min-width: 901px) {
    .surgeries-form-row {
        gap: 20px;
        margin-bottom: 16px;
    }
    .surgeries-form-row > div {
        flex: 1 1 220px;
        min-width: 180px;
    }
}

@media (max-width: 900px) {
    #surgeriesSection .ia-form-container {
        padding: 10px 2vw 18px 2vw;
        background: #f8fafd;
        border-radius: 10px;
        box-shadow: 0 2px 8px #0001;
    }

 .surgeries-form-row {
            display: flex;
            flex-wrap: wrap;
            gap: 12px;
            width: 100%;
            margin-bottom: 8px;
        }
        .surgeries-form-row > div {
            flex: 1 1 0;
            min-width: 50%;
            max-width: 100%;
            box-sizing: border-box;
        }

            #surgeriesSection label {
                margin-top: 8px !important;
                margin-bottom: 5px !important;
                font-size: 1.2em !important;
                background: #e7e5f1 !important;
                color: #141416 !important;
                display: block;
            }
            #surgeriesSection textarea,
            #surgeriesSection select,
            #surgeriesSection input[type="date"],
            #surgeriesSection input[type="file"] {
                width: 100% !important;
                margin-top: 8px !important;
                font-size: 1.1em !important;
                min-width: 0 !important;
                box-sizing: border-box;
            }
            #surgeriesSection [style*="display:flex"] {
                display: block !important;
            }
            #surgeriesSection button[type="submit"] {
                width: 100% !important;
                margin-top: 8px;
                min-height: 28px !important;
                font-size: 1.2em !important;
                background: #5f38ec !important;
                color: #f2f1f7 !important;
                padding: 2px 6px !important;
                display: block !important;
            }
}

/* Asegura visibilidad y formato correcto del historial de tratamientos en móviles */
@media (max-width: 900px) {
    #treatmentsSection .records-list,
    #treatmentsHistoryList.records-list {
        display: block !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: auto !important;
        background: #fff;
        padding: 6px 0 8px 0;
        border-radius: 8px;
        box-shadow: 0 1px 4px #0001;
        font-size: 1em;
        color: #222;
        min-height: 30px;
    }
    #treatmentsHistoryList.records-list > * {
        margin-bottom: 8px;
        width: 100%;
        box-sizing: border-box;
    }
    #treatmentsSection h3#treatmentsHistoryHeader {
        font-size: 1.1em;
        margin-top: 12px;
        margin-bottom: 6px;
        color: #2d3a4a;
        text-align: left;
    }
}

/* Ensure footer stays at the bottom of the page */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
main {
    flex: 1 0 auto;
}
footer {
    flex-shrink: 0;
    margin-top: auto;
    width: 100%;
    background: #2d3a4a;
    color: #fff;
    text-align: center;
    padding: 12px 0 8px 0;
    border-radius: 10px 10px 0 0;
    box-shadow: 0 -2px 8px #0001;
}

/* Responsive: medicationsTableSection para móviles (máx 900px) usando flex */
@media (max-width: 900px) {
  #medicationsTableSection {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    margin-left: -4vw;
    padding-left: 4vw;
    padding-right: 2vw;
    box-sizing: border-box;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 6px #0001;
  }
  #medicationsTableSection > div {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
  }
  #medicationsTable {
    display: flex;
    flex-direction: column;
    width: 100% !important;
    min-width: 0;
    border-radius: 8px;
    box-shadow: 0 1px 4px #0001;
    background: #fff;
    border-collapse: separate;
    border-spacing: 0;
  }
  #medicationsTable thead {
    display: none;
  }
  #medicationsTable tbody {
    display: flex;
    flex-direction: column;
    width: 100%;
  }
  #medicationsTable tr {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    width: 100%;
    border-bottom: 1px solid #e0e0e0;
    background: #fff;
    margin-bottom: 2px;
  }
  #medicationsTable td {
    flex: 1 1 0;
    padding: 10px 6px !important;
    font-size: 1em !important;
    word-break: break-word;
    text-align: left;
    border: none;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
  }
  #medicationsTable td:first-child {
    font-weight: 600;
    color: #2d3a4a;
    min-width: 100px;
    flex: 2 1 0;
  }
  #medicationsTable td button {
    margin-left: 10px;
    padding: 4px 12px;
    font-size: 0.98em;
    border-radius: 6px;
    background: #f44336;
    color: #fff;
    border: none;
    cursor: pointer;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  #medicationsTable td:nth-child(2),
  #medicationsTable td:nth-child(3) {
    text-align: center;
    justify-content: center;
    font-size: 0.98em;
    color: #444;
    flex: 1 1 0;
    min-width: 80px;
  }
}

@media (max-width: 1400px) {
    header nav {
        margin-left: 15px !important;
        margin-right: 15px !important;
    }
}

/* DEPURADO: Solo una versión para dogList en móviles */
@media (max-width: 900px) {
  #dogList.dog-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 2vw;
  }
  .dog-item {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
    background: #fff;
    border-radius: 8px;
    padding: 8px 6px;
    box-shadow: 0 1px 4px #0001;
    width: 100%;
    min-width: 0;
  }
  .dog-list-photo {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 50%;
    flex-shrink: 0;
    margin-right: 12px;
    border: 1px solid #ccc;
  }
  /* Agrupa el span y los botones en columna a la derecha de la imagen */
  .dog-item > :not(.dog-list-photo) {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-width: 0;
    gap: 6px;
  }
  .dog-item > :not(.dog-list-photo) > span {
    display: block;
    font-size: 1.1em;
    color: #222;
    margin-bottom: 0;
    background: transparent;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: normal;
    flex: 0 0 auto;
  }
  .dog-item > :not(.dog-list-photo) > .details-button,
  .dog-item > :not(.dog-list-photo) > .other-buttons {
    display: flex;
    flex-direction: row;
    gap: 8px;
    width: 100%;
    justify-content: flex-start;
    align-items: center;
  }
  .dog-item > :not(.dog-list-photo) > .details-button {
    /* Si solo hay un botón, igual se alinea bien */
    margin: 0;
    min-width: 90px;
    max-width: 100%;
    font-size: 1em;
    padding: 8px 12px;
    border-radius: 6px;
    background: #e6e7f0;
    color: #111;
    border: none;
    cursor: pointer;
    text-align: center;
    flex: 0 0 auto;
  }
  /* Si hay más botones, agrúpalos en .other-buttons y aplica el mismo estilo */
  .dog-item > :not(.dog-list-photo) > .other-buttons > button {
    font-size: 1em;
    padding: 8px 12px;
    border-radius: 6px;
    background: #e6e7f0;
    color: #111;
    border: none;
    cursor: pointer;
    text-align: center;
    flex: 0 0 auto;
  }
}

@media (max-width: 900px) {
  #mainSection #addDogForm button[type="submit"] {
    font-size: 0.98em !important;
    padding: 8px 14px !important;
    min-width: 100px !important;
    border-radius: 7px !important;
  }
}

/* Agrupa el span y los botones en columna a la derecha de la imagen */
@media (max-width: 900px) {
  #dogList.dog-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 2vw;
  }
  .dog-item {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
    background: #9cf3a1;
    border-radius: 8px;
    padding: 8px 6px;
    box-shadow: 0 1px 4px #0001;
    width: 100%;
    min-width: 0;
  }
  .dog-list-photo {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 50%;
    flex-shrink: 0;
    margin-right: 12px;
    border: 1px solid #ccc;
  }
  /* Agrupa el span y los botones en columna a la derecha de la imagen */
  .dog-item > :not(.dog-list-photo) {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    gap: 0;
  }
  .dog-item > :not(.dog-list-photo) > span {
    display: block;
    font-size: 1.1em;
    color: #222;
    margin-bottom: 6px;
    background: transparent;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: normal;
    width: 100%;
    order: 1;
  }
  /* Agrupa todos los botones en una fila debajo del nombre */
  .dog-item > :not(.dog-list-photo) > .dog-buttons-row {
    display: flex;
    flex-direction: row;
    gap: 8px;
    width: 100%;
    order: 2;
  }
  .dog-item > :not(.dog-list-photo) > .dog-buttons-row > button,
  .dog-item > :not(.dog-list-photo) > .dog-buttons-row > .details-button {
    min-width: 90px;
    max-width: 100%;
    font-size: 1em;
    padding: 8px 12px;
    border-radius: 6px;
    background: #e6e7f0;
    color: #111;
    border: none;
    cursor: pointer;
    text-align: center;
    flex: 1 1 auto;
    margin: 0;
  }
}

/* Responsive styles for dog-item buttons row on tablets/small desktops (max-width: 1400px and min-width: 901px) */
@media (max-width: 1400px) and (min-width: 901px) {
  .dog-item .dog-buttons-row {
    display: flex;
    flex-direction: row;
    gap: 0;
    width: 100%;
    justify-content: center;
    align-items: center;
    margin-top: 8px;
  }
  .dog-item .dog-buttons-row > button,
  .dog-item .dog-buttons-row > .details-button {
    min-width: 80px;
    max-width: 100%;
    font-size: 1em;
    padding: 10px 18px;
    border-radius: 8px;
    background: #1e53e4;
    color: #e7eaf1;
    border: none;
    cursor: pointer;
    text-align: center;
    flex: 1 1 auto;
    margin: 3px 0;
  }
  .dog-item .dog-buttons-row > button:first-child,
  .dog-item .dog-buttons-row > .details-button:first-child {
    margin-right: 5px !important;
    margin-left: 5px !important;
  }
  .dog-item .dog-buttons-row > button:last-child,
  .dog-item .dog-buttons-row > .details-button:last-child {
    margin-right: 5px !important;
    margin-left: 5px !important;
  }
}

/* Efecto hover para los botones de la dog list en pantallas de 901px a 1400px */
@media (min-width: 901px) and (max-width: 1400px) {
  .dog-item .dog-buttons-row > button:hover,
  .dog-item .dog-buttons-row > .details-button:hover {
    background: #f7b731;
    color: #1e53e4;
    box-shadow: 0 2px 10px #1e53e455;
    transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  }
}
